[Lldb-commits] [lldb] Add the ability for Script based commands to specify their "repeat command" (PR #94823)

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 26 18:14:40 PDT 2024


================
@@ -32,6 +37,39 @@ def check_help_options(self, cmd_name, opt_list, substrs=[]):
         print(f"Opt Vec\n{substrs}")
         self.expect("help " + cmd_name, substrs=substrs)
 
+    def run_one_repeat(self, commands, expected_num_errors):
+        with open(self.stdin_path, "w") as input_handle:
+            input_handle.write(commands)
+
+        in_fileH = open(self.stdin_path, "r")
+        self.dbg.SetInputFileHandle(in_fileH, False)
+
+        out_fileH = open(self.stdout_path, "w")
+        self.dbg.SetOutputFileHandle(out_fileH, False)
+        self.dbg.SetErrorFileHandle(out_fileH, False)
+
+        options = lldb.SBCommandInterpreterRunOptions()
+        options.SetEchoCommands(False)
+        options.SetPrintResults(True)
+        options.SetPrintErrors(True)
+        options.SetAllowRepeats(True)
+
+        n_errors, quit_requested, has_crashed = self.dbg.RunCommandInterpreter(
+            True, False, options, 0, False, False
+        )
+
+        in_fileH.close()
+        out_fileH.close()
+
+        results = None
+        with open(self.stdout_path, "r") as out_fileH:
+            results = out_fileH.read()
+
+        print(f"RESULTS:\n{results}\nDONE")
----------------
medismailben wrote:

May be we should only print if the test suite in verbose/trace mode.

https://github.com/llvm/llvm-project/pull/94823


More information about the lldb-commits mailing list