1*4384c96fSPavel Labath""" 2*4384c96fSPavel LabathTest handling of the situation where the main thread exits but the other threads 3*4384c96fSPavel Labathin the process keep running. 4*4384c96fSPavel Labath""" 5*4384c96fSPavel Labath 6*4384c96fSPavel Labathimport lldb 7*4384c96fSPavel Labathfrom lldbsuite.test.decorators import * 8*4384c96fSPavel Labathfrom lldbsuite.test.lldbtest import * 9*4384c96fSPavel Labathimport lldbsuite.test.lldbutil as lldbutil 10*4384c96fSPavel Labath 11*4384c96fSPavel Labath 12*4384c96fSPavel Labathclass ThreadExitTestCase(TestBase): 13*4384c96fSPavel Labath NO_DEBUG_INFO_TESTCASE = True 14*4384c96fSPavel Labath 15*4384c96fSPavel Labath # Needs os-specific implementation in the inferior 16*4384c96fSPavel Labath @skipIf(oslist=no_match(["linux"])) 17*4384c96fSPavel Labath def test(self): 18*4384c96fSPavel Labath self.build() 19*4384c96fSPavel Labath lldbutil.run_to_source_breakpoint(self, "// break here", 20*4384c96fSPavel Labath lldb.SBFileSpec("main.cpp")) 21*4384c96fSPavel Labath 22*4384c96fSPavel Labath # There should be one (non-main) thread left 23*4384c96fSPavel Labath self.assertEquals(self.process().GetNumThreads(), 1) 24*4384c96fSPavel Labath 25*4384c96fSPavel Labath # Ensure we can evaluate_expressions in this state 26*4384c96fSPavel Labath self.expect_expr("call_me()", result_value="12345") 27*4384c96fSPavel Labath 28*4384c96fSPavel Labath self.runCmd("continue") 29*4384c96fSPavel Labath self.assertEquals(self.process().GetExitStatus(), 47) 30