2 Test that the lldb-mi driver understands MI command syntax.
5 from __future__ import print_function
10 from lldbsuite.test.lldbtest import *
12 class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase):
14 mydir = TestBase.compute_mydir(__file__)
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."""
21 self.spawnLldbMi(args = None)
24 self.runCmd("000-file-exec-and-symbols %s" % self.myexe)
25 self.expect("000\^done")
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\"")
35 self.runCmd("0000000000000000000003-exec-continue")
36 self.expect("0000000000000000000003\^running")
37 self.expect("\*stopped,reason=\"exited-normally\"")
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."""
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))
49 self.spawnLldbMi(args = "\"%s\"" % complicated_myexe)
51 # Test that the executable was loaded
52 self.expect("-file-exec-and-symbols \"%s\"" % complicated_myexe, exactly = True)
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\"")
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."""
68 self.spawnLldbMi(args = None)
71 self.runCmd("-file-exec-and-symbols %s" % self.myexe)
75 self.runCmd("-exec-run")
76 self.expect("\^running")
78 # Test that a process output is wrapped correctly
79 self.expect("\@\"'\\\\r\\\\n\"")
80 self.expect("\@\"` - it's \\\\\\\\n\\\\x12\\\\\"\\\\\\\\\\\\\"")