forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[llvm-objdump][test] Improve testing of some switches llvm-mirror#2
This patch focuses on adding additional testing for the --source switch. For reference, the source-interleave-x86_64.ll test file has been split into two parts - the input (shared with the other tests) and the test itself. Reviewed by: MaskRay, rupprecht, grimar Differential Revision: https://reviews.llvm.org/D61996 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361479 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
jhenderson
committed
May 23, 2019
1 parent
7213e06
commit e7f60fc
Showing
6 changed files
with
100 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
test/tools/llvm-objdump/X86/source-interleave-invalid-source.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## Test llvm-objdump's --source behaviour when a line number is greater than the | ||
## file length. | ||
|
||
# RUN: sed -e "s,SRC_COMPDIR,%/p/Inputs,g" %p/Inputs/source-interleave.ll > %t.ll | ||
# RUN: sed -e "s,line: 7,line: 9999,g" %t.ll > %t2.ll | ||
|
||
# RUN: llc -o %t.o -filetype=obj -mtriple=x86_64-pc-linux %t.ll | ||
# RUN: llc -o %t2.o -filetype=obj -mtriple=x86_64-pc-linux %t2.ll | ||
|
||
# RUN: llvm-objdump --source %t.o | FileCheck %s --check-prefixes=CHECK,GOOD | ||
# RUN: llvm-objdump --source %t2.o | FileCheck %s --implicit-check-not="int *b = &a;" | ||
|
||
# CHECK: main: | ||
# CHECK-NEXT: ; int main() { | ||
# GOOD: ; int *b = &a; | ||
# CHECK: ; return *b + foo(); |
15 changes: 15 additions & 0 deletions
15
test/tools/llvm-objdump/X86/source-interleave-missing-source.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## Test that if the source cannot be found that disassembly is still printed, | ||
## and that no source is printed. | ||
|
||
# RUN: sed -e "s,SRC_COMPDIR,%/t,g" %p/Inputs/source-interleave.ll > %t.ll | ||
# RUN: sed -e "s,SRC_COMPDIR,%/p/Inputs,g" %p/Inputs/source-interleave.ll > %t2.ll | ||
|
||
# RUN: llc -o %t.o -filetype=obj -mtriple=x86_64-pc-linux %t.ll | ||
# RUN: llc -o %t2.o -filetype=obj -mtriple=x86_64-pc-linux %t2.ll | ||
|
||
# RUN: llvm-objdump --source %t.o | FileCheck %s --implicit-check-not=main | ||
# RUN: llvm-objdump --source %t2.o | FileCheck %s --check-prefixes=CHECK,SOURCE | ||
|
||
# CHECK: 0000000000000010 main: | ||
# SOURCE-NEXT: ; int main() { | ||
# CHECK-NEXT: 10: 55 pushq %rbp |
13 changes: 13 additions & 0 deletions
13
test/tools/llvm-objdump/X86/source-interleave-no-debug-info.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## Test that if an object has no debug information, only the disassembly is | ||
## printed when --source is specified. | ||
|
||
# RUN: sed -e "s,SRC_COMPDIR,%/p/Inputs,g" %p/Inputs/source-interleave.ll > %t.ll | ||
# RUN: llc -o %t.o -filetype=obj -mtriple=x86_64-pc-linux %t.ll | ||
# RUN: llvm-objcopy --strip-debug %t.o %t2.o | ||
|
||
# RUN: llvm-objdump --source %t.o | FileCheck %s --check-prefixes=CHECK,SOURCE | ||
# RUN: llvm-objdump --source %t2.o | FileCheck %s --implicit-check-not=main | ||
|
||
# CHECK: 0000000000000010 main: | ||
# SOURCE-NEXT: ; int main() { | ||
# CHECK-NEXT: 10: 55 pushq %rbp |
36 changes: 36 additions & 0 deletions
36
test/tools/llvm-objdump/X86/source-interleave-relative-paths.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
## Test that llvm-objdump prints source and disassembly for relative directory | ||
## paths for appropriate working directories. We also test that when the directory | ||
## string is empty the behaviour is the same as the current working directory. | ||
|
||
# RUN: mkdir -p %t/a/b | ||
# RUN: cp %p/Inputs/source-interleave-x86_64.c %t/a/source-interleave-x86_64.c | ||
|
||
# RUN: sed -e "s,SRC_COMPDIR,a,g" %p/Inputs/source-interleave.ll > %t.ll | ||
# RUN: sed -e "s,SRC_COMPDIR,,g" %p/Inputs/source-interleave.ll > %t2.ll | ||
# RUN: sed -e "s,SRC_COMPDIR,.,g" %p/Inputs/source-interleave.ll > %t3.ll | ||
# RUN: sed -e "s,SRC_COMPDIR,..,g" %p/Inputs/source-interleave.ll > %t4.ll | ||
|
||
# RUN: llc -o %t/a/a.o -filetype=obj -mtriple=x86_64-pc-linux %t.ll | ||
# RUN: llc -o %t/a/b.o -filetype=obj -mtriple=x86_64-pc-linux %t2.ll | ||
# RUN: llc -o %t/a/c.o -filetype=obj -mtriple=x86_64-pc-linux %t3.ll | ||
# RUN: llc -o %t/a/d.o -filetype=obj -mtriple=x86_64-pc-linux %t4.ll | ||
|
||
# RUN: cd %t | ||
# RUN: llvm-objdump --source a/a.o | FileCheck %s --check-prefixes=CHECK,SOURCE | ||
# RUN: llvm-objdump --source a/b.o | FileCheck %s --implicit-check-not=main | ||
# RUN: llvm-objdump --source a/c.o | FileCheck %s --implicit-check-not=main | ||
# RUN: llvm-objdump --source a/d.o | FileCheck %s --implicit-check-not=main | ||
# RUN: cd a | ||
# RUN: llvm-objdump --source a.o | FileCheck %s --implicit-check-not=main | ||
# RUN: llvm-objdump --source b.o | FileCheck %s --check-prefixes=CHECK,SOURCE | ||
# RUN: llvm-objdump --source c.o | FileCheck %s --check-prefixes=CHECK,SOURCE | ||
# RUN: llvm-objdump --source d.o | FileCheck %s --implicit-check-not=main | ||
# RUN: cd b | ||
# RUN: llvm-objdump --source ../a.o | FileCheck %s --implicit-check-not=main | ||
# RUN: llvm-objdump --source ../b.o | FileCheck %s --implicit-check-not=main | ||
# RUN: llvm-objdump --source ../c.o | FileCheck %s --implicit-check-not=main | ||
# RUN: llvm-objdump --source ../d.o | FileCheck %s --check-prefixes=CHECK,SOURCE | ||
|
||
# CHECK: 0000000000000010 main: | ||
# SOURCE-NEXT: ; int main() { | ||
# CHECK-NEXT: 10: 55 pushq %rbp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# RUN: sed -e "s,SRC_COMPDIR,%/p/Inputs,g" %p/Inputs/source-interleave.ll > %t.ll | ||
# RUN: llc -o %t.o -filetype=obj -mtriple=x86_64-pc-linux %t.ll | ||
# RUN: llvm-objdump -d -l %t.o >%t0 | ||
# RUN: llvm-objdump -dl %t.o >%t1 | ||
# RUN: llvm-objdump -d -S %t.o >%t2 | ||
# RUN: llvm-objdump -dS %t.o >%t3 | ||
# RUN: cmp %t0 %t1 | ||
# RUN: cmp %t2 %t3 | ||
# RUN: FileCheck --check-prefix=LINES %s < %t0 | ||
# RUN: FileCheck --check-prefix=SOURCE --strict-whitespace %s < %t2 | ||
|
||
# LINES: main: | ||
# LINES-NEXT: ; {{[ -\(\)_A-Za-z0-9.\\/:]+}}source-interleave-x86_64.c:6 | ||
|
||
# SOURCE: main: | ||
# SOURCE-NEXT: ; int main() { | ||
# SOURCE: ; int *b = &a; |