From b10f112cf98e4836f3c6f32d84d83eb6b5de1c39 Mon Sep 17 00:00:00 2001 From: James Henderson Date: Thu, 31 Jan 2019 14:11:17 +0000 Subject: [PATCH] [llvm-symbolizer][test] Extract tests from llvm-symbolizer.test and simplify (#1) This is the second of a series of patches simplifying llvm-symbolizer tests. See r352752 for the first. This one splits out 5 distinct test cases from llvm-symbolizer.test into separate tests, and simplifies them slightly by using --obj/positional arguments for the input file and addresses instead of stdin. See https://bugs.llvm.org/show_bug.cgi?id=40070#c1 for the motivation. Reviewed by: dblaikie Differential Revision: https://reviews.llvm.org/D57443 llvm-svn: 352753 --- llvm/test/DebugInfo/arange-overlap.test | 4 +++ llvm/test/DebugInfo/cross-cu-inlining.test | 8 +++++ llvm/test/DebugInfo/gcc-local-mem-func.test | 5 ++++ llvm/test/DebugInfo/high-pc-constant.test | 10 +++++++ llvm/test/DebugInfo/llvm-symbolizer.test | 33 --------------------- llvm/test/DebugInfo/symbolize-stripped.test | 4 +++ 6 files changed, 31 insertions(+), 33 deletions(-) create mode 100644 llvm/test/DebugInfo/arange-overlap.test create mode 100644 llvm/test/DebugInfo/cross-cu-inlining.test create mode 100644 llvm/test/DebugInfo/gcc-local-mem-func.test create mode 100644 llvm/test/DebugInfo/high-pc-constant.test create mode 100644 llvm/test/DebugInfo/symbolize-stripped.test diff --git a/llvm/test/DebugInfo/arange-overlap.test b/llvm/test/DebugInfo/arange-overlap.test new file mode 100644 index 0000000000000..c29402523ac39 --- /dev/null +++ b/llvm/test/DebugInfo/arange-overlap.test @@ -0,0 +1,4 @@ +RUN: llvm-symbolizer --no-demangle --obj=%p/Inputs/arange-overlap.elf-x86_64 0x714 | FileCheck %s + +CHECK: _ZN1S3bazEv +CHECK-NEXT: {{.*}}arange-overlap.cc:6 diff --git a/llvm/test/DebugInfo/cross-cu-inlining.test b/llvm/test/DebugInfo/cross-cu-inlining.test new file mode 100644 index 0000000000000..b5cbffc616d80 --- /dev/null +++ b/llvm/test/DebugInfo/cross-cu-inlining.test @@ -0,0 +1,8 @@ +RUN: llvm-symbolizer --obj=%p/Inputs/cross-cu-inlining.x86_64-macho.o 0x17 | FileCheck %s + +; func has been inlined into main by LTO. Check that the symbolizer is able +; to resolve the cross-cu reference and retrieve func's name +CHECK: func +CHECK-NEXT: /tmp{{[/\\]}}cross-cu-inlining.c:16:3 +CHECK-NEXT: main +CHECK-NEXT: /tmp{{[/\\]}}cross-cu-inlining.c:11:0 diff --git a/llvm/test/DebugInfo/gcc-local-mem-func.test b/llvm/test/DebugInfo/gcc-local-mem-func.test new file mode 100644 index 0000000000000..2eccd5a1299cc --- /dev/null +++ b/llvm/test/DebugInfo/gcc-local-mem-func.test @@ -0,0 +1,5 @@ +RUN: llvm-symbolizer --no-demangle --obj=%p/Inputs/llvm-symbolizer-local-mem-func-gcc.elf-x86-64 0x61a | FileCheck %s + +CHECK-NOT: local_mem_func +CHECK: _ZZ2f1vEN3foo14local_mem_funcEv +CHECK-NEXT: {{.*}}local-mem-func.cpp:3:0 diff --git a/llvm/test/DebugInfo/high-pc-constant.test b/llvm/test/DebugInfo/high-pc-constant.test new file mode 100644 index 0000000000000..79007003e4c1a --- /dev/null +++ b/llvm/test/DebugInfo/high-pc-constant.test @@ -0,0 +1,10 @@ +RUN: llvm-symbolizer --inlining --obj=%p/Inputs/dwarfdump-inl-test.high_pc.elf-x86-64 0x568 | FileCheck %s + +CHECK: inlined_h +CHECK-NEXT: dwarfdump-inl-test.h:3 +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 diff --git a/llvm/test/DebugInfo/llvm-symbolizer.test b/llvm/test/DebugInfo/llvm-symbolizer.test index 4c8e7ec9f0c6f..ff39ccc1c4901 100644 --- a/llvm/test/DebugInfo/llvm-symbolizer.test +++ b/llvm/test/DebugInfo/llvm-symbolizer.test @@ -11,7 +11,6 @@ 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: echo "%p/Inputs/dwarfdump-inl-test.high_pc.elf-x86-64 0x568" >> %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 @@ -19,9 +18,6 @@ RUN: echo "\"%t/dwarfdump-test3.elf-x86-64 space\" 0x62d" >> %t.input RUN: echo "%p/Inputs/macho-universal 0x1f84" >> %t.input RUN: echo "%p/Inputs/macho-universal:i386 0x1f67" >> %t.input RUN: echo "%p/Inputs/macho-universal:x86_64 0x100000f05" >> %t.input -RUN: echo "%p/Inputs/llvm-symbolizer-local-mem-func-gcc.elf-x86-64 0x61a" >> %t.input -RUN: echo "%p/Inputs/arange-overlap.elf-x86_64 0x714" >> %t.input -RUN: echo "%p/Inputs/cross-cu-inlining.x86_64-macho.o 0x17" >> %t.input RUN: cd %t RUN: llvm-symbolizer --functions=linkage --inlining --demangle=false \ @@ -71,15 +67,6 @@ CHECK-NEXT: dwarfdump-inl-test.cc:3 CHECK-NEXT: main CHECK-NEXT: dwarfdump-inl-test.cc:8 -CHECK: inlined_h -CHECK-NEXT: dwarfdump-inl-test.h:3 -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: C CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test3.cc:3 @@ -93,20 +80,6 @@ CHECK: main CHECK: _Z3inci CHECK: _Z3inci -CHECK-NOT: local_mem_func -CHECK: _ZZ2f1vEN3foo14local_mem_funcEv -CHECK-NEXT: {{.*}}local-mem-func.cpp:3:0 - -CHECK: _ZN1S3bazEv -CHECK-NEXT: {{.*}}arange-overlap.cc:6 - -; func has been inlined into main by LTO. Check that the symbolizer is able -; to resolve the cross-cu reference and retrieve func's name -CHECK: func -CHECK-NEXT: /tmp{{[/\\]}}cross-cu-inlining.c:16:3 -CHECK-NEXT: main -CHECK-NEXT: /tmp{{[/\\]}}cross-cu-inlining.c:11:0 - RUN: echo "unexisting-file 0x1234" > %t.input2 RUN: llvm-symbolizer < %t.input2 2>&1 | FileCheck %s --check-prefix=MISSING-FILE @@ -139,12 +112,6 @@ BINARY_C-NEXT: /tmp/dbginfo{{[/\\]}}llvm-symbolizer-test.c:10 BINARY_C: _start BINARY_C: {{g$}} -RUN: echo "0x1f1" > %t.input6 -RUN: llvm-symbolizer --obj %p/Inputs/shared-object-stripped.elf-i386 < %t.input6 \ -RUN: | FileCheck %s --check-prefix=STRIPPED - -STRIPPED: global_func - ; Check that the last of --demangle and --no-demangle wins. RUN: echo "%p/Inputs/dwarfdump-test4.elf-x86-64 0x62c" > %t.input7 RUN: llvm-symbolizer --demangle < %t.input7 \ diff --git a/llvm/test/DebugInfo/symbolize-stripped.test b/llvm/test/DebugInfo/symbolize-stripped.test new file mode 100644 index 0000000000000..5c1131a556bb6 --- /dev/null +++ b/llvm/test/DebugInfo/symbolize-stripped.test @@ -0,0 +1,4 @@ +RUN: llvm-symbolizer 0x1f1 --obj %p/Inputs/shared-object-stripped.elf-i386 \ +RUN: | FileCheck %s + +CHECK: global_func