]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py
Vendor import of lldb release_39 branch r276489:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / tools / lldb-mi / TestMiPrompt.py
1 """
2 Test that the lldb-mi driver prints prompt properly.
3 """
4
5 from __future__ import print_function
6
7
8
9 import lldbmi_testcase
10 from lldbsuite.test.decorators import *
11 from lldbsuite.test.lldbtest import *
12 from lldbsuite.test import lldbutil
13
14 class MiPromptTestCase(lldbmi_testcase.MiTestCaseBase):
15
16     mydir = TestBase.compute_mydir(__file__)
17
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."""
22
23         self.spawnLldbMi(args = None)
24
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)
29
30         # Test that lldb-mi is ready after -file-exec-and-symbols
31         self.runCmd("-file-exec-and-symbols %s" % self.myexe)
32         self.expect("\^done")
33         self.expect(self.child_prompt, exactly = True)
34
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)
39
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)
44
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)
48
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)
53
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)