summaryrefslogtreecommitdiffstats
path: root/lldb/test/Shell/Driver
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-10-09 19:22:02 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-10-09 19:22:02 +0000
commit87aa9c9e4d41ed881453e2fab85b3d25f648bb55 (patch)
tree63efe79832bf3de4f63e4e81c62e73923947b882 /lldb/test/Shell/Driver
parentfd18e94697c987d5f24e25aa4e27adaffff3cce4 (diff)
downloadbcm5719-llvm-87aa9c9e4d41ed881453e2fab85b3d25f648bb55.tar.gz
bcm5719-llvm-87aa9c9e4d41ed881453e2fab85b3d25f648bb55.zip
Re-land "[test] Split LLDB tests into API, Shell & Unit"
The original patch got reverted because it broke `check-lldb` on a clean build. This fixes that. llvm-svn: 374201
Diffstat (limited to 'lldb/test/Shell/Driver')
-rw-r--r--lldb/test/Shell/Driver/Inputs/.lldbinit2
-rw-r--r--lldb/test/Shell/Driver/Inputs/Print0.in1
-rw-r--r--lldb/test/Shell/Driver/Inputs/Print2.in1
-rw-r--r--lldb/test/Shell/Driver/Inputs/Print4.in1
-rw-r--r--lldb/test/Shell/Driver/Inputs/Print6.in1
-rw-r--r--lldb/test/Shell/Driver/Inputs/convenience.in9
-rw-r--r--lldb/test/Shell/Driver/Inputs/hello.c3
-rw-r--r--lldb/test/Shell/Driver/Inputs/hello.cpp11
-rw-r--r--lldb/test/Shell/Driver/Inputs/process_attach_pid.in2
-rw-r--r--lldb/test/Shell/Driver/Inputs/syntax_error.py1
-rw-r--r--lldb/test/Shell/Driver/LocalLLDBInit.test15
-rw-r--r--lldb/test/Shell/Driver/TestCommands.test41
-rw-r--r--lldb/test/Shell/Driver/TestConvenienceVariables.test23
-rw-r--r--lldb/test/Shell/Driver/TestCore.test2
-rw-r--r--lldb/test/Shell/Driver/TestFile.test2
-rw-r--r--lldb/test/Shell/Driver/TestNoUseColor.test4
-rw-r--r--lldb/test/Shell/Driver/TestProcessAttach.test2
-rw-r--r--lldb/test/Shell/Driver/TestRepl.test7
-rw-r--r--lldb/test/Shell/Driver/TestSingleQuote.test6
-rw-r--r--lldb/test/Shell/Driver/TestTarget.test7
20 files changed, 141 insertions, 0 deletions
diff --git a/lldb/test/Shell/Driver/Inputs/.lldbinit b/lldb/test/Shell/Driver/Inputs/.lldbinit
new file mode 100644
index 00000000000..7628917d324
--- /dev/null
+++ b/lldb/test/Shell/Driver/Inputs/.lldbinit
@@ -0,0 +1,2 @@
+settings set -f frame-format "bogus"
+command script import syntax_error.py
diff --git a/lldb/test/Shell/Driver/Inputs/Print0.in b/lldb/test/Shell/Driver/Inputs/Print0.in
new file mode 100644
index 00000000000..cb545cc15ab
--- /dev/null
+++ b/lldb/test/Shell/Driver/Inputs/Print0.in
@@ -0,0 +1 @@
+expr 0
diff --git a/lldb/test/Shell/Driver/Inputs/Print2.in b/lldb/test/Shell/Driver/Inputs/Print2.in
new file mode 100644
index 00000000000..f51389a02a0
--- /dev/null
+++ b/lldb/test/Shell/Driver/Inputs/Print2.in
@@ -0,0 +1 @@
+expr 2
diff --git a/lldb/test/Shell/Driver/Inputs/Print4.in b/lldb/test/Shell/Driver/Inputs/Print4.in
new file mode 100644
index 00000000000..a2d49f30b99
--- /dev/null
+++ b/lldb/test/Shell/Driver/Inputs/Print4.in
@@ -0,0 +1 @@
+expr 4
diff --git a/lldb/test/Shell/Driver/Inputs/Print6.in b/lldb/test/Shell/Driver/Inputs/Print6.in
new file mode 100644
index 00000000000..dee6212b87c
--- /dev/null
+++ b/lldb/test/Shell/Driver/Inputs/Print6.in
@@ -0,0 +1 @@
+expr 6
diff --git a/lldb/test/Shell/Driver/Inputs/convenience.in b/lldb/test/Shell/Driver/Inputs/convenience.in
new file mode 100644
index 00000000000..6d5603c4351
--- /dev/null
+++ b/lldb/test/Shell/Driver/Inputs/convenience.in
@@ -0,0 +1,9 @@
+breakpoint set -f hello.cpp -p Hello
+run
+script print(lldb.debugger)
+script print(lldb.target)
+script print(lldb.process)
+script print(lldb.thread.GetStopDescription(100))
+script lldb.frame.GetLineEntry().GetLine()
+script lldb.frame.GetLineEntry().GetFileSpec().GetFilename()
+script lldb.frame.GetFunctionName()
diff --git a/lldb/test/Shell/Driver/Inputs/hello.c b/lldb/test/Shell/Driver/Inputs/hello.c
new file mode 100644
index 00000000000..03b2213bb9a
--- /dev/null
+++ b/lldb/test/Shell/Driver/Inputs/hello.c
@@ -0,0 +1,3 @@
+int main(void) {
+ return 0;
+}
diff --git a/lldb/test/Shell/Driver/Inputs/hello.cpp b/lldb/test/Shell/Driver/Inputs/hello.cpp
new file mode 100644
index 00000000000..1ec0677aeb2
--- /dev/null
+++ b/lldb/test/Shell/Driver/Inputs/hello.cpp
@@ -0,0 +1,11 @@
+// The build.py script always runs the compiler in C++ mode, regardless of the
+// file extension. This results in mangled names presented to the linker which
+// in turn cannot find the printf symbol.
+extern "C" {
+int printf(const char *format, ...);
+
+int main(int argc, char **argv) {
+ printf("Hello World\n");
+ return 0;
+}
+}
diff --git a/lldb/test/Shell/Driver/Inputs/process_attach_pid.in b/lldb/test/Shell/Driver/Inputs/process_attach_pid.in
new file mode 100644
index 00000000000..3d17ceee99e
--- /dev/null
+++ b/lldb/test/Shell/Driver/Inputs/process_attach_pid.in
@@ -0,0 +1,2 @@
+process attach --pid
+
diff --git a/lldb/test/Shell/Driver/Inputs/syntax_error.py b/lldb/test/Shell/Driver/Inputs/syntax_error.py
new file mode 100644
index 00000000000..587b8043dec
--- /dev/null
+++ b/lldb/test/Shell/Driver/Inputs/syntax_error.py
@@ -0,0 +1 @@
+prlnt("foo")
diff --git a/lldb/test/Shell/Driver/LocalLLDBInit.test b/lldb/test/Shell/Driver/LocalLLDBInit.test
new file mode 100644
index 00000000000..69b7781415a
--- /dev/null
+++ b/lldb/test/Shell/Driver/LocalLLDBInit.test
@@ -0,0 +1,15 @@
+# REQUIRES: python
+# RUN: mkdir -p %t.root
+# RUN: mkdir -p %t.home
+# RUN: cp %S/Inputs/.lldbinit %t.root
+# RUN: cp %S/Inputs/syntax_error.py %t.root
+# RUN: cd %t.root
+# RUN: env HOME=%t.home %lldb-init -o 'settings show frame-format' 2>&1 | FileCheck %s --check-prefix=WARNINIT --check-prefix=CHECK
+# RUN: env HOME=%t.home %lldb-init -local-lldbinit -o 'settings show frame-format' 2>&1 | FileCheck %s --check-prefix=ALLOWINIT --check-prefix=NOINIT
+# RUN: %lldb -o 'settings show frame-format' 2>&1 | FileCheck %s --check-prefix=NOINIT --check-prefix=CHECK
+
+# WARNINIT: There is a .lldbinit file in the current directory which is not being read.
+# NOINIT-NOT: There is a .lldbinit file in the current directory which is not being read.
+# CHECK-NOT: bogus
+# ALLOWINIT: name 'prlnt' is not defined
+# ALLOWINIT: bogus
diff --git a/lldb/test/Shell/Driver/TestCommands.test b/lldb/test/Shell/Driver/TestCommands.test
new file mode 100644
index 00000000000..3589abb8278
--- /dev/null
+++ b/lldb/test/Shell/Driver/TestCommands.test
@@ -0,0 +1,41 @@
+# RUN: %lldb -x -b \
+# RUN: -S %S/Inputs/Print0.in \
+# RUN: -O 'expr 1' \
+# RUN: -S %S/Inputs/Print2.in \
+# RUN: -O 'expr 3' \
+# RUN: -s %S/Inputs/Print4.in \
+# RUN: -o 'expr 5' \
+# RUN: -s %S/Inputs/Print6.in \
+# RUN: -o 'expr 7' \
+# RUN: | FileCheck %s
+#
+# RUN: %lldb -x -b \
+# RUN: -s %S/Inputs/Print4.in \
+# RUN: -o 'expr 5' \
+# RUN: -s %S/Inputs/Print6.in \
+# RUN: -o 'expr 7' \
+# RUN: -S %S/Inputs/Print0.in \
+# RUN: -O 'expr 1' \
+# RUN: -S %S/Inputs/Print2.in \
+# RUN: -O 'expr 3' \
+# RUN: | FileCheck %s
+#
+# RUN: %lldb -x -b \
+# RUN: -s %S/Inputs/Print4.in \
+# RUN: -S %S/Inputs/Print0.in \
+# RUN: -o 'expr 5' \
+# RUN: -O 'expr 1' \
+# RUN: -s %S/Inputs/Print6.in \
+# RUN: -S %S/Inputs/Print2.in \
+# RUN: -o 'expr 7' \
+# RUN: -O 'expr 3' \
+# RUN: | FileCheck %s
+
+# CHECK: (int) $0 = 0
+# CHECK: (int) $1 = 1
+# CHECK: (int) $2 = 2
+# CHECK: (int) $3 = 3
+# CHECK: (int) $4 = 4
+# CHECK: (int) $5 = 5
+# CHECK: (int) $6 = 6
+# CHECK: (int) $7 = 7
diff --git a/lldb/test/Shell/Driver/TestConvenienceVariables.test b/lldb/test/Shell/Driver/TestConvenienceVariables.test
new file mode 100644
index 00000000000..a7b6faa34cb
--- /dev/null
+++ b/lldb/test/Shell/Driver/TestConvenienceVariables.test
@@ -0,0 +1,23 @@
+REQUIRES: python
+RUN: %build %p/Inputs/hello.cpp -o %t
+RUN: %lldb %t -s %p/Inputs/convenience.in -o quit | FileCheck %s
+
+script print(lldb.debugger)
+
+CHECK: stop reason = breakpoint 1.1
+CHECK: Debugger (instance: {{.*}}, id: {{[0-9]+}})
+CHECK: script print(lldb.target)
+CHECK: TestConvenienceVariables.test
+CHECK: script print(lldb.process)
+CHECK: SBProcess: pid = {{[0-9]+}},
+CHECK-SAME: state = stopped,
+CHECK-SAME: threads = {{[0-9]+}},
+CHECK-SAME: executable = TestConvenienceVariables.test
+CHECK: script print(lldb.thread.GetStopDescription(100))
+CHECK: breakpoint 1.1
+CHECK: script lldb.frame.GetLineEntry().GetLine()
+CHECK: 8
+CHECK: script lldb.frame.GetLineEntry().GetFileSpec().GetFilename()
+CHECK: hello.c
+CHECK: script lldb.frame.GetFunctionName()
+CHECK: main
diff --git a/lldb/test/Shell/Driver/TestCore.test b/lldb/test/Shell/Driver/TestCore.test
new file mode 100644
index 00000000000..cca8171da63
--- /dev/null
+++ b/lldb/test/Shell/Driver/TestCore.test
@@ -0,0 +1,2 @@
+# RUN: not %lldb -c /bogus/path 2>&1 | FileCheck %s
+# CHECK: error: file specified in --core (-c) option doesn't exist
diff --git a/lldb/test/Shell/Driver/TestFile.test b/lldb/test/Shell/Driver/TestFile.test
new file mode 100644
index 00000000000..0e80594aeb1
--- /dev/null
+++ b/lldb/test/Shell/Driver/TestFile.test
@@ -0,0 +1,2 @@
+# RUN: not %lldb -f /bogus/path 2>&1 | FileCheck %s
+# CHECK: error: file specified in --file (-f) option doesn't exist
diff --git a/lldb/test/Shell/Driver/TestNoUseColor.test b/lldb/test/Shell/Driver/TestNoUseColor.test
new file mode 100644
index 00000000000..62735301fca
--- /dev/null
+++ b/lldb/test/Shell/Driver/TestNoUseColor.test
@@ -0,0 +1,4 @@
+# RUN: %lldb --no-use-color -s %s | FileCheck %s
+settings show use-color
+# CHECK: use-color (boolean) = false
+q
diff --git a/lldb/test/Shell/Driver/TestProcessAttach.test b/lldb/test/Shell/Driver/TestProcessAttach.test
new file mode 100644
index 00000000000..4e24ebb161b
--- /dev/null
+++ b/lldb/test/Shell/Driver/TestProcessAttach.test
@@ -0,0 +1,2 @@
+# RUN: %lldb -x -b -S %S/Inputs/process_attach_pid.in 2>&1 | FileCheck %s
+# CHECK: last option requires an argument
diff --git a/lldb/test/Shell/Driver/TestRepl.test b/lldb/test/Shell/Driver/TestRepl.test
new file mode 100644
index 00000000000..083863985a1
--- /dev/null
+++ b/lldb/test/Shell/Driver/TestRepl.test
@@ -0,0 +1,7 @@
+# RUN: echo ':quit' | %lldb -x --repl -O 'expr 42' -S %S/Inputs/Print2.in -o 'expr 999999' -s %s 2>&1 | FileCheck %s
+# CHECK: {{w}}arning: commands specified to run after file load (via -o or -s) are ignored in REPL mode
+# CHECK: (int) $0 = 42
+# CHECK: (int) $1 = 2
+# CHECK-NOT: 999999
+
+expr 999999
diff --git a/lldb/test/Shell/Driver/TestSingleQuote.test b/lldb/test/Shell/Driver/TestSingleQuote.test
new file mode 100644
index 00000000000..0ba4a1456fa
--- /dev/null
+++ b/lldb/test/Shell/Driver/TestSingleQuote.test
@@ -0,0 +1,6 @@
+# Make sure lldb can handle filenames with single quotes in them.
+# RUN: %clang %p/Inputs/hello.c -g -o "%t-'pat"
+# RUN: %lldb -s %s "%t-'pat" | FileCheck %s
+
+br set -p return
+# CHECK: Breakpoint 1: where = TestSingleQuote.test.tmp-'pat`main
diff --git a/lldb/test/Shell/Driver/TestTarget.test b/lldb/test/Shell/Driver/TestTarget.test
new file mode 100644
index 00000000000..fcf7f776bbc
--- /dev/null
+++ b/lldb/test/Shell/Driver/TestTarget.test
@@ -0,0 +1,7 @@
+# Make sure lldb resolves the target path.
+# RUN: mkdir -p %t/foo
+# RUN: cd %t/foo
+# RUN: %clang %p/Inputs/hello.c -g -o a.out
+# RUN: %lldb -b a.out | FileCheck %s
+
+# CHECK: Current executable set to '{{.*}}foo{{[/\\\\]+}}a.out'
OpenPOWER on IntegriCloud