1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/test/tools/llvm-readobj/ELF/file-header-format.test
Georgii Rymar 567f08efb9 [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
2020-08-28 11:31:25 +03:00

28 lines
1.0 KiB
Plaintext

## This tests "Format" values printed by llvm-readobj.
## The "Format" value printed depends on values stored in e_ident[EI_CLASS],
## e_ident[EI_DATA] and e_machine fields of an ELF file header.
## We test all possible values in unittests\Object\ELFObjectFileTest.cpp,
## here we test just a few of them to demonstrate that llvm-readobj prints the same.
# RUN: yaml2obj %s -o %t.none64.o
# RUN: llvm-readobj --file-headers %t.none64.o | FileCheck %s -DFMT="elf64-unknown"
# RUN: yaml2obj %s -o %t.none32.o -DCLASS=32
# RUN: llvm-readobj --file-headers %t.none32.o | FileCheck %s -DFMT="elf32-unknown"
# RUN: yaml2obj %s -o %t.i386-32.o -DMACHINE=EM_386 -DCLASS=32
# RUN: llvm-readobj --file-headers %t.i386-32.o | FileCheck %s -DFMT="elf32-i386"
# RUN: yaml2obj %s -o %t.x86_64.o -DMACHINE=EM_X86_64
# RUN: llvm-readobj --file-headers %t.x86_64.o | FileCheck %s -DFMT="elf64-x86-64"
# CHECK: Format: [[FMT]]
--- !ELF
FileHeader:
Class: ELFCLASS[[CLASS=64]]
Data: ELFDATA2[[DATA=LSB]]
Type: ET_REL
Machine: [[MACHINE=EM_NONE]]