[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
This commit is contained in:
James Henderson 2019-01-31 14:22:50 +00:00
parent a22c72ca8f
commit 5282c872c0
8 changed files with 44 additions and 69 deletions

View File

@ -1,7 +0,0 @@
#include "dwarfdump-test3-decl2.h"
class C {
explicit C(bool a = false, bool b = false);
};
void do1() {}

View File

@ -1 +0,0 @@
void do2() { }

View 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>

View 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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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