Jason Molenda | 8c074015 | 2014-07-10 02:17:31 +0000 | [diff] [blame] | 1 | """Test the lldb public C++ api when doing multiple debug sessions simultaneously.""" |
| 2 | |
| 3 | import os, re, StringIO |
| 4 | import unittest2 |
| 5 | from lldbtest import * |
| 6 | import lldbutil |
| 7 | import lldb |
| 8 | import subprocess |
| 9 | |
| 10 | class TestMultipleSimultaneousDebuggers(TestBase): |
| 11 | |
| 12 | mydir = TestBase.compute_mydir(__file__) |
| 13 | |
| 14 | def setUp(self): |
| 15 | TestBase.setUp(self) |
| 16 | self.lib_dir = os.environ["LLDB_LIB_DIR"] |
| 17 | |
| 18 | @skipIfi386 |
Todd Fiala | 57cacb01 | 2014-07-10 20:52:08 +0000 | [diff] [blame] | 19 | @expectedFailureDarwin("llvm.org/pr20282") # intermittent |
Ed Maste | 8abef69 | 2014-07-12 15:21:55 +0000 | [diff] [blame] | 20 | @expectedFailureFreeBSD("llvm.org/pr20282") |
Todd Fiala | 57cacb01 | 2014-07-10 20:52:08 +0000 | [diff] [blame] | 21 | @expectedFailureLinux("llvm.org/pr20282") |
Jason Molenda | 91c2a99 | 2014-07-10 09:55:19 +0000 | [diff] [blame] | 22 | def test_multiple_debuggers(self): |
Jason Molenda | 8c074015 | 2014-07-10 02:17:31 +0000 | [diff] [blame] | 23 | |
| 24 | self.driver_exe = os.path.join(os.getcwd(), "multi-process-driver") |
| 25 | self.buildDriver('multi-process-driver.cpp', self.driver_exe) |
| 26 | self.addTearDownHook(lambda: os.remove(self.driver_exe)) |
| 27 | |
| 28 | self.inferior_exe = os.path.join(os.getcwd(), "testprog") |
| 29 | self.buildDriver('testprog.cpp', self.inferior_exe) |
| 30 | self.addTearDownHook(lambda: os.remove(self.inferior_exe)) |
| 31 | |
| 32 | env = {self.dylibPath : self.getLLDBLibraryEnvVal()} |
| 33 | |
| 34 | # check_call will raise a CalledProcessError if multi-process-driver doesn't return |
| 35 | # exit code 0 to indicate success. We can let this exception go - the test harness |
| 36 | # 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], env=env, stdout=fnull, stderr=fnull) |
| 44 | |
| 45 | if __name__ == '__main__': |
| 46 | import atexit |
| 47 | lldb.SBDebugger.Initialize() |
| 48 | atexit.register(lambda: lldb.SBDebugger.Terminate()) |
| 49 | unittest2.main() |