Skip to content

Commit 4cd1425

Browse files
author
Georgii Rymar
committed
[llvm-readobj][test] - Test "Format" values.
This adds testing for the "Format" field printed with `--file-headers`. llvm-readelf doesn't use them, so only llvm-readobj needs to be tested. All possible values are defined and tested in `ELFObjectFile<ELFT>::getFileFormatName()`. Here we test just a few arbitrary ones. Differential revision: https://reviews.llvm.org/D86350
1 parent c78d276 commit 4cd1425

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## This tests "Format" values printed by llvm-readobj.
2+
3+
## The "Format" value printed depends on values stored in e_ident[EI_CLASS],
4+
## e_ident[EI_DATA] and e_machine fields of an ELF file header.
5+
## We test all possible values in unittests\Object\ELFObjectFileTest.cpp,
6+
## here we test just a few of them to demonstrate that llvm-readobj prints the same.
7+
8+
# RUN: yaml2obj %s -o %t.none64.o
9+
# RUN: llvm-readobj --file-headers %t.none64.o | FileCheck %s -DFMT="elf64-unknown"
10+
11+
# RUN: yaml2obj %s -o %t.none32.o -DCLASS=32
12+
# RUN: llvm-readobj --file-headers %t.none32.o | FileCheck %s -DFMT="elf32-unknown"
13+
14+
# RUN: yaml2obj %s -o %t.i386-32.o -DMACHINE=EM_386 -DCLASS=32
15+
# RUN: llvm-readobj --file-headers %t.i386-32.o | FileCheck %s -DFMT="elf32-i386"
16+
17+
# RUN: yaml2obj %s -o %t.x86_64.o -DMACHINE=EM_X86_64
18+
# RUN: llvm-readobj --file-headers %t.x86_64.o | FileCheck %s -DFMT="elf64-x86-64"
19+
20+
# CHECK: Format: [[FMT]]
21+
22+
--- !ELF
23+
FileHeader:
24+
Class: ELFCLASS[[CLASS=64]]
25+
Data: ELFDATA2[[DATA=LSB]]
26+
Type: ET_REL
27+
Machine: [[MACHINE=EM_NONE]]

0 commit comments

Comments
 (0)