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 _test_inferior_exit(self, retval):
16        self.build()
17
18        procs = self.prep_debug_monitor_and_inferior(
19            inferior_args=["retval:%d" % retval])
20
21        self.test_sequence.add_log_lines(
22            ["read packet: $vCont;c#a8",
23             "send packet: $W{0:02x}#00".format(retval)],
24            True)
25
26        self.expect_gdbremote_sequence()
27
28    @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
29    def test_inferior_exit_0(self):
30        self._test_inferior_exit(0)
31
32    @skipIfDarwinEmbedded # <rdar://problem/34539270> lldb-server tests not updated to work on ios etc yet
33    def test_inferior_exit_42(self):
34        self._test_inferior_exit(42)
35