2 Test that the lldb-mi driver prints prompt properly.
5 from __future__ import print_function
10 from lldbsuite.test.decorators import *
11 from lldbsuite.test.lldbtest import *
12 from lldbsuite.test import lldbutil
14 class MiPromptTestCase(lldbmi_testcase.MiTestCaseBase):
16 mydir = TestBase.compute_mydir(__file__)
18 @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
19 @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
20 def test_lldbmi_prompt(self):
21 """Test that 'lldb-mi --interpreter' echos '(gdb)' after commands and events."""
23 self.spawnLldbMi(args = None)
25 # Test that lldb-mi is ready after unknown command
26 self.runCmd("-unknown-command")
27 self.expect("\^error,msg=\"Driver\. Received command '-unknown-command'\. It was not handled\. Command 'unknown-command' not in Command Factory\"")
28 self.expect(self.child_prompt, exactly = True)
30 # Test that lldb-mi is ready after -file-exec-and-symbols
31 self.runCmd("-file-exec-and-symbols %s" % self.myexe)
33 self.expect(self.child_prompt, exactly = True)
35 # Test that lldb-mi is ready after -break-insert
36 self.runCmd("-break-insert -f main")
37 self.expect("\^done,bkpt={number=\"1\"")
38 self.expect(self.child_prompt, exactly = True)
40 # Test that lldb-mi is ready after -exec-run
41 self.runCmd("-exec-run")
42 self.expect("\*running")
43 self.expect(self.child_prompt, exactly = True)
45 # Test that lldb-mi is ready after BP hit
46 self.expect("\*stopped,reason=\"breakpoint-hit\"")
47 self.expect(self.child_prompt, exactly = True)
49 # Test that lldb-mi is ready after -exec-continue
50 self.runCmd("-exec-continue")
51 self.expect("\^running")
52 self.expect(self.child_prompt, exactly = True)
54 # Test that lldb-mi is ready after program exited
55 self.expect("\*stopped,reason=\"exited-normally\"")
56 self.expect(self.child_prompt, exactly = True)