46 lines · python
1import gdbremote_testcase2import lldbgdbserverutils3import os4import select5from lldbsuite.test.decorators import *6from lldbsuite.test.lldbtest import *7from lldbsuite.test import lldbutil8 9 10class TestStubSetSIDTestCase(gdbremote_testcase.GdbRemoteTestCaseBase):11 def get_stub_sid(self, extra_stub_args=None):12 # Launch debugserver13 if extra_stub_args:14 self.debug_monitor_extra_args += extra_stub_args15 16 server = self.launch_debug_monitor()17 self.assertIsNotNone(server)18 self.assertTrue(lldbgdbserverutils.process_is_running(server.pid, True))19 20 # Get the process id for the stub.21 return os.getsid(server.pid)22 23 @skipIfWindows24 @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target25 def test_sid_is_same_without_setsid(self):26 self.set_inferior_startup_launch()27 28 stub_sid = self.get_stub_sid()29 self.assertEqual(stub_sid, os.getsid(0))30 31 @skipIfWindows32 @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target33 def test_sid_is_different_with_setsid(self):34 self.set_inferior_startup_launch()35 36 stub_sid = self.get_stub_sid(["--setsid"])37 self.assertNotEqual(stub_sid, os.getsid(0))38 39 @skipIfWindows40 @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target41 def test_sid_is_different_with_S_llgs(self):42 self.set_inferior_startup_launch()43 44 stub_sid = self.get_stub_sid(["-S"])45 self.assertNotEqual(stub_sid, os.getsid(0))46