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 @expectedFailureAll(oslist=['freebsd']) 23 def test_multiple_debuggers(self): 24 env = {self.dylibPath: self.getLLDBLibraryEnvVal()} 25 26 self.driver_exe = self.getBuildArtifact("multi-process-driver") 27 self.buildDriver('multi-process-driver.cpp', self.driver_exe) 28 self.addTearDownHook(lambda: os.remove(self.driver_exe)) 29 self.signBinary(self.driver_exe) 30 31 self.inferior_exe = self.getBuildArtifact("testprog") 32 self.buildDriver('testprog.cpp', self.inferior_exe) 33 self.addTearDownHook(lambda: os.remove(self.inferior_exe)) 34 35 # check_call will raise a CalledProcessError if multi-process-driver 36 # doesn't return exit code 0 to indicate success. We can let this 37 # exception go - the test harness will recognize it as a test failure. 38 39 if self.TraceOn(): 40 print("Running test %s" % self.driver_exe) 41 check_call([self.driver_exe, self.inferior_exe], env=env) 42 else: 43 with open(os.devnull, 'w') as fnull: 44 check_call([self.driver_exe, self.inferior_exe], 45 env=env, stdout=fnull, stderr=fnull) 46