[Lldb-commits] [lldb] Add AllowRepeats to SBCommandInterpreterRunOptions. (PR #94786)

via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 7 11:30:02 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r b653357141030620ce3e70ea939efbcb71d40657...bcd8c81c5fbc249886c53d8a2d1bc21a3f9e1ffd lldb/test/API/python_api/interpreter/TestRunCommandInterpreterAPI.py
``````````

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- TestRunCommandInterpreterAPI.py	2024-06-07 18:17:26.000000 +0000
+++ TestRunCommandInterpreterAPI.py	2024-06-07 18:29:38.709767 +0000
@@ -46,22 +46,27 @@
     def setUp(self):
         TestBase.setUp(self)
 
         self.stdin_path = self.getBuildArtifact("stdin.txt")
         self.stdout_path = self.getBuildArtifact("stdout.txt")
-    def run_commands_string(self, command_string, options = lldb.SBCommandInterpreterRunOptions()):
+
+    def run_commands_string(
+        self, command_string, options=lldb.SBCommandInterpreterRunOptions()
+    ):
         """Run the commands in command_string through RunCommandInterpreter.
-           Returns (n_errors, quit_requested, has_crashed, result_string)."""
-        
+        Returns (n_errors, quit_requested, has_crashed, result_string)."""
+
         with open(self.stdin_path, "w") as input_handle:
             input_handle.write(command_string)
 
         n_errors = 0
         quit_requested = False
         has_crashed = False
-        
-        with open(self.stdin_path, "r") as in_fileH, open(self.stdout_path, "w") as out_fileH:
+
+        with open(self.stdin_path, "r") as in_fileH, open(
+            self.stdout_path, "w"
+        ) as out_fileH:
             self.dbg.SetInputFile(in_fileH)
 
             self.dbg.SetOutputFile(out_fileH)
             self.dbg.SetErrorFile(out_fileH)
 
@@ -73,36 +78,38 @@
         with open(self.stdout_path, "r") as out_fileH:
             result_string = out_fileH.read()
 
         print(f"Command: '{command_string}'\nResult:\n{result_string}")
         return (n_errors, quit_requested, has_crashed, result_string)
-       
 
     def test_run_session_with_error_and_quit(self):
         """Run non-existing and quit command returns appropriate values"""
 
         n_errors, quit_requested, has_crashed, _ = self.run_commands_string(
-            "nonexistingcommand\nquit\n")
+            "nonexistingcommand\nquit\n"
+        )
         self.assertGreater(n_errors, 0)
         self.assertTrue(quit_requested)
         self.assertFalse(has_crashed)
 
     def test_allow_repeat(self):
         """Try auto-repeat of process launch - the command will fail and
-           the auto-repeat will fail because of no auto-repeat."""
+        the auto-repeat will fail because of no auto-repeat."""
         options = lldb.SBCommandInterpreterRunOptions()
         options.SetEchoCommands(False)
         options.SetAllowRepeats(True)
-            
+
         n_errors, quit_requested, has_crashed, result_str = self.run_commands_string(
-            "process launch\n\n", options)
+            "process launch\n\n", options
+        )
         self.assertEqual(n_errors, 2)
         self.assertFalse(quit_requested)
         self.assertFalse(has_crashed)
 
         self.assertIn("invalid target", result_str)
-        self.assertIn("No auto repeat", result_str)        
+        self.assertIn("No auto repeat", result_str)
+
 
 class SBCommandInterpreterRunOptionsCase(TestBase):
     NO_DEBUG_INFO_TESTCASE = True
 
     def test_command_interpreter_run_options(self):

``````````

</details>


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


More information about the lldb-commits mailing list