mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-10 16:06:05 +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
55 lines
2.0 KiB
Python
55 lines
2.0 KiB
Python
"""
|
|
Test that the lldb-mi driver prints prompt properly.
|
|
"""
|
|
|
|
from __future__ import print_function
|
|
|
|
import use_lldb_suite
|
|
|
|
import lldbmi_testcase
|
|
from lldbsuite.test.lldbtest import *
|
|
|
|
class MiPromptTestCase(lldbmi_testcase.MiTestCaseBase):
|
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
|
|
|
@skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
|
|
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
|
|
def test_lldbmi_prompt(self):
|
|
"""Test that 'lldb-mi --interpreter' echos '(gdb)' after commands and events."""
|
|
|
|
self.spawnLldbMi(args = None)
|
|
|
|
# Test that lldb-mi is ready after unknown command
|
|
self.runCmd("-unknown-command")
|
|
self.expect("\^error,msg=\"Driver\. Received command '-unknown-command'\. It was not handled\. Command 'unknown-command' not in Command Factory\"")
|
|
self.expect(self.child_prompt, exactly = True)
|
|
|
|
# Test that lldb-mi is ready after -file-exec-and-symbols
|
|
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
|
|
self.expect("\^done")
|
|
self.expect(self.child_prompt, exactly = True)
|
|
|
|
# Test that lldb-mi is ready after -break-insert
|
|
self.runCmd("-break-insert -f main")
|
|
self.expect("\^done,bkpt={number=\"1\"")
|
|
self.expect(self.child_prompt, exactly = True)
|
|
|
|
# Test that lldb-mi is ready after -exec-run
|
|
self.runCmd("-exec-run")
|
|
self.expect("\*running")
|
|
self.expect(self.child_prompt, exactly = True)
|
|
|
|
# Test that lldb-mi is ready after BP hit
|
|
self.expect("\*stopped,reason=\"breakpoint-hit\"")
|
|
self.expect(self.child_prompt, exactly = True)
|
|
|
|
# Test that lldb-mi is ready after -exec-continue
|
|
self.runCmd("-exec-continue")
|
|
self.expect("\^running")
|
|
self.expect(self.child_prompt, exactly = True)
|
|
|
|
# Test that lldb-mi is ready after program exited
|
|
self.expect("\*stopped,reason=\"exited-normally\"")
|
|
self.expect(self.child_prompt, exactly = True)
|