blob: 029a1d01ab651d0e7b4e3ec7d7f2a070258c70d0 [file] [log] [blame]
Jason Molenda8c0740152014-07-10 02:17:31 +00001"""Test the lldb public C++ api when doing multiple debug sessions simultaneously."""
2
3import os, re, StringIO
4import unittest2
5from lldbtest import *
6import lldbutil
7import lldb
8import subprocess
9
10class 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 Fiala57cacb012014-07-10 20:52:08 +000019 @expectedFailureDarwin("llvm.org/pr20282") # intermittent
Ed Maste8abef692014-07-12 15:21:55 +000020 @expectedFailureFreeBSD("llvm.org/pr20282")
Todd Fiala57cacb012014-07-10 20:52:08 +000021 @expectedFailureLinux("llvm.org/pr20282")
Jason Molenda91c2a992014-07-10 09:55:19 +000022 def test_multiple_debuggers(self):
Jason Molenda8c0740152014-07-10 02:17:31 +000023
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
45if __name__ == '__main__':
46 import atexit
47 lldb.SBDebugger.Initialize()
48 atexit.register(lambda: lldb.SBDebugger.Terminate())
49 unittest2.main()