[llvm-symbolizer][test] Extract tests from llvm-symbolizer.test and simplify (#3)
authorJames Henderson <jh7370@my.bristol.ac.uk>
Thu, 31 Jan 2019 14:22:50 +0000 (14:22 +0000)
committerJames Henderson <jh7370@my.bristol.ac.uk>
Thu, 31 Jan 2019 14:22:50 +0000 (14:22 +0000)
This is the fourth (and final for now) of a series of patches
simplifying llvm-symbolizer tests. See r352752, r352753 and 352754 for
the previous ones. This patch splits out several more distinct test
cases from llvm-symbolizer.test into separate tests, and simplifies them
in various ways including:

1) Building a test case for spaces in path from source, rather than
   using a pre-canned binary. This allows deleting of said binary and the
   source it was built from.
2) Switching to specifying addresses and objects directly on the
   command-line rather than via stdin.

This also adds an explict test for the ability to specify a file and
address as a line in stdin, since the majority of the tests have been
migrated away from this approach, leaving this largely untested.

Reviewed by: dblaikie

Differential Revision: https://reviews.llvm.org/D57446

llvm-svn: 352756

llvm/test/DebugInfo/Inputs/dwarfdump-test3-decl.h
llvm/test/DebugInfo/Inputs/dwarfdump-test3-decl2.h
llvm/test/DebugInfo/Inputs/dwarfdump-test3.cc
llvm/test/DebugInfo/llvm-symbolizer.test
llvm/test/DebugInfo/symbolize-gnu-debuglink.test [new file with mode: 0644]
llvm/test/DebugInfo/symbolize-inlined.test [new file with mode: 0644]
llvm/test/DebugInfo/symbolize-missing-file.test [new file with mode: 0644]
llvm/test/tools/llvm-symbolizer/space-in-path.s [new file with mode: 0644]

index 4a79e95..e69de29 100644 (file)
@@ -1,7 +0,0 @@
-#include "dwarfdump-test3-decl2.h"
-
-class C {
-  explicit C(bool a = false, bool b = false);
-};
-
-void do1() {}
index 7b4d7ea..e69de29 100644 (file)
@@ -1,12 +0,0 @@
-#include "dwarfdump-test3-decl.h"
-
-C::C(bool a, bool b) {}
-
-// Built with gcc 4.6.3
-// $ mkdir -p /tmp/dbginfo/include
-// $ mkdir -p /tmp/include
-// $ cp dwarfdump-test3.cc /tmp/dbginfo
-// $ cp dwarfdump-test3-decl.h /tmp/include
-// $ cp dwarfdump-test3-decl2.h /tmp/dbginfo/include
-// $ cd /tmp/dbginfo
-// $ gcc dwarfdump-test3.cc -g -I/tmp/include -Iinclude -fPIC -shared -o <output>
index cbd1585..7b0bd14 100644 (file)
@@ -1,31 +1,17 @@
-RUN: rm -rf %t
-RUN: mkdir -p %t
 RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x40113f" > %t.input
-RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64.debuglink 0x40113f" >> %t.input
 RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x401020" >> %t.input
 RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x40110e" >> %t.input
 RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x401160" >> %t.input
 RUN: echo "%p/Inputs/dwarfdump-test2.elf-x86-64 0x4004e8" >> %t.input
 RUN: echo "%p/Inputs/dwarfdump-test2.elf-x86-64 0x4004f4" >> %t.input
 RUN: echo "%p/Inputs/dwarfdump-test4.elf-x86-64 0x62c" >> %t.input
-RUN: echo "%p/Inputs/dwarfdump-inl-test.elf-x86-64 0x8dc" >> %t.input
-RUN: echo "%p/Inputs/dwarfdump-inl-test.elf-x86-64 0xa05" >> %t.input
-RUN: echo "%p/Inputs/dwarfdump-inl-test.elf-x86-64 0x987" >> %t.input
-RUN: cp "%p/Inputs/dwarfdump-test3.elf-x86-64-space" "%t/dwarfdump-test3.elf-x86-64 space"
-RUN: echo "\"%t/dwarfdump-test3.elf-x86-64 space\" 0x640" >> %t.input
-RUN: echo "\"%t/dwarfdump-test3.elf-x86-64 space\" 0x633" >> %t.input
-RUN: echo "\"%t/dwarfdump-test3.elf-x86-64 space\" 0x62d" >> %t.input
 
-RUN: cd %t
 RUN: llvm-symbolizer --functions=linkage --inlining --demangle=false \
 RUN:    < %t.input | FileCheck --check-prefix=CHECK --check-prefix=SPLIT --check-prefix=DWO %s
 
 CHECK:       main
 CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16
 
-CHECK:       main
-CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16
-
 CHECK:      _start
 
 CHECK: _Z1fii
@@ -42,38 +28,3 @@ CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test2-main.cc:4
 
 CHECK:      _Z1cv
 CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test4-part1.cc:2
-
-CHECK:      inlined_h
-CHECK-NEXT: dwarfdump-inl-test.h:2
-CHECK-NEXT: inlined_g
-CHECK-NEXT: dwarfdump-inl-test.h:7
-CHECK-NEXT: inlined_f
-CHECK-NEXT: dwarfdump-inl-test.cc:3
-CHECK-NEXT: main
-CHECK-NEXT: dwarfdump-inl-test.cc:8
-
-CHECK:      inlined_g
-CHECK-NEXT: dwarfdump-inl-test.h:7
-CHECK-NEXT: inlined_f
-CHECK-NEXT: dwarfdump-inl-test.cc:3
-CHECK-NEXT: main
-CHECK-NEXT: dwarfdump-inl-test.cc:8
-
-CHECK:      inlined_f
-CHECK-NEXT: dwarfdump-inl-test.cc:3
-CHECK-NEXT: main
-CHECK-NEXT: dwarfdump-inl-test.cc:8
-
-CHECK: C
-CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test3.cc:3
-
-CHECK: _Z3do1v
-CHECK-NEXT: /tmp/include{{[/\\]}}dwarfdump-test3-decl.h:7
-
-CHECK: _Z3do2v
-CHECK-NEXT: /tmp/dbginfo{{[/\\]}}include{{[/\\]}}dwarfdump-test3-decl2.h:1
-
-RUN: echo "unexisting-file 0x1234" > %t.input2
-RUN: llvm-symbolizer < %t.input2 2>&1 | FileCheck %s --check-prefix=MISSING-FILE
-
-MISSING-FILE: LLVMSymbolizer: error reading file: {{[Nn]}}o such file or directory
diff --git a/llvm/test/DebugInfo/symbolize-gnu-debuglink.test b/llvm/test/DebugInfo/symbolize-gnu-debuglink.test
new file mode 100644 (file)
index 0000000..93ffda8
--- /dev/null
@@ -0,0 +1,4 @@
+RUN: llvm-symbolizer --obj=%p/Inputs/dwarfdump-test.elf-x86-64.debuglink 0x40113f | FileCheck %s
+
+CHECK:       main
+CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16
diff --git a/llvm/test/DebugInfo/symbolize-inlined.test b/llvm/test/DebugInfo/symbolize-inlined.test
new file mode 100644 (file)
index 0000000..2757721
--- /dev/null
@@ -0,0 +1,22 @@
+RUN: llvm-symbolizer --inlining --obj=%p/Inputs/dwarfdump-inl-test.elf-x86-64 0x8dc 0xa05 0x987 | FileCheck %s
+
+CHECK:      inlined_h
+CHECK-NEXT: dwarfdump-inl-test.h:2
+CHECK-NEXT: inlined_g
+CHECK-NEXT: dwarfdump-inl-test.h:7
+CHECK-NEXT: inlined_f
+CHECK-NEXT: dwarfdump-inl-test.cc:3
+CHECK-NEXT: main
+CHECK-NEXT: dwarfdump-inl-test.cc:8
+
+CHECK:      inlined_g
+CHECK-NEXT: dwarfdump-inl-test.h:7
+CHECK-NEXT: inlined_f
+CHECK-NEXT: dwarfdump-inl-test.cc:3
+CHECK-NEXT: main
+CHECK-NEXT: dwarfdump-inl-test.cc:8
+
+CHECK:      inlined_f
+CHECK-NEXT: dwarfdump-inl-test.cc:3
+CHECK-NEXT: main
+CHECK-NEXT: dwarfdump-inl-test.cc:8
diff --git a/llvm/test/DebugInfo/symbolize-missing-file.test b/llvm/test/DebugInfo/symbolize-missing-file.test
new file mode 100644 (file)
index 0000000..2762af4
--- /dev/null
@@ -0,0 +1,3 @@
+RUN: llvm-symbolizer --obj=unexisting-file 0x1234 2>&1 | FileCheck %s
+
+CHECK: LLVMSymbolizer: error reading file: {{[Nn]}}o such file or directory
diff --git a/llvm/test/tools/llvm-symbolizer/space-in-path.s b/llvm/test/tools/llvm-symbolizer/space-in-path.s
new file mode 100644 (file)
index 0000000..b54f0aa
--- /dev/null
@@ -0,0 +1,15 @@
+# REQUIRES: x86-registered-target
+
+.type foo,@function
+foo:
+    nop
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o "%t space.o" -g
+
+# Test both passing via stdin and via --obj.
+# RUN: echo "\"%t space.o\" 0" > %t.input
+# RUN: llvm-symbolizer < %t.input | FileCheck %s
+# RUN: llvm-symbolizer --obj="%t space.o" 0 | FileCheck %s
+
+# CHECK: foo
+# CHECK-NEXT: space-in-path.s:5