1"""Test the lldb public C++ api when doing multiple debug sessions simultaneously.""" 2 3from __future__ import print_function 4 5 6import os 7 8import lldb 9from lldbsuite.test.decorators import * 10from lldbsuite.test.lldbtest import * 11from lldbsuite.test import lldbutil 12 13 14class TestMultipleSimultaneousDebuggers(TestBase): 15 16 mydir = TestBase.compute_mydir(__file__) 17 18 NO_DEBUG_INFO_TESTCASE = True 19 20 @skipIfNoSBHeaders 21 @skipIfWindows 22 def test_multiple_debuggers(self): 23 env = {self.dylibPath: self.getLLDBLibraryEnvVal()} 24 25 self.driver_exe = self.getBuildArtifact("multi-process-driver") 26 self.buildDriver('multi-process-driver.cpp', self.driver_exe) 27 self.addTearDownHook(lambda: os.remove(self.driver_exe)) 28 self.signBinary(self.driver_exe) 29 30 self.inferior_exe = self.getBuildArtifact("testprog") 31 self.buildDriver('testprog.cpp', self.inferior_exe) 32 self.addTearDownHook(lambda: os.remove(self.inferior_exe)) 33 34 # check_call will raise a CalledProcessError if multi-process-driver 35 # doesn't return exit code 0 to indicate success. We can let this 36 # exception go - the test harness will recognize it as a test failure. 37 38 if self.TraceOn(): 39 print("Running test %s" % self.driver_exe) 40 check_call([self.driver_exe, self.inferior_exe], env=env) 41 else: 42 with open(os.devnull, 'w') as fnull: 43 check_call([self.driver_exe, self.inferior_exe], 44 env=env, stdout=fnull, stderr=fnull) 45