[Lldb-commits] [lldb] [lldb] Set return status to Failed when Python command raises uncaught exception (PR #113996)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 29 02:50:44 PDT 2024


================
@@ -0,0 +1,27 @@
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+
+class TestCase(TestBase):
+    NO_DEBUG_INFO_TESTCASE = True
+
+    def test(self):
+        """
+        Check that a Python command, which raises an unhandled exception, has
+        its status set to failed.
+        """
+        command_path = os.path.join(self.getSourceDir(), "throw_command.py")
+        self.runCmd(f"command script import {command_path}")
+
+        with open(os.devnull, "w") as devnull:
+            self.dbg.SetErrorFileHandle(devnull, False)
----------------
DavidSpickett wrote:

Should the context manager reset `self.dbg`'s error file handle after this or is `self.dbg` remade for every test?

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


More information about the lldb-commits mailing list