2015-08-14 06:05:54 +08:00
|
|
|
"""
|
2014-11-27 17:19:46 +08:00
|
|
|
Test that the lldb-mi driver understands MI command syntax.
|
|
|
|
"""
|
|
|
|
|
2015-10-24 01:04:29 +08:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2015-10-28 04:12:05 +08:00
|
|
|
import use_lldb_suite
|
2015-10-23 04:06:20 +08:00
|
|
|
|
2015-01-28 02:03:50 +08:00
|
|
|
import lldbmi_testcase
|
2015-11-03 10:06:18 +08:00
|
|
|
from lldbsuite.test.lldbtest import *
|
2014-11-27 17:19:46 +08:00
|
|
|
|
2015-01-28 02:03:50 +08:00
|
|
|
class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase):
|
2014-11-27 17:19:46 +08:00
|
|
|
|
2015-02-21 00:34:33 +08:00
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
|
|
|
|
2015-08-14 04:50:17 +08:00
|
|
|
@skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
|
2015-02-19 04:31:30 +08:00
|
|
|
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
|
2014-11-27 17:19:46 +08:00
|
|
|
def test_lldbmi_tokens(self):
|
2015-02-21 00:34:33 +08:00
|
|
|
"""Test that 'lldb-mi --interpreter' prints command tokens."""
|
2014-11-27 17:19:46 +08:00
|
|
|
|
2015-01-28 02:03:50 +08:00
|
|
|
self.spawnLldbMi(args = None)
|
2014-11-27 17:19:46 +08:00
|
|
|
|
2015-01-28 02:03:50 +08:00
|
|
|
# Load executable
|
|
|
|
self.runCmd("000-file-exec-and-symbols %s" % self.myexe)
|
|
|
|
self.expect("000\^done")
|
2014-11-27 17:19:46 +08:00
|
|
|
|
2015-01-28 02:03:50 +08:00
|
|
|
# Run to main
|
2015-02-21 00:34:33 +08:00
|
|
|
self.runCmd("100000001-break-insert -f main")
|
2015-01-28 02:03:50 +08:00
|
|
|
self.expect("100000001\^done,bkpt={number=\"1\"")
|
|
|
|
self.runCmd("2-exec-run")
|
|
|
|
self.expect("2\^running")
|
|
|
|
self.expect("\*stopped,reason=\"breakpoint-hit\"")
|
2014-11-27 17:19:46 +08:00
|
|
|
|
2015-01-28 02:03:50 +08:00
|
|
|
# Exit
|
|
|
|
self.runCmd("0000000000000000000003-exec-continue")
|
|
|
|
self.expect("0000000000000000000003\^running")
|
|
|
|
self.expect("\*stopped,reason=\"exited-normally\"")
|
2014-11-27 17:19:46 +08:00
|
|
|
|
2015-08-14 04:50:17 +08:00
|
|
|
@skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
|
2015-03-14 10:54:57 +08:00
|
|
|
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
|
2015-02-05 18:35:17 +08:00
|
|
|
def test_lldbmi_specialchars(self):
|
|
|
|
"""Test that 'lldb-mi --interpreter' handles complicated strings."""
|
|
|
|
|
2015-04-14 22:12:22 +08:00
|
|
|
# Create an alias for myexe
|
2015-02-05 18:35:17 +08:00
|
|
|
complicated_myexe = "C--mpl-x file's`s @#$%^&*()_+-={}[]| name"
|
|
|
|
os.symlink(self.myexe, complicated_myexe)
|
2015-04-14 21:48:49 +08:00
|
|
|
self.addTearDownHook(lambda: os.unlink(complicated_myexe))
|
2015-02-05 18:35:17 +08:00
|
|
|
|
2015-04-14 22:12:22 +08:00
|
|
|
self.spawnLldbMi(args = "\"%s\"" % complicated_myexe)
|
|
|
|
|
|
|
|
# Test that the executable was loaded
|
|
|
|
self.expect("-file-exec-and-symbols \"%s\"" % complicated_myexe, exactly = True)
|
2015-04-14 21:48:49 +08:00
|
|
|
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\"")
|
2015-02-05 18:35:17 +08:00
|
|
|
|
2015-08-14 04:50:17 +08:00
|
|
|
@skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
|
2015-02-27 02:14:30 +08:00
|
|
|
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
|
2015-06-23 04:54:14 +08:00
|
|
|
@expectedFailureLinux # Failing in ~6/600 dosep runs (build 3120-3122)
|
2015-02-27 02:14:30 +08:00
|
|
|
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
|
2015-05-08 18:52:50 +08:00
|
|
|
self.expect("\@\"'\\\\r\\\\n\"")
|
|
|
|
self.expect("\@\"` - it's \\\\\\\\n\\\\x12\\\\\"\\\\\\\\\\\\\"")
|