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