1 2 3import gdbremote_testcase 4import lldbgdbserverutils 5import os 6import select 7from lldbsuite.test.decorators import * 8from lldbsuite.test.lldbtest import * 9from lldbsuite.test import lldbutil 10 11 12class TestStubSetSIDTestCase(gdbremote_testcase.GdbRemoteTestCaseBase): 13 14 mydir = TestBase.compute_mydir(__file__) 15 16 def get_stub_sid(self, extra_stub_args=None): 17 # Launch debugserver 18 if extra_stub_args: 19 self.debug_monitor_extra_args += extra_stub_args 20 21 server = self.launch_debug_monitor() 22 self.assertIsNotNone(server) 23 self.assertTrue( 24 lldbgdbserverutils.process_is_running( 25 server.pid, True)) 26 27 # Get the process id for the stub. 28 return os.getsid(server.pid) 29 30 def sid_is_same_without_setsid(self): 31 stub_sid = self.get_stub_sid() 32 self.assertEqual(stub_sid, os.getsid(0)) 33 34 def sid_is_different_with_setsid(self): 35 stub_sid = self.get_stub_sid(["--setsid"]) 36 self.assertNotEqual(stub_sid, os.getsid(0)) 37 38 def sid_is_different_with_S(self): 39 stub_sid = self.get_stub_sid(["-S"]) 40 self.assertNotEqual(stub_sid, os.getsid(0)) 41 42 @debugserver_test 43 @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target 44 def test_sid_is_same_without_setsid_debugserver(self): 45 self.init_debugserver_test() 46 self.set_inferior_startup_launch() 47 self.sid_is_same_without_setsid() 48 49 @skipIfWindows 50 @llgs_test 51 @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target 52 def test_sid_is_same_without_setsid_llgs(self): 53 self.init_llgs_test() 54 self.set_inferior_startup_launch() 55 self.sid_is_same_without_setsid() 56 57 @debugserver_test 58 @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target 59 def test_sid_is_different_with_setsid_debugserver(self): 60 self.init_debugserver_test() 61 self.set_inferior_startup_launch() 62 self.sid_is_different_with_setsid() 63 64 @skipIfWindows 65 @llgs_test 66 @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target 67 def test_sid_is_different_with_setsid_llgs(self): 68 self.init_llgs_test() 69 self.set_inferior_startup_launch() 70 self.sid_is_different_with_setsid() 71 72 @debugserver_test 73 @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target 74 def test_sid_is_different_with_S_debugserver(self): 75 self.init_debugserver_test() 76 self.set_inferior_startup_launch() 77 self.sid_is_different_with_S() 78 79 @skipIfWindows 80 @llgs_test 81 @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target 82 def test_sid_is_different_with_S_llgs(self): 83 self.init_llgs_test() 84 self.set_inferior_startup_launch() 85 self.sid_is_different_with_S() 86