1
2# lldb test suite imports
3from lldbsuite.test.decorators import *
4from lldbsuite.test.lldbtest import TestBase
5
6# gdb-remote-specific imports
7import lldbgdbserverutils
8from gdbremote_testcase import GdbRemoteTestCaseBase
9
10
11class TestGdbRemoteExitCode(GdbRemoteTestCaseBase):
12
13    mydir = TestBase.compute_mydir(__file__)
14
15    def inferior_exit_0(self):
16        self.prep_debug_monitor_and_inferior()
17        self.test_sequence.add_log_lines(
18            ["read packet: $vCont;c#a8",
19             "send packet: $W00#00"],
20            True)
21
22        self.expect_gdbremote_sequence()
23
24    @debugserver_test
25    @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
26    def test_inferior_exit_0_debugserver(self):
27        self.build()
28        self.inferior_exit_0()
29
30    @llgs_test
31    def test_inferior_exit_0_llgs(self):
32        self.build()
33        self.inferior_exit_0()
34
35    def inferior_exit_42(self):
36        RETVAL = 42
37
38        procs = self.prep_debug_monitor_and_inferior(
39            inferior_args=["retval:%d" % RETVAL])
40
41        self.test_sequence.add_log_lines(
42            ["read packet: $vCont;c#a8",
43             "send packet: $W{0:02x}#00".format(RETVAL)],
44            True)
45
46        self.expect_gdbremote_sequence()
47
48    @debugserver_test
49    @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
50    def test_inferior_exit_42_debugserver(self):
51        self.build()
52        self.inferior_exit_42()
53
54    @llgs_test
55    def test_inferior_exit_42_llgs(self):
56        self.build()
57        self.inferior_exit_42()
58