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 02:17:31 +00:00
|
|
|
"""Test the lldb public C++ api when doing multiple debug sessions simultaneously."""
|
|
|
|
|
2015-10-23 17:04:29 +00:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2015-11-03 19:20:39 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
import os
|
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 02:17:31 +00:00
|
|
|
|
2016-02-04 23:04:17 +00:00
|
|
|
import lldb
|
|
|
|
from lldbsuite.test.decorators import *
|
|
|
|
from lldbsuite.test.lldbtest import *
|
|
|
|
from lldbsuite.test import lldbutil
|
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
|
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 02:17:31 +00:00
|
|
|
class TestMultipleSimultaneousDebuggers(TestBase):
|
|
|
|
|
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
|
|
|
|
2018-07-27 22:20:59 +00:00
|
|
|
# This test case fails non-deterministically.
|
2014-10-16 23:02:45 +00:00
|
|
|
@skipIfNoSBHeaders
|
2018-03-13 23:37:11 +00:00
|
|
|
@expectedFailureAll(bugnumber="llvm.org/pr20282")
|
2014-07-10 09:55:19 +00:00
|
|
|
def test_multiple_debuggers(self):
|
2016-09-06 20:57:50 +00: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 02:17:31 +00:00
|
|
|
|
2018-01-30 18:29:16 +00:00
|
|
|
self.driver_exe = self.getBuildArtifact("multi-process-driver")
|
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 02:17:31 +00:00
|
|
|
self.buildDriver('multi-process-driver.cpp', self.driver_exe)
|
|
|
|
self.addTearDownHook(lambda: os.remove(self.driver_exe))
|
2015-01-22 20:03:21 +00: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 02:17:31 +00:00
|
|
|
|
2018-01-30 18:29:16 +00:00
|
|
|
self.inferior_exe = self.getBuildArtifact("testprog")
|
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 02:17:31 +00:00
|
|
|
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():
|
2015-10-23 17:04:29 +00:00
|
|
|
print("Running test %s" % 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 02:17:31 +00:00
|
|
|
check_call([self.driver_exe, self.inferior_exe], env=env)
|
|
|
|
else:
|
|
|
|
with open(os.devnull, 'w') as fnull:
|
2016-09-06 20:57:50 +00:00
|
|
|
check_call([self.driver_exe, self.inferior_exe],
|
|
|
|
env=env, stdout=fnull, stderr=fnull)
|