xref: /llvm-project/lldb/test/API/tools/lldb-server/TestGdbRemoteExitCode.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
199451b44SJordan Rupprecht# lldb test suite imports
299451b44SJordan Rupprechtfrom lldbsuite.test.decorators import *
399451b44SJordan Rupprechtfrom lldbsuite.test.lldbtest import TestBase
499451b44SJordan Rupprecht
599451b44SJordan Rupprecht# gdb-remote-specific imports
699451b44SJordan Rupprechtimport lldbgdbserverutils
799451b44SJordan Rupprechtfrom gdbremote_testcase import GdbRemoteTestCaseBase
899451b44SJordan Rupprecht
999451b44SJordan Rupprecht
1099451b44SJordan Rupprechtclass TestGdbRemoteExitCode(GdbRemoteTestCaseBase):
110a8a2453SPavel Labath    def _test_inferior_exit(self, retval):
1299451b44SJordan Rupprecht        self.build()
1399451b44SJordan Rupprecht
14ce279e0cSPavel Labath        procs = self.prep_debug_monitor_and_inferior(
15*2238dcc3SJonas Devlieghere            inferior_args=["retval:%d" % retval]
16*2238dcc3SJonas Devlieghere        )
1799451b44SJordan Rupprecht
1899451b44SJordan Rupprecht        self.test_sequence.add_log_lines(
19*2238dcc3SJonas Devlieghere            ["read packet: $vCont;c#a8", "send packet: $W{0:02x}#00".format(retval)],
20*2238dcc3SJonas Devlieghere            True,
21*2238dcc3SJonas Devlieghere        )
2299451b44SJordan Rupprecht
2399451b44SJordan Rupprecht        self.expect_gdbremote_sequence()
2499451b44SJordan Rupprecht
250a8a2453SPavel Labath    def test_inferior_exit_0(self):
260a8a2453SPavel Labath        self._test_inferior_exit(0)
2799451b44SJordan Rupprecht
280a8a2453SPavel Labath    def test_inferior_exit_42(self):
290a8a2453SPavel Labath        self._test_inferior_exit(42)
30