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 | |
Zachary Turner | 814236d | 2015-10-21 17:48:52 +0000 | [diff] [blame] | 3 | import lldb_shared |
| 4 | |
| 5 | import os, re |
Jason Molenda | 8c074015 | 2014-07-10 02:17:31 +0000 | [diff] [blame] | 6 | from lldbtest import * |
| 7 | import lldbutil |
| 8 | import lldb |
| 9 | import subprocess |
| 10 | |
| 11 | class TestMultipleSimultaneousDebuggers(TestBase): |
| 12 | |
| 13 | mydir = TestBase.compute_mydir(__file__) |
| 14 | |
| 15 | def setUp(self): |
| 16 | TestBase.setUp(self) |
| 17 | self.lib_dir = os.environ["LLDB_LIB_DIR"] |
Adrian McCarthy | b016b3c | 2015-03-27 20:47:35 +0000 | [diff] [blame] | 18 | self.implib_dir = os.environ["LLDB_IMPLIB_DIR"] |
Jason Molenda | 8c074015 | 2014-07-10 02:17:31 +0000 | [diff] [blame] | 19 | |
| 20 | @skipIfi386 |
Enrico Granata | d2657c5 | 2014-10-16 23:02:45 +0000 | [diff] [blame] | 21 | @skipIfNoSBHeaders |
Ed Maste | 8abef69 | 2014-07-12 15:21:55 +0000 | [diff] [blame] | 22 | @expectedFailureFreeBSD("llvm.org/pr20282") |
Todd Fiala | 57cacb01 | 2014-07-10 20:52:08 +0000 | [diff] [blame] | 23 | @expectedFailureLinux("llvm.org/pr20282") |
Zachary Turner | 4a58dd3 | 2015-09-16 18:08:33 +0000 | [diff] [blame] | 24 | @expectedFailureWindows # Test crashes |
Todd Fiala | d089060d | 2015-09-15 05:31:27 +0000 | [diff] [blame] | 25 | @expectedFlakeyDarwin() |
Jason Molenda | 91c2a99 | 2014-07-10 09:55:19 +0000 | [diff] [blame] | 26 | def test_multiple_debuggers(self): |
Enrico Granata | d2657c5 | 2014-10-16 23:02:45 +0000 | [diff] [blame] | 27 | env = {self.dylibPath : self.getLLDBLibraryEnvVal()} |
Jason Molenda | 8c074015 | 2014-07-10 02:17:31 +0000 | [diff] [blame] | 28 | |
| 29 | self.driver_exe = os.path.join(os.getcwd(), "multi-process-driver") |
| 30 | self.buildDriver('multi-process-driver.cpp', self.driver_exe) |
| 31 | self.addTearDownHook(lambda: os.remove(self.driver_exe)) |
Oleksiy Vyalov | 49b71c6 | 2015-01-22 20:03:21 +0000 | [diff] [blame] | 32 | self.signBinary(self.driver_exe) |
Jason Molenda | 8c074015 | 2014-07-10 02:17:31 +0000 | [diff] [blame] | 33 | |
| 34 | self.inferior_exe = os.path.join(os.getcwd(), "testprog") |
| 35 | self.buildDriver('testprog.cpp', self.inferior_exe) |
| 36 | self.addTearDownHook(lambda: os.remove(self.inferior_exe)) |
| 37 | |
Jason Molenda | 8c074015 | 2014-07-10 02:17:31 +0000 | [diff] [blame] | 38 | # check_call will raise a CalledProcessError if multi-process-driver doesn't return |
| 39 | # exit code 0 to indicate success. We can let this exception go - the test harness |
| 40 | # will recognize it as a test failure. |
| 41 | |
| 42 | if self.TraceOn(): |
| 43 | print "Running test %s" % self.driver_exe |
| 44 | check_call([self.driver_exe, self.inferior_exe], env=env) |
| 45 | else: |
| 46 | with open(os.devnull, 'w') as fnull: |
| 47 | check_call([self.driver_exe, self.inferior_exe], env=env, stdout=fnull, stderr=fnull) |