Skip to content

Commit 63f0f54

Browse files
committed
[yaml2obj][test] Move tests to binary format specific subdirectories
Create COFF/, ELF/, and Minidump and move tests there. Also * Rename `*.test` to `*.yaml` * For yaml2obj RUN lines, use `-o %t` instead of `> %t` for consistency. We still have tests that check stdout is the default output, e.g. multi-doc.test * Update tests to consistently use `##` for comments. `#` is for RUN and CHECK lines. * Merge symboless-relocation.yaml and invalid-symboless-relocation.yaml to ELF/relocation-implicit-symbol-index.test Reviewed By: grimar, jhenderson Differential Revision: https://reviews.llvm.org/D70264
1 parent c85fa79 commit 63f0f54

File tree

86 files changed

+93
-102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+93
-102
lines changed

llvm/test/tools/yaml2obj/coff-arm64.yaml renamed to llvm/test/tools/yaml2obj/COFF/basic-arm64.yaml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# ROUNDTRIP: VirtualAddress: 12288
1010

1111
--- !COFF
12-
OptionalHeader:
12+
OptionalHeader:
1313
AddressOfEntryPoint: 4096
1414
ImageBase: 1073741824
1515
SectionAlignment: 4096
@@ -26,55 +26,55 @@ OptionalHeader:
2626
SizeOfStackCommit: 4096
2727
SizeOfHeapReserve: 1048576
2828
SizeOfHeapCommit: 4096
29-
ExportTable:
29+
ExportTable:
3030
RelativeVirtualAddress: 0
3131
Size: 0
32-
ImportTable:
32+
ImportTable:
3333
RelativeVirtualAddress: 0
3434
Size: 0
35-
ResourceTable:
35+
ResourceTable:
3636
RelativeVirtualAddress: 0
3737
Size: 0
38-
ExceptionTable:
38+
ExceptionTable:
3939
RelativeVirtualAddress: 12288
4040
Size: 8
41-
CertificateTable:
41+
CertificateTable:
4242
RelativeVirtualAddress: 0
4343
Size: 0
44-
BaseRelocationTable:
44+
BaseRelocationTable:
4545
RelativeVirtualAddress: 0
4646
Size: 0
47-
Debug:
47+
Debug:
4848
RelativeVirtualAddress: 0
4949
Size: 0
50-
Architecture:
50+
Architecture:
5151
RelativeVirtualAddress: 0
5252
Size: 0
53-
GlobalPtr:
53+
GlobalPtr:
5454
RelativeVirtualAddress: 0
5555
Size: 0
56-
TlsTable:
56+
TlsTable:
5757
RelativeVirtualAddress: 0
5858
Size: 0
59-
LoadConfigTable:
59+
LoadConfigTable:
6060
RelativeVirtualAddress: 0
6161
Size: 0
62-
BoundImport:
62+
BoundImport:
6363
RelativeVirtualAddress: 0
6464
Size: 0
65-
IAT:
65+
IAT:
6666
RelativeVirtualAddress: 0
6767
Size: 0
68-
DelayImportDescriptor:
68+
DelayImportDescriptor:
6969
RelativeVirtualAddress: 0
7070
Size: 0
71-
ClrRuntimeHeader:
71+
ClrRuntimeHeader:
7272
RelativeVirtualAddress: 0
7373
Size: 0
74-
header:
74+
header:
7575
Machine: IMAGE_FILE_MACHINE_ARM64
7676
Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE ]
77-
sections:
77+
sections:
7878
- Name: .text
7979
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
8080
VirtualAddress: 4096

llvm/test/tools/yaml2obj/coff-invalid-alignment.test renamed to llvm/test/tools/yaml2obj/COFF/invalid-alignment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ sections:
1111
Characteristics: []
1212
SectionData: 00
1313
Alignment: 16384
14-
symbols:
14+
symbols: []

llvm/test/tools/yaml2obj/coff-symbol-index.yaml renamed to llvm/test/tools/yaml2obj/COFF/symbol-index.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
# RELOCS-NEXT: }
1111
# RELOCS-NEXT: ]
1212

13-
# Check that we usually output relocations with SymbolName.
14-
# For relocations with a non-unique symbol name, output
15-
# SymbolTableIndex instead.
13+
## Check that we usually output relocations with SymbolName.
14+
## For relocations with a non-unique symbol name, output
15+
## SymbolTableIndex instead.
1616

17-
# YAML: Relocations:
17+
# YAML: Relocations:
1818
# YAML-NEXT: - VirtualAddress: 3
1919
# YAML-NEXT: SymbolTableIndex: 0
2020
# YAML-NEXT: Type: IMAGE_REL_AMD64_REL32
@@ -26,15 +26,15 @@
2626
# YAML-NEXT: Type: IMAGE_REL_AMD64_REL32
2727

2828
--- !COFF
29-
header:
29+
header:
3030
Machine: IMAGE_FILE_MACHINE_AMD64
3131
Characteristics: [ ]
32-
sections:
32+
sections:
3333
- Name: .text
3434
Characteristics: [ ]
3535
Alignment: 4
3636
SectionData: 488B0500000000488B0500000000488B0500000000
37-
Relocations:
37+
Relocations:
3838
- VirtualAddress: 3
3939
SymbolTableIndex: 0
4040
Type: IMAGE_REL_AMD64_REL32
@@ -52,7 +52,7 @@ sections:
5252
Characteristics: [ ]
5353
Alignment: 1
5454
SectionData: '01'
55-
symbols:
55+
symbols:
5656
- Name: .rdata
5757
Value: 0
5858
SectionNumber: 2

llvm/test/tools/yaml2obj/elf-abiversion.yaml renamed to llvm/test/tools/yaml2obj/ELF/abiversion.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
## Check we are able to parse/emit the ABI version with yaml2obj/obj2yaml.
2+
13
# RUN: yaml2obj %s -o %t
24
# RUN: llvm-readobj --file-headers %t | FileCheck %s --check-prefix=FROMYAML
35
# RUN: obj2yaml %t | FileCheck %s --check-prefix=TOYAML
46

5-
## Check we are able to parse/emit the ABI version with yaml2obj/obj2yaml.
6-
77
# FROMYAML: ABIVersion: 5
88
# TOYAML: ABIVersion: 0x05
99

llvm/test/tools/yaml2obj/duplicate-section-names.test renamed to llvm/test/tools/yaml2obj/ELF/duplicate-section-names.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ Sections:
159159
- Name: '.group [1]'
160160
Type: SHT_GROUP
161161
Info: 'foo [1]'
162-
Members:
162+
Members:
163163
- SectionOrType: GRP_COMDAT
164164
- SectionOrType: '.text.foo [1]'
165165
- Name: '.text.foo [1]'

llvm/test/tools/yaml2obj/dynamic-section-raw-content.yaml renamed to llvm/test/tools/yaml2obj/ELF/dynamic-section-raw-content.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Show that yaml2obj can handle a dynamic section with raw content instead of
2-
# entries. Also show that it rejects raw content when entries are also provided.
1+
## Show that yaml2obj can handle a dynamic section with raw content instead of
2+
## entries. Also show that it rejects raw content when entries are also provided.
33

44
# RUN: yaml2obj --docnum=1 %s -o %t1
55
# RUN: llvm-readobj -x .dynamic --sections %t1 | FileCheck %s --check-prefix=RAW

llvm/test/tools/yaml2obj/dynamic-section.yaml renamed to llvm/test/tools/yaml2obj/ELF/dynamic-section.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Ensures that dynamic section has sh_entsize correctly set
1+
## Ensures that dynamic section has sh_entsize correctly set.
2+
23
# RUN: yaml2obj %s -o %t
34
# RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix=SECTION
45

llvm/test/tools/yaml2obj/dynamic-symbols.yaml renamed to llvm/test/tools/yaml2obj/ELF/dynamic-symbols.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ DynamicSymbols:
5151
# NUM-SAME: .data (0x1)
5252

5353
# NUM: Name: bar
54-
# NUM: Section:
54+
# NUM: Section:
5555
# NUM-SAME: .strtab (0x2)
5656

5757
# NUM: Name: zed
5858
# NUM: warning: '[[FILE]]': invalid section index: 255
59-
# NUM: Section:
59+
# NUM: Section:
6060
# NUM-SAME: <?> (0xFF)
6161

6262
--- !ELF
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Ensure yaml2obj doesn't error on empty optional mappings, such as Symbols
2+
# RUN: yaml2obj %s -o /dev/null
3+
4+
!ELF
5+
FileHeader:
6+
Class: ELFCLASS64
7+
Data: ELFDATA2LSB
8+
Type: ET_DYN
9+
Machine: EM_X86_64
10+
## We usually express this as `Symbols: []`, but here we show that the value
11+
## can be omitted.
12+
Symbols:

llvm/test/tools/yaml2obj/linker-options.yaml renamed to llvm/test/tools/yaml2obj/ELF/linker-options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Sections:
8686
# RUN: not yaml2obj %s --docnum=4 2>&1 | FileCheck %s --check-prefix=BOTH
8787

8888
# BOTH: error: "Options" and "Content" can't be used together
89-
89+
9090
--- !ELF
9191
FileHeader:
9292
Class: ELFCLASS64

llvm/test/tools/yaml2obj/local-symbols.yaml renamed to llvm/test/tools/yaml2obj/ELF/local-symbols.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Check we correctly set the sh_info field of .symtab section.
2-
# A symbol table section's sh_info section header member holds
3-
# the symbol table index for the first non-local symbol.
1+
## Check we correctly set the sh_info field of .symtab section.
2+
## A symbol table section's sh_info section header member holds
3+
## the symbol table index for the first non-local symbol.
44

55
# RUN: yaml2obj -docnum=1 %s -o %t
66
# RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix=ONE

llvm/test/tools/yaml2obj/elf-override-shsize.yaml renamed to llvm/test/tools/yaml2obj/ELF/override-shsize.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# RUN: llvm-readelf --sections %t1 | FileCheck %s --check-prefix=CASE1
66

77
# CASE1: Section Headers:
8-
# CASE1-NEXT: [Nr] Name Type Address Off Size
8+
# CASE1-NEXT: [Nr] Name Type Address Off Size
99
# CASE1-NEXT: [ 0] NULL 0000000000000000 000000 000000
1010
# CASE1-NEXT: [ 1] .dynsym DYNSYM 0000000000000000 000040 000001
1111
# CASE1-NEXT: [ 2] .symtab SYMTAB 0000000000000000 000058 000002

llvm/test/tools/yaml2obj/program-header-size-offset.yaml renamed to llvm/test/tools/yaml2obj/ELF/program-header-size-offset.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Show that yaml2obj properly emits program headers with explicit file size,
2-
# memory size and offset parameters.
1+
## Show that yaml2obj properly emits program headers with explicit file size,
2+
## memory size and offset parameters.
33

44
# RUN: yaml2obj %s -o %t
55
# RUN: llvm-readobj %t --program-headers | FileCheck %s

llvm/test/tools/yaml2obj/relocation-explicit-symbol-index.yaml renamed to llvm/test/tools/yaml2obj/ELF/relocation-explicit-symbol-index.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# Test that a relocation's symbol can be an integer.
2-
# RUN: yaml2obj %s > %t
3-
# LLVM tools (both llvm-readobj and llvm-objdump) reject relocations with
4-
# invalid symbol indexes, so inspect the hex contents instead.
1+
## Test that a relocation's symbol can be an integer (symbol index).
2+
3+
# RUN: yaml2obj %s -o %t
4+
## LLVM tools (both llvm-readobj and llvm-objdump) reject relocations with
5+
## invalid symbol indexes, so inspect the hex contents instead.
56
# RUN: llvm-readobj -x .rela.text %t | FileCheck %s
67

78
# CHECK: Hex dump of section '.rela.text':

llvm/test/tools/yaml2obj/invalid-symboless-relocation.yaml renamed to llvm/test/tools/yaml2obj/ELF/relocation-implicit-symbol-index.yaml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
# This test succeeds but produces an invalid relocation. This test
2-
# documents this behavoir.
3-
# RUN: yaml2obj %s > %t
1+
## If "Symbol" is not specified for a relocation, the symbol index is assumed to be 0.
2+
3+
# RUN: yaml2obj %s -o %t
44
# RUN: llvm-readobj -r %t | FileCheck %s
55

6+
# CHECK: Relocations [
7+
# CHECK-NEXT: Section (2) .rel.text {
8+
# CHECK-NEXT: 0x1000 R_X86_64_RELATIVE - 0x0
9+
# CHECK-NEXT: 0x1001 R_X86_64_PC32 - 0x0
10+
# CHECK-NEXT: }
11+
# CHECK-NEXT:]
12+
613
!ELF
714
FileHeader:
815
Class: ELFCLASS64
@@ -19,10 +26,7 @@ Sections:
1926
Info: .text
2027
Relocations:
2128
- Offset: 0x1000
29+
Type: R_X86_64_RELATIVE
30+
## R_X86_64_PC32 should have a non-zero symbol index but we don't error.
31+
- Offset: 0x1001
2232
Type: R_X86_64_PC32
23-
24-
#CHECK: Relocations [
25-
#CHECK-NEXT: Section (2) .rel.text {
26-
#CHECK-NEXT: 0x1000 R_X86_64_PC32 - 0x0
27-
#CHECK-NEXT: }
28-
#CHECK-NEXT:]

llvm/test/tools/yaml2obj/section-ordering.yaml renamed to llvm/test/tools/yaml2obj/ELF/section-ordering.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Ensures that implicitly added sections can be ordered within Sections.
1+
## Ensures that implicitly added sections can be ordered within Sections.
2+
23
# RUN: yaml2obj %s -o %t
34
# RUN: llvm-readobj --sections %t | FileCheck %s
45

llvm/test/tools/yaml2obj/unnamed-section.yaml renamed to llvm/test/tools/yaml2obj/ELF/section-unnamed.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Ensure yaml2obj doesn't crash on unnamed sections
1+
## Check that "Name" defaults to an empty string.
2+
23
# RUN: yaml2obj %s -o %t
34
# RUN: llvm-readobj --sections %t | FileCheck %s
45

llvm/test/tools/yaml2obj/elf-sh-addralign.yaml renamed to llvm/test/tools/yaml2obj/ELF/sh-addralign.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Check that yaml2obj takes in account section AddressAlign field.
22

3-
# RUN: yaml2obj %s > %t
3+
# RUN: yaml2obj %s -o %t
44
# RUN: llvm-readobj -S %t | FileCheck %s
55

66
# CHECK: Section {

llvm/test/tools/yaml2obj/elf-sht-symtab-shndx.yaml renamed to llvm/test/tools/yaml2obj/ELF/sht-symtab-shndx.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Symbols:
2121
Index: SHN_XINDEX
2222

2323
## Check that yaml2obj keeps the SHT_SYMTAB_SHNDX section in the output
24-
## even when symbol's section index value is low enough to not require the extended symtab.
24+
## even when symbol's section index value is low enough to not require the extended symtab.
2525
## Also, check that symbols in .symtab still have the SHN_XINDEX index.
2626

2727
# RUN: yaml2obj --docnum=2 %s -o %t2

llvm/test/tools/yaml2obj/symbol-index-invalid.yaml renamed to llvm/test/tools/yaml2obj/ELF/symbol-index-invalid.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# This test insures that the user cannot have both an Index and a Section field.
1+
## Check that "Index" and "Section" cannot be used together in a symbol.
2+
23
# RUN: not yaml2obj %s
34

45
!ELF

llvm/test/tools/yaml2obj/symbol-index.yaml renamed to llvm/test/tools/yaml2obj/ELF/symbol-index.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# RUN: yaml2obj %s > %t
1+
# RUN: yaml2obj %s -o %t
22
# RUN: llvm-readelf -s %t | FileCheck %s
33

44
!ELF
@@ -21,10 +21,10 @@ Symbols:
2121
Binding: STB_GLOBAL
2222
- Name: common1
2323
Index: SHN_COMMON
24-
Binding: STB_GLOBAL
24+
Binding: STB_GLOBAL
2525
- Name: common2
2626
Index: 0xfff2
27-
Binding: STB_GLOBAL
27+
Binding: STB_GLOBAL
2828
- Name: good
2929
Index: 0x1
3030
Binding: STB_GLOBAL

llvm/test/tools/yaml2obj/symbol-type.yaml renamed to llvm/test/tools/yaml2obj/ELF/symbol-type.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# RUN: yaml2obj %s > %t
1+
# RUN: yaml2obj %s -o %t
22
# RUN: llvm-readobj --symbols %t | FileCheck %s
33

44
# CHECK: Name: notype
@@ -30,7 +30,7 @@ Sections:
3030
Symbols:
3131
- Name: notype
3232
Type: STT_NOTYPE
33-
Binding: STB_GLOBAL
33+
Binding: STB_GLOBAL
3434
- Name: normal_type
3535
Type: STT_OBJECT
3636
Binding: STB_GLOBAL

llvm/test/tools/yaml2obj/elf-symtab-shinfo.yaml renamed to llvm/test/tools/yaml2obj/ELF/symtab-shinfo.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# CHECK-NEXT: Size:
2222
# CHECK-NEXT: Link:
2323
# CHECK-NEXT: Info: 26
24-
24+
2525
--- !ELF
2626
FileHeader:
2727
Class: ELFCLASS64

llvm/test/tools/yaml2obj/verdef-section.yaml renamed to llvm/test/tools/yaml2obj/ELF/verdef-section.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
## Check we are able to handle SHT_GNU_verdef sections.
2+
13
# RUN: yaml2obj %s -o %t
24
# RUN: llvm-readobj -V %t | FileCheck %s
35

4-
# Check we are able to handle the SHT_GNU_verdef sections.
5-
66
# CHECK: VersionDefinitions [
77
# CHECK-NEXT: Definition {
88
# CHECK-NEXT: Version: 1

llvm/test/tools/yaml2obj/verneed-section.yaml renamed to llvm/test/tools/yaml2obj/ELF/verneed-section.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
## Check we are able to handle SHT_GNU_verneed sections.
2+
13
# RUN: yaml2obj %s -o %t
24
# RUN: llvm-readobj -V %t | FileCheck %s
35

4-
# Check we are able to handle the SHT_GNU_verneed sections.
5-
66
# CHECK: VersionRequirements [
77
# CHECK-NEXT: Dependency {
88
# CHECK-NEXT: Version: 1

llvm/test/tools/yaml2obj/versym-section.yaml renamed to llvm/test/tools/yaml2obj/ELF/versym-section.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Sections:
6868
Dependencies:
6969
- Version: 1
7070
File: dso.so.0
71-
Entries:
71+
Entries:
7272
- Name: v1
7373
Hash: 1937
7474
Flags: 0

0 commit comments

Comments
 (0)