diff options
author | dim <dim@FreeBSD.org> | 2016-01-06 20:12:03 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2016-01-06 20:12:03 +0000 |
commit | 78b9749c0a4ea980a8b934645da6ae98fcc665e8 (patch) | |
tree | dd2a1ddf0476664c2b823409c36cbccd52662ca7 /packages/Python/lldbsuite/test/tools/lldb-mi/syntax | |
parent | 60cb593f9d55fa5ca7a5372b731f2330345b4b9a (diff) | |
download | FreeBSD-src-78b9749c0a4ea980a8b934645da6ae98fcc665e8.zip FreeBSD-src-78b9749c0a4ea980a8b934645da6ae98fcc665e8.tar.gz |
Vendor import of lldb trunk r256945:
https://llvm.org/svn/llvm-project/lldb/trunk@256945
Diffstat (limited to 'packages/Python/lldbsuite/test/tools/lldb-mi/syntax')
3 files changed, 102 insertions, 0 deletions
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/Makefile b/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/Makefile new file mode 100644 index 0000000..314f1cb --- /dev/null +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py b/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py new file mode 100644 index 0000000..f8a6743 --- /dev/null +++ b/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 lldbmi_testcase +from lldbsuite.test.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\\\\\"\\\\\\\\\\\\\"") diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/main.cpp b/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/main.cpp new file mode 100644 index 0000000..d2935b0 --- /dev/null +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/main.cpp @@ -0,0 +1,17 @@ +//===-- main.cpp ------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include <cstdio> + +int +main(int argc, char const *argv[]) +{ + printf("'\n` - it's \\n\x12\"\\\""); + return 0; +} |