-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reapply "[TLI checker] Add more tests"
This reverts commit 8cd61aa. I had missed one place in a test that needed updating; it passed on my dirty build tree but not on a clean one. Original commit message: D114478 identified testing gaps; this patch fills them. Differential Revision: https://reviews.llvm.org/D114913
- Loading branch information
Showing
4 changed files
with
208 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
## Currently COFF files aren't supported. | ||
# RUN: yaml2obj %s -o %t.obj | ||
# RUN: llvm-tli-checker %t.obj 2>&1 | FileCheck %s | ||
# | ||
# CHECK: only ELF-format files are supported | ||
# CHECK: no symbols found | ||
# CHECK: NO symbols found! | ||
|
||
## Minimal COFF input. | ||
--- !COFF | ||
OptionalHeader: | ||
AddressOfEntryPoint: 4144 | ||
ImageBase: 1073741824 | ||
SectionAlignment: 4096 | ||
FileAlignment: 512 | ||
MajorOperatingSystemVersion: 6 | ||
MinorOperatingSystemVersion: 0 | ||
MajorImageVersion: 0 | ||
MinorImageVersion: 0 | ||
MajorSubsystemVersion: 6 | ||
MinorSubsystemVersion: 0 | ||
Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI | ||
DLLCharacteristics: [ ] | ||
SizeOfStackReserve: 1048576 | ||
SizeOfStackCommit: 4096 | ||
SizeOfHeapReserve: 1048576 | ||
SizeOfHeapCommit: 4096 | ||
header: | ||
Machine: IMAGE_FILE_MACHINE_AMD64 | ||
Characteristics: [ ] | ||
sections: | ||
- Name: .text | ||
Characteristics: [ IMAGE_SCN_CNT_CODE ] | ||
VirtualAddress: 4096 | ||
VirtualSize: 4 | ||
SectionData: C3C3C3C3 | ||
symbols: | ||
- Name: main | ||
Value: 2 | ||
SectionNumber: 1 | ||
SimpleType: IMAGE_SYM_TYPE_NULL | ||
ComplexType: IMAGE_SYM_DTYPE_FUNCTION | ||
StorageClass: IMAGE_SYM_CLASS_EXTERNAL |
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,32 @@ | ||
## No input files. | ||
# RUN: not llvm-tli-checker 2>&1 | FileCheck %s --check-prefix=NOFILES | ||
# | ||
## File not found. | ||
# RUN: rm -f %t0.txt | ||
# RUN: llvm-tli-checker %t0.txt 2>&1 | FileCheck %s -DFILE=%t0.txt --check-prefixes=FILE-NOT-FOUND,NOSYMBOLS-AT-ALL | ||
# | ||
## Reject a non-binary file. | ||
# RUN: echo nonsense > %t1.o | ||
# RUN: llvm-tli-checker %t1.o 2>&1 | FileCheck %s --check-prefixes=INVALID-FILE,NOSYMBOLS-AT-ALL | ||
# | ||
## Reject an empty file. | ||
# RUN: yaml2obj %s -o %t2.o | ||
# RUN: llvm-tli-checker %t2.o 2>&1 | FileCheck %s -DFILE=%t2.o --check-prefixes=NOSYMBOLS-IN-FILE,NOSYMBOLS-AT-ALL | ||
# | ||
# NOFILES: error: no input files | ||
# FILE-NOT-FOUND-DAG: warning: [[FILE]]: not found | ||
# INVALID-FILE-DAG: warning: The file was not recognized as a valid object file | ||
# NOSYMBOLS-AT-ALL-DAG: error: NO symbols found! | ||
# NOSYMBOLS-IN-FILE-DAG: warning: [[FILE]]: no symbols found | ||
|
||
## Minimal ELF with no symbols. | ||
--- !ELF | ||
FileHeader: | ||
Class: ELFCLASS64 | ||
Data: ELFDATA2LSB | ||
OSABI: ELFOSABI_FREEBSD | ||
Type: ET_DYN | ||
Machine: EM_X86_64 | ||
Sections: | ||
- Name: .text | ||
Type: SHT_PROGBITS |
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,117 @@ | ||
## Test that we can pass multiple files. There are several ways to do this: | ||
## list them all individually, use --libdir to shorten the list, or use a | ||
## response file (with or without --libdir). | ||
## | ||
# REQUIRES: x86-registered-target | ||
# | ||
# RUN: mkdir -p %t.dir | ||
# RUN: yaml2obj --docnum=1 %s -o %t.dir/file1 | ||
# RUN: yaml2obj --docnum=2 %s -o %t.dir/file2 | ||
# RUN: yaml2obj --docnum=3 %s -o %t.dir/file3 | ||
|
||
# RUN: llvm-tli-checker --triple x86_64-scei-ps4 --report=full \ | ||
# RUN: %t.dir/file1 %t.dir/file2 %t.dir/file3 | \ | ||
# RUN: FileCheck %s | ||
# | ||
## Same result using --libdir. | ||
# RUN: llvm-tli-checker --triple x86_64-scei-ps4 --report=full \ | ||
# RUN: --libdir=%t.dir file1 file2 file3 | \ | ||
# RUN: FileCheck %s | ||
# | ||
## And with a response file. | ||
# RUN: echo -e "file1\nfile2\nfile3\n" > %t.dir/resp1.txt | ||
# RUN: llvm-tli-checker --triple x86_64-scei-ps4 --report=full \ | ||
# RUN: --libdir=%t.dir @%t.dir/resp1.txt | \ | ||
# RUN: FileCheck %s | ||
# | ||
# RUN: echo %t.dir/file1 > %t.dir/resp2.txt | ||
# RUN: echo %t.dir/file2 >> %t.dir/resp2.txt | ||
# RUN: echo %t.dir/file3 >> %t.dir/resp2.txt | ||
# RUN: llvm-tli-checker --triple x86_64-scei-ps4 --report=full \ | ||
# RUN: @%t.dir/resp2.txt | \ | ||
# RUN: FileCheck %s | ||
# | ||
## Also check that an archive works. Put file1 and file2 into an archive, | ||
## and pass the archive name plus file3 on the command line. | ||
# RUN: rm -f %t.dir/archive.a | ||
# RUN: llvm-ar rc %t.dir/archive.a %t.dir/file1 %t.dir/file2 | ||
# RUN: llvm-tli-checker --triple x86_64-scei-ps4 --report=full \ | ||
# RUN: --libdir=%t.dir archive.a file3 | \ | ||
# RUN: FileCheck %s | ||
# | ||
# CHECK: TLI knows {{[0-9]+}} symbols, [[#AVAILABLE:]] available | ||
# CHECK: >> TLI no SDK yes: '_ZdaPvj' | ||
# CHECK: == TLI yes SDK yes: 'abs' | ||
# CHECK: == TLI yes SDK yes: 'calloc' | ||
## The yes/no and yes/yes should add up to the total available. | ||
## The no/yes aren't included in the total available. | ||
# CHECK: << Total TLI yes SDK no: [[#AVAILABLE-2]] | ||
# CHECK: >> Total TLI no SDK yes: 1{{$}} | ||
# CHECK: == Total TLI yes SDK yes: 2{{$}} | ||
|
||
## --separate should give one summary per input file (as listed on the | ||
# command line; it doesn't break things down by archive member). | ||
# RUN: llvm-tli-checker --triple x86_64-scei-ps4 --separate \ | ||
# RUN: --libdir=%t.dir archive.a file3 | \ | ||
# RUN: FileCheck %s --check-prefix=SEPARATE | ||
# | ||
# SEPARATE: TLI knows {{[0-9]+}} symbols, [[#AVAILABLE:]] available | ||
# SEPARATE: Found 2 global function symbols in '{{.*}}archive.a' | ||
# SEPARATE: << Total TLI yes SDK no: [[#AVAILABLE-1]] | ||
# SEPARATE: >> Total TLI no SDK yes: 1{{$}} | ||
# SEPARATE: == Total TLI yes SDK yes: 1{{$}} | ||
# SEPARATE: Found 1 global function symbols in '{{.*}}file3' | ||
# SEPARATE: << Total TLI yes SDK no: [[#AVAILABLE-1]] | ||
# SEPARATE: >> Total TLI no SDK yes: 0{{$}} | ||
# SEPARATE: == Total TLI yes SDK yes: 1{{$}} | ||
|
||
# file1 | ||
--- !ELF | ||
FileHeader: | ||
Class: ELFCLASS64 | ||
Data: ELFDATA2LSB | ||
OSABI: ELFOSABI_FREEBSD | ||
Type: ET_DYN | ||
Machine: EM_X86_64 | ||
Sections: | ||
- Name: .text | ||
Type: SHT_PROGBITS | ||
DynamicSymbols: | ||
- Name: abs | ||
Type: STT_FUNC | ||
Section: .text | ||
Binding: STB_GLOBAL | ||
|
||
# file2 | ||
--- !ELF | ||
FileHeader: | ||
Class: ELFCLASS64 | ||
Data: ELFDATA2LSB | ||
OSABI: ELFOSABI_FREEBSD | ||
Type: ET_DYN | ||
Machine: EM_X86_64 | ||
Sections: | ||
- Name: .text | ||
Type: SHT_PROGBITS | ||
DynamicSymbols: | ||
- Name: _ZdaPvj | ||
Type: STT_FUNC | ||
Section: .text | ||
Binding: STB_GLOBAL | ||
|
||
# file3 | ||
--- !ELF | ||
FileHeader: | ||
Class: ELFCLASS64 | ||
Data: ELFDATA2LSB | ||
OSABI: ELFOSABI_FREEBSD | ||
Type: ET_DYN | ||
Machine: EM_X86_64 | ||
Sections: | ||
- Name: .text | ||
Type: SHT_PROGBITS | ||
DynamicSymbols: | ||
- Name: calloc | ||
Type: STT_FUNC | ||
Section: .text | ||
Binding: STB_GLOBAL |
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