32 lines · python
1"""2Test handling of the situation where the main thread exits but the other threads3in the process keep running.4"""5 6import lldb7from lldbsuite.test.decorators import *8from lldbsuite.test.lldbtest import *9import lldbsuite.test.lldbutil as lldbutil10 11 12class ThreadExitTestCase(TestBase):13 NO_DEBUG_INFO_TESTCASE = True14 15 # Needs os-specific implementation in the inferior16 @skipIf(oslist=no_match(["linux"]))17 def test(self):18 self.build()19 lldbutil.run_to_source_breakpoint(20 self, "// break here", lldb.SBFileSpec("main.cpp")21 )22 23 # There should be one (non-main) thread left24 self.assertEqual(self.process().GetNumThreads(), 1)25 26 # Ensure we can evaluate_expressions in this state27 self.expect_expr("call_me()", result_value="12345")28 29 self.runCmd("continue")30 # Exit code depends on the version of the linux kernel31 self.assertIn(self.process().GetExitStatus(), [42, 47])32