xref: /llvm-project/lldb/test/API/tools/lldb-server/TestGdbRemoteExitCode.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1# lldb test suite imports
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import TestBase
4
5# gdb-remote-specific imports
6import lldbgdbserverutils
7from gdbremote_testcase import GdbRemoteTestCaseBase
8
9
10class TestGdbRemoteExitCode(GdbRemoteTestCaseBase):
11    def _test_inferior_exit(self, retval):
12        self.build()
13
14        procs = self.prep_debug_monitor_and_inferior(
15            inferior_args=["retval:%d" % retval]
16        )
17
18        self.test_sequence.add_log_lines(
19            ["read packet: $vCont;c#a8", "send packet: $W{0:02x}#00".format(retval)],
20            True,
21        )
22
23        self.expect_gdbremote_sequence()
24
25    def test_inferior_exit_0(self):
26        self._test_inferior_exit(0)
27
28    def test_inferior_exit_42(self):
29        self._test_inferior_exit(42)
30