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

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 29 09:34:04 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)
----------------
kastiglione wrote:

A few tests do reset do reset the file handle (however some tests do not). I'll add a reset here too.

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


More information about the lldb-commits mailing list