Add a new test in api/multiple-debuggers which tries to create 50
debug sessions simultaneously to expose race conditoin/locking
issues.
This directory has an inferior program, testprog.cpp that has a
couple of functions we can put breakpoints on.
It has a driver program, multi-process-driver.cpp, which links
against the LLDB solib and uses the SB APIs. It creates 50 pthreads,
creates a debugger on all of them, launches a debug session of the
inferior testprog, hits a couple breakpoints, walks the stack,
continues, etc., and then kills the inferior and ends the debug
session.
A pass is if all fifty debug sessions complete successfully
in the alloted time (~60 seconds).
We may need to tweak this one to work correctly on different
platforms/targets but I wanted to get it checked in to start.
llvm-svn: 212671
2014-07-10 10:17:31 +08:00
|
|
|
"""Test the lldb public C++ api when doing multiple debug sessions simultaneously."""
|
|
|
|
|
|
|
|
import os, re, StringIO
|
|
|
|
import unittest2
|
|
|
|
from lldbtest import *
|
|
|
|
import lldbutil
|
|
|
|
import lldb
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
class TestMultipleSimultaneousDebuggers(TestBase):
|
|
|
|
|
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
TestBase.setUp(self)
|
|
|
|
self.lib_dir = os.environ["LLDB_LIB_DIR"]
|
|
|
|
|
|
|
|
@skipIfi386
|
2014-10-17 07:02:45 +08:00
|
|
|
@skipIfNoSBHeaders
|
2014-07-11 04:52:08 +08:00
|
|
|
@expectedFailureDarwin("llvm.org/pr20282") # intermittent
|
2014-07-12 23:21:55 +08:00
|
|
|
@expectedFailureFreeBSD("llvm.org/pr20282")
|
2014-07-11 04:52:08 +08:00
|
|
|
@expectedFailureLinux("llvm.org/pr20282")
|
2014-07-10 17:55:19 +08:00
|
|
|
def test_multiple_debuggers(self):
|
2014-10-17 07:02:45 +08:00
|
|
|
env = {self.dylibPath : self.getLLDBLibraryEnvVal()}
|
Add a new test in api/multiple-debuggers which tries to create 50
debug sessions simultaneously to expose race conditoin/locking
issues.
This directory has an inferior program, testprog.cpp that has a
couple of functions we can put breakpoints on.
It has a driver program, multi-process-driver.cpp, which links
against the LLDB solib and uses the SB APIs. It creates 50 pthreads,
creates a debugger on all of them, launches a debug session of the
inferior testprog, hits a couple breakpoints, walks the stack,
continues, etc., and then kills the inferior and ends the debug
session.
A pass is if all fifty debug sessions complete successfully
in the alloted time (~60 seconds).
We may need to tweak this one to work correctly on different
platforms/targets but I wanted to get it checked in to start.
llvm-svn: 212671
2014-07-10 10:17:31 +08:00
|
|
|
|
|
|
|
self.driver_exe = os.path.join(os.getcwd(), "multi-process-driver")
|
|
|
|
self.buildDriver('multi-process-driver.cpp', self.driver_exe)
|
|
|
|
self.addTearDownHook(lambda: os.remove(self.driver_exe))
|
2015-01-23 04:03:21 +08:00
|
|
|
self.signBinary(self.driver_exe)
|
Add a new test in api/multiple-debuggers which tries to create 50
debug sessions simultaneously to expose race conditoin/locking
issues.
This directory has an inferior program, testprog.cpp that has a
couple of functions we can put breakpoints on.
It has a driver program, multi-process-driver.cpp, which links
against the LLDB solib and uses the SB APIs. It creates 50 pthreads,
creates a debugger on all of them, launches a debug session of the
inferior testprog, hits a couple breakpoints, walks the stack,
continues, etc., and then kills the inferior and ends the debug
session.
A pass is if all fifty debug sessions complete successfully
in the alloted time (~60 seconds).
We may need to tweak this one to work correctly on different
platforms/targets but I wanted to get it checked in to start.
llvm-svn: 212671
2014-07-10 10:17:31 +08:00
|
|
|
|
|
|
|
self.inferior_exe = os.path.join(os.getcwd(), "testprog")
|
|
|
|
self.buildDriver('testprog.cpp', self.inferior_exe)
|
|
|
|
self.addTearDownHook(lambda: os.remove(self.inferior_exe))
|
|
|
|
|
|
|
|
# check_call will raise a CalledProcessError if multi-process-driver doesn't return
|
|
|
|
# exit code 0 to indicate success. We can let this exception go - the test harness
|
|
|
|
# will recognize it as a test failure.
|
|
|
|
|
|
|
|
if self.TraceOn():
|
|
|
|
print "Running test %s" % self.driver_exe
|
|
|
|
check_call([self.driver_exe, self.inferior_exe], env=env)
|
|
|
|
else:
|
|
|
|
with open(os.devnull, 'w') as fnull:
|
|
|
|
check_call([self.driver_exe, self.inferior_exe], env=env, stdout=fnull, stderr=fnull)
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import atexit
|
|
|
|
lldb.SBDebugger.Initialize()
|
|
|
|
atexit.register(lambda: lldb.SBDebugger.Terminate())
|
|
|
|
unittest2.main()
|