]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / tools / lldb-mi / syntax / TestMiSyntax.py
1 """
2 Test that the lldb-mi driver understands MI command syntax.
3 """
4
5 from __future__ import print_function
6
7
8
9 import lldbmi_testcase
10 from lldbsuite.test.lldbtest import *
11
12 class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase):
13
14     mydir = TestBase.compute_mydir(__file__)
15
16     @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
17     @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
18     def test_lldbmi_tokens(self):
19         """Test that 'lldb-mi --interpreter' prints command tokens."""
20
21         self.spawnLldbMi(args = None)
22
23         # Load executable
24         self.runCmd("000-file-exec-and-symbols %s" % self.myexe)
25         self.expect("000\^done")
26
27         # Run to main
28         self.runCmd("100000001-break-insert -f main")
29         self.expect("100000001\^done,bkpt={number=\"1\"")
30         self.runCmd("2-exec-run")
31         self.expect("2\^running")
32         self.expect("\*stopped,reason=\"breakpoint-hit\"")
33
34         # Exit
35         self.runCmd("0000000000000000000003-exec-continue")
36         self.expect("0000000000000000000003\^running")
37         self.expect("\*stopped,reason=\"exited-normally\"")
38
39     @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
40     @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
41     def test_lldbmi_specialchars(self):
42         """Test that 'lldb-mi --interpreter' handles complicated strings."""
43
44         # Create an alias for myexe
45         complicated_myexe = "C--mpl-x file's`s @#$%^&*()_+-={}[]| name"
46         os.symlink(self.myexe, complicated_myexe)
47         self.addTearDownHook(lambda: os.unlink(complicated_myexe))
48
49         self.spawnLldbMi(args = "\"%s\"" % complicated_myexe)
50
51         # Test that the executable was loaded
52         self.expect("-file-exec-and-symbols \"%s\"" % complicated_myexe, exactly = True)
53         self.expect("\^done")
54
55         # Check that it was loaded correctly
56         self.runCmd("-break-insert -f main")
57         self.expect("\^done,bkpt={number=\"1\"")
58         self.runCmd("-exec-run")
59         self.expect("\^running")
60         self.expect("\*stopped,reason=\"breakpoint-hit\"")
61
62     @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
63     @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
64     @expectedFailureLinux  # Failing in ~6/600 dosep runs (build 3120-3122)
65     def test_lldbmi_process_output(self):
66         """Test that 'lldb-mi --interpreter' wraps process output correctly."""
67
68         self.spawnLldbMi(args = None)
69
70         # Load executable
71         self.runCmd("-file-exec-and-symbols %s" % self.myexe)
72         self.expect("\^done")
73
74         # Run
75         self.runCmd("-exec-run")
76         self.expect("\^running")
77
78         # Test that a process output is wrapped correctly
79         self.expect("\@\"'\\\\r\\\\n\"")
80         self.expect("\@\"` - it's \\\\\\\\n\\\\x12\\\\\"\\\\\\\\\\\\\"")