summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-10-28 17:43:26 +0000
committerZachary Turner <zturner@google.com>2015-10-28 17:43:26 +0000
commitc432c8f856e0bd84de980a9d9bb2d31b06fa95b1 (patch)
tree4efa528e074a6e2df782345e4cd97f5d85d038c4 /lldb/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
parenta8a3bd210086b50242903ed95048fe5e53897878 (diff)
downloadbcm5719-llvm-c432c8f856e0bd84de980a9d9bb2d31b06fa95b1.tar.gz
bcm5719-llvm-c432c8f856e0bd84de980a9d9bb2d31b06fa95b1.zip
Move lldb/test to lldb/packages/Python/lldbsuite/test.
This is the conclusion of an effort to get LLDB's Python code structured into a bona-fide Python package. This has a number of benefits, but most notably the ability to more easily share Python code between different but related pieces of LLDB's Python infrastructure (for example, `scripts` can now share code with `test`). llvm-svn: 251532
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py80
1 files changed, 80 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
new file mode 100644
index 00000000000..df40a81b4ec
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
@@ -0,0 +1,80 @@
+"""
+Test that the lldb-mi driver understands MI command syntax.
+"""
+
+from __future__ import print_function
+
+import use_lldb_suite
+
+import lldbmi_testcase
+from lldbtest import *
+
+class MiSyntaxTestCase(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_tokens(self):
+ """Test that 'lldb-mi --interpreter' prints command tokens."""
+
+ self.spawnLldbMi(args = None)
+
+ # Load executable
+ self.runCmd("000-file-exec-and-symbols %s" % self.myexe)
+ self.expect("000\^done")
+
+ # Run to main
+ self.runCmd("100000001-break-insert -f main")
+ self.expect("100000001\^done,bkpt={number=\"1\"")
+ self.runCmd("2-exec-run")
+ self.expect("2\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+ # Exit
+ self.runCmd("0000000000000000000003-exec-continue")
+ self.expect("0000000000000000000003\^running")
+ self.expect("\*stopped,reason=\"exited-normally\"")
+
+ @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_specialchars(self):
+ """Test that 'lldb-mi --interpreter' handles complicated strings."""
+
+ # Create an alias for myexe
+ complicated_myexe = "C--mpl-x file's`s @#$%^&*()_+-={}[]| name"
+ os.symlink(self.myexe, complicated_myexe)
+ self.addTearDownHook(lambda: os.unlink(complicated_myexe))
+
+ self.spawnLldbMi(args = "\"%s\"" % complicated_myexe)
+
+ # Test that the executable was loaded
+ self.expect("-file-exec-and-symbols \"%s\"" % complicated_myexe, exactly = True)
+ self.expect("\^done")
+
+ # Check that it was loaded correctly
+ self.runCmd("-break-insert -f main")
+ self.expect("\^done,bkpt={number=\"1\"")
+ self.runCmd("-exec-run")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+ @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @expectedFailureLinux # Failing in ~6/600 dosep runs (build 3120-3122)
+ def test_lldbmi_process_output(self):
+ """Test that 'lldb-mi --interpreter' wraps process output correctly."""
+
+ self.spawnLldbMi(args = None)
+
+ # Load executable
+ self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+ self.expect("\^done")
+
+ # Run
+ self.runCmd("-exec-run")
+ self.expect("\^running")
+
+ # Test that a process output is wrapped correctly
+ self.expect("\@\"'\\\\r\\\\n\"")
+ self.expect("\@\"` - it's \\\\\\\\n\\\\x12\\\\\"\\\\\\\\\\\\\"")
OpenPOWER on IntegriCloud