Skip to content

Commit 5282c87

Browse files
committed
[llvm-symbolizer][test] Extract tests from llvm-symbolizer.test and simplify (#3)
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
1 parent a22c72c commit 5282c87

8 files changed

+44
-69
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +0,0 @@
1-
#include "dwarfdump-test3-decl2.h"
2-
3-
class C {
4-
explicit C(bool a = false, bool b = false);
5-
};
6-
7-
void do1() {}
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
void do2() { }
Original file line numberDiff line numberDiff line change
@@ -1,12 +0,0 @@
1-
#include "dwarfdump-test3-decl.h"
2-
3-
C::C(bool a, bool b) {}
4-
5-
// Built with gcc 4.6.3
6-
// $ mkdir -p /tmp/dbginfo/include
7-
// $ mkdir -p /tmp/include
8-
// $ cp dwarfdump-test3.cc /tmp/dbginfo
9-
// $ cp dwarfdump-test3-decl.h /tmp/include
10-
// $ cp dwarfdump-test3-decl2.h /tmp/dbginfo/include
11-
// $ cd /tmp/dbginfo
12-
// $ gcc dwarfdump-test3.cc -g -I/tmp/include -Iinclude -fPIC -shared -o <output>
-49
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,17 @@
1-
RUN: rm -rf %t
2-
RUN: mkdir -p %t
31
RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x40113f" > %t.input
4-
RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64.debuglink 0x40113f" >> %t.input
52
RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x401020" >> %t.input
63
RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x40110e" >> %t.input
74
RUN: echo "%p/Inputs/dwarfdump-test.elf-x86-64 0x401160" >> %t.input
85
RUN: echo "%p/Inputs/dwarfdump-test2.elf-x86-64 0x4004e8" >> %t.input
96
RUN: echo "%p/Inputs/dwarfdump-test2.elf-x86-64 0x4004f4" >> %t.input
107
RUN: echo "%p/Inputs/dwarfdump-test4.elf-x86-64 0x62c" >> %t.input
11-
RUN: echo "%p/Inputs/dwarfdump-inl-test.elf-x86-64 0x8dc" >> %t.input
12-
RUN: echo "%p/Inputs/dwarfdump-inl-test.elf-x86-64 0xa05" >> %t.input
13-
RUN: echo "%p/Inputs/dwarfdump-inl-test.elf-x86-64 0x987" >> %t.input
14-
RUN: cp "%p/Inputs/dwarfdump-test3.elf-x86-64-space" "%t/dwarfdump-test3.elf-x86-64 space"
15-
RUN: echo "\"%t/dwarfdump-test3.elf-x86-64 space\" 0x640" >> %t.input
16-
RUN: echo "\"%t/dwarfdump-test3.elf-x86-64 space\" 0x633" >> %t.input
17-
RUN: echo "\"%t/dwarfdump-test3.elf-x86-64 space\" 0x62d" >> %t.input
188

19-
RUN: cd %t
209
RUN: llvm-symbolizer --functions=linkage --inlining --demangle=false \
2110
RUN: < %t.input | FileCheck --check-prefix=CHECK --check-prefix=SPLIT --check-prefix=DWO %s
2211

2312
CHECK: main
2413
CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16
2514

26-
CHECK: main
27-
CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16
28-
2915
CHECK: _start
3016

3117
CHECK: _Z1fii
@@ -42,38 +28,3 @@ CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test2-main.cc:4
4228

4329
CHECK: _Z1cv
4430
CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test4-part1.cc:2
45-
46-
CHECK: inlined_h
47-
CHECK-NEXT: dwarfdump-inl-test.h:2
48-
CHECK-NEXT: inlined_g
49-
CHECK-NEXT: dwarfdump-inl-test.h:7
50-
CHECK-NEXT: inlined_f
51-
CHECK-NEXT: dwarfdump-inl-test.cc:3
52-
CHECK-NEXT: main
53-
CHECK-NEXT: dwarfdump-inl-test.cc:8
54-
55-
CHECK: inlined_g
56-
CHECK-NEXT: dwarfdump-inl-test.h:7
57-
CHECK-NEXT: inlined_f
58-
CHECK-NEXT: dwarfdump-inl-test.cc:3
59-
CHECK-NEXT: main
60-
CHECK-NEXT: dwarfdump-inl-test.cc:8
61-
62-
CHECK: inlined_f
63-
CHECK-NEXT: dwarfdump-inl-test.cc:3
64-
CHECK-NEXT: main
65-
CHECK-NEXT: dwarfdump-inl-test.cc:8
66-
67-
CHECK: C
68-
CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test3.cc:3
69-
70-
CHECK: _Z3do1v
71-
CHECK-NEXT: /tmp/include{{[/\\]}}dwarfdump-test3-decl.h:7
72-
73-
CHECK: _Z3do2v
74-
CHECK-NEXT: /tmp/dbginfo{{[/\\]}}include{{[/\\]}}dwarfdump-test3-decl2.h:1
75-
76-
RUN: echo "unexisting-file 0x1234" > %t.input2
77-
RUN: llvm-symbolizer < %t.input2 2>&1 | FileCheck %s --check-prefix=MISSING-FILE
78-
79-
MISSING-FILE: LLVMSymbolizer: error reading file: {{[Nn]}}o such file or directory
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
RUN: llvm-symbolizer --obj=%p/Inputs/dwarfdump-test.elf-x86-64.debuglink 0x40113f | FileCheck %s
2+
3+
CHECK: main
4+
CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
RUN: llvm-symbolizer --inlining --obj=%p/Inputs/dwarfdump-inl-test.elf-x86-64 0x8dc 0xa05 0x987 | FileCheck %s
2+
3+
CHECK: inlined_h
4+
CHECK-NEXT: dwarfdump-inl-test.h:2
5+
CHECK-NEXT: inlined_g
6+
CHECK-NEXT: dwarfdump-inl-test.h:7
7+
CHECK-NEXT: inlined_f
8+
CHECK-NEXT: dwarfdump-inl-test.cc:3
9+
CHECK-NEXT: main
10+
CHECK-NEXT: dwarfdump-inl-test.cc:8
11+
12+
CHECK: inlined_g
13+
CHECK-NEXT: dwarfdump-inl-test.h:7
14+
CHECK-NEXT: inlined_f
15+
CHECK-NEXT: dwarfdump-inl-test.cc:3
16+
CHECK-NEXT: main
17+
CHECK-NEXT: dwarfdump-inl-test.cc:8
18+
19+
CHECK: inlined_f
20+
CHECK-NEXT: dwarfdump-inl-test.cc:3
21+
CHECK-NEXT: main
22+
CHECK-NEXT: dwarfdump-inl-test.cc:8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
RUN: llvm-symbolizer --obj=unexisting-file 0x1234 2>&1 | FileCheck %s
2+
3+
CHECK: LLVMSymbolizer: error reading file: {{[Nn]}}o such file or directory
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# REQUIRES: x86-registered-target
2+
3+
.type foo,@function
4+
foo:
5+
nop
6+
7+
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o "%t space.o" -g
8+
9+
# Test both passing via stdin and via --obj.
10+
# RUN: echo "\"%t space.o\" 0" > %t.input
11+
# RUN: llvm-symbolizer < %t.input | FileCheck %s
12+
# RUN: llvm-symbolizer --obj="%t space.o" 0 | FileCheck %s
13+
14+
# CHECK: foo
15+
# CHECK-NEXT: space-in-path.s:5

0 commit comments

Comments
 (0)