xref: /llvm-project/llvm/test/tools/llvm-readobj/ELF/file-name.test (revision a6436b0b3a7fd9f13d7a059a6a78544a7e0b702f)
1## This test shows that the name of the file is printed under the right
2## circumstances and with the correct formatting for object inputs.
3
4# RUN: yaml2obj %s -o %t1
5# RUN: cp %t1 %t2
6
7## Show that the file name is not printed for a single input for GNU output.
8# RUN: llvm-readelf --file-headers %t1 \
9# RUN:   | FileCheck %s --implicit-check-not=File: --check-prefix=GNU-SINGLE
10
11## Show that the very first line of the output is the one with "ELF Header" on.
12# GNU-SINGLE:      {{^}}
13# GNU-SINGLE-SAME: ELF Header:
14
15## Show that the file names are printed for all inputs for GNU output.
16# RUN: llvm-readelf --file-headers %t1 %t2 \
17# RUN:   | FileCheck %s --check-prefixes=NAME1,GNU,NAME2 -DFILE1=%t1 -DFILE2=%t2
18
19## Show that the file name is printed for a single input for LLVM output.
20# RUN: llvm-readobj --file-headers %t1 | FileCheck %s --check-prefix=NAME1 -DFILE1=%t1
21
22## Show that the file name is printed with correct spacing for multiple inputs
23## with LLVM output.
24# RUN: llvm-readobj --file-headers %t1 %t2 \
25# RUN:   | FileCheck %s --check-prefixes=NAME1,LLVM,NAME2 -DFILE1=%t1 -DFILE2=%t2
26
27## The very first line should be blank. CHECK-EMPTY isn't allowed on the first line.
28# NAME1:      {{^$}}
29# NAME1-NEXT: {{^}}File: [[FILE1]]{{$}}
30
31# GNU:          Section header string table index:
32# LLVM:         StringTableSectionIndex:
33# LLVM-NEXT:  }
34# NAME2-EMPTY:
35# NAME2-NEXT: {{^}}File: [[FILE2]]{{$}}
36
37--- !ELF
38FileHeader:
39  Class: ELFCLASS64
40  Data:  ELFDATA2LSB
41  Type:  ET_REL
42