xref: /llvm-project/llvm/test/tools/llvm-objdump/X86/source-interleave-relative-paths.test (revision 71e2ca6e32105b35aeadeab25010e8f999c47c23)
1## Test that llvm-objdump prints source and disassembly for relative directory
2## paths for appropriate working directories. We also test that when the directory
3## string is empty the behaviour is the same as the current working directory.
4
5# RUN: mkdir -p %t/a/b
6# RUN: cp %p/Inputs/source-interleave-x86_64.c %t/a/source-interleave-x86_64.c
7
8# RUN: sed -e "s,SRC_COMPDIR,a,g" %p/Inputs/source-interleave.ll > %t.ll
9# RUN: sed -e "s,SRC_COMPDIR,,g" %p/Inputs/source-interleave.ll > %t2.ll
10# RUN: sed -e "s,SRC_COMPDIR,.,g" %p/Inputs/source-interleave.ll > %t3.ll
11# RUN: sed -e "s,SRC_COMPDIR,..,g" %p/Inputs/source-interleave.ll > %t4.ll
12
13# RUN: llc -o %t/a/a.o -filetype=obj -mtriple=x86_64-pc-linux %t.ll
14# RUN: llc -o %t/a/b.o -filetype=obj -mtriple=x86_64-pc-linux %t2.ll
15# RUN: llc -o %t/a/c.o -filetype=obj -mtriple=x86_64-pc-linux %t3.ll
16# RUN: llc -o %t/a/d.o -filetype=obj -mtriple=x86_64-pc-linux %t4.ll
17
18# RUN: cd %t
19# RUN: llvm-objdump --source a/a.o | FileCheck %s --check-prefixes=CHECK,SOURCE
20# RUN: llvm-objdump --source a/b.o | FileCheck %s --implicit-check-not='main()'
21# RUN: llvm-objdump --source a/c.o | FileCheck %s --implicit-check-not='main()'
22# RUN: llvm-objdump --source a/d.o | FileCheck %s --implicit-check-not='main()'
23# RUN: cd a
24# RUN: llvm-objdump --source a.o | FileCheck %s --implicit-check-not='main()'
25# RUN: llvm-objdump --source b.o | FileCheck %s --check-prefixes=CHECK,SOURCE
26# RUN: llvm-objdump --source c.o | FileCheck %s --check-prefixes=CHECK,SOURCE
27# RUN: llvm-objdump --source d.o | FileCheck %s --implicit-check-not='main()'
28# RUN: cd b
29# RUN: llvm-objdump --source ../a.o | FileCheck %s --implicit-check-not='main()'
30# RUN: llvm-objdump --source ../b.o | FileCheck %s --implicit-check-not='main()'
31# RUN: llvm-objdump --source ../c.o | FileCheck %s --implicit-check-not='main()'
32# RUN: llvm-objdump --source ../d.o | FileCheck %s --check-prefixes=CHECK,SOURCE
33
34# CHECK:       0000000000000010 <main>:
35# SOURCE-NEXT: ; int main() {
36# CHECK-NEXT:   10:   55                      pushq   %rbp
37