mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-22 21:15:40 -04:00

For convenience, we had added the folder that dotest.py was in to sys.path, so that we could easily write things like `import lldbutil` from anywhere and any test. This introduces a subtle problem when using Python's package system, because when unittest2 imports a particular test suite, the test suite is detached from the package. Thus, writing "import lldbutil" from dotest imports it as part of the package, and writing the same line from a test does a fresh import since the importing module was not part of the same package. The real way to fix this is to use absolute imports everywhere. Instead of writing "import lldbutil", we need to write "import lldbsuite.test.util". This patch fixes up that and all other similar cases, and additionally removes the script directory from sys.path to ensure that this can't happen again. llvm-svn: 251886
45 lines
1.6 KiB
Python
45 lines
1.6 KiB
Python
"""Test the lldb public C++ api when doing multiple debug sessions simultaneously."""
|
|
|
|
from __future__ import print_function
|
|
|
|
import use_lldb_suite
|
|
|
|
import os, re
|
|
from lldbsuite.test.lldbtest import *
|
|
import lldbsuite.test.lldbutil as lldbutil
|
|
import lldb
|
|
import subprocess
|
|
|
|
class TestMultipleSimultaneousDebuggers(TestBase):
|
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
|
|
|
@skipIfi386
|
|
@skipIfNoSBHeaders
|
|
@expectedFailureFreeBSD("llvm.org/pr20282")
|
|
@expectedFailureLinux("llvm.org/pr20282")
|
|
@expectedFailureWindows # Test crashes
|
|
@expectedFlakeyDarwin()
|
|
def test_multiple_debuggers(self):
|
|
env = {self.dylibPath : self.getLLDBLibraryEnvVal()}
|
|
|
|
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))
|
|
self.signBinary(self.driver_exe)
|
|
|
|
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)
|