mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-10 18:26:06 +00: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
54 lines
1.8 KiB
Python
54 lines
1.8 KiB
Python
from __future__ import print_function
|
|
|
|
import use_lldb_suite
|
|
|
|
import gdbremote_testcase
|
|
import lldbgdbserverutils
|
|
|
|
from lldbsuite.test.lldbtest import *
|
|
|
|
class TestGdbRemoteKill(gdbremote_testcase.GdbRemoteTestCaseBase):
|
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
|
|
|
def attach_commandline_kill_after_initial_stop(self):
|
|
procs = self.prep_debug_monitor_and_inferior()
|
|
self.test_sequence.add_log_lines([
|
|
"read packet: $k#6b",
|
|
{"direction":"send", "regex":r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}" },
|
|
], True)
|
|
|
|
if self.stub_sends_two_stop_notifications_on_kill:
|
|
# Add an expectation for a second X result for stubs that send two of these.
|
|
self.test_sequence.add_log_lines([
|
|
{"direction":"send", "regex":r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}" },
|
|
], True)
|
|
|
|
self.expect_gdbremote_sequence()
|
|
|
|
# Wait a moment for completed and now-detached inferior process to clear.
|
|
time.sleep(1)
|
|
|
|
if not lldb.remote_platform:
|
|
# Process should be dead now. Reap results.
|
|
poll_result = procs["inferior"].poll()
|
|
self.assertIsNotNone(poll_result)
|
|
|
|
# Where possible, verify at the system level that the process is not running.
|
|
self.assertFalse(lldbgdbserverutils.process_is_running(procs["inferior"].pid, False))
|
|
|
|
@debugserver_test
|
|
def test_attach_commandline_kill_after_initial_stop_debugserver(self):
|
|
self.init_debugserver_test()
|
|
self.build()
|
|
self.set_inferior_startup_attach()
|
|
self.attach_commandline_kill_after_initial_stop()
|
|
|
|
@llgs_test
|
|
def test_attach_commandline_kill_after_initial_stop_llgs(self):
|
|
self.init_llgs_test()
|
|
self.build()
|
|
self.set_inferior_startup_attach()
|
|
self.attach_commandline_kill_after_initial_stop()
|
|
|