[llvm-branch-commits] [llvm] a5b484c - [obj2yaml][test] - Improve and fix section-group.yaml test.
Georgii Rymar via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jan 11 04:29:39 PST 2021
Author: Georgii Rymar
Date: 2021-01-11T15:24:21+03:00
New Revision: a5b484c4d41a7452b590a2c1c98dc31f43d3dc1a
URL: https://github.com/llvm/llvm-project/commit/a5b484c4d41a7452b590a2c1c98dc31f43d3dc1a
DIFF: https://github.com/llvm/llvm-project/commit/a5b484c4d41a7452b590a2c1c98dc31f43d3dc1a.diff
LOG: [obj2yaml][test] - Improve and fix section-group.yaml test.
It has multiple issues fixed by this patch:
1) It shouldn't test how llvm-readelf/yaml2obj works.
2) It should use "-NEXT" prefix for check lines.
3) It can use YAML macros, that allows to use a single YAML.
4) It should probably test the case when a group member is a null section.
Differential revision: https://reviews.llvm.org/D93753
Added:
Modified:
llvm/test/tools/obj2yaml/ELF/section-group.yaml
Removed:
################################################################################
diff --git a/llvm/test/tools/obj2yaml/ELF/section-group.yaml b/llvm/test/tools/obj2yaml/ELF/section-group.yaml
index aba787ff59ac..33044ceeb36c 100644
--- a/llvm/test/tools/obj2yaml/ELF/section-group.yaml
+++ b/llvm/test/tools/obj2yaml/ELF/section-group.yaml
@@ -1,30 +1,17 @@
## Checks that the tool is able to read section groups from ELF.
-# RUN: yaml2obj --docnum=1 %s -o %t1.o
-# RUN: llvm-readobj --elf-section-groups %t1.o | FileCheck %s -check-prefix=OBJ
-# RUN: obj2yaml %t1.o | FileCheck %s --check-prefix YAML
-
-# OBJ: Groups {
-# OBJ-NEXT: Group {
-# OBJ-NEXT: Name: .group
-# OBJ-NEXT: Index: 1
-# OBJ-NEXT: Link: 3
-# OBJ-NEXT: Info: 1
-# OBJ-NEXT: Type: COMDAT (0x1)
-# OBJ-NEXT: Signature: signature
-# OBJ-NEXT: Section(s) in group [
-# OBJ-NEXT: .rodata (2)
-# OBJ-NEXT: ]
-# OBJ-NEXT: }
-# OBJ-NEXT: }
-
-# YAML: - Name: .group
-# YAML: Type: SHT_GROUP
-# YAML: Link: .symtab
-# YAML: Info: signature
-# YAML: Members:
-# YAML: - SectionOrType: GRP_COMDAT
-# YAML: - SectionOrType: .rodata
+# RUN: yaml2obj %s -o %t1.o
+# RUN: obj2yaml %t1.o | FileCheck %s -DSEC=.rodata
+
+# CHECK: - Name: .group
+# CHECK-NEXT: Type: SHT_GROUP
+# CHECK-NEXT: Link: .symtab
+# CHECK-NEXT: EntSize: 0x4
+# CHECK-NEXT: Info: signature
+# CHECK-NEXT: Members:
+# CHECK-NEXT: - SectionOrType: GRP_COMDAT
+# CHECK-NEXT: - SectionOrType: [[SEC]]
+# CHECK-NEXT: - Name:
--- !ELF
FileHeader:
@@ -35,10 +22,10 @@ Sections:
- Name: .group
Type: SHT_GROUP
Link: .symtab
- Info: signature
+ Info: [[INFO=signature]]
Members:
- SectionOrType: GRP_COMDAT
- - SectionOrType: .rodata
+ - SectionOrType: [[SEC=.rodata]]
- Name: .rodata
Type: SHT_PROGBITS
Symbols:
@@ -46,24 +33,16 @@ Symbols:
Type: STT_OBJECT
Section: .rodata
+## Check we are able to dump members of the SHT_GROUP section even when
+## one of them has section index 0.
+
+# RUN: yaml2obj -DSEC=0 %s -o %tnull.o
+# RUN: obj2yaml %tnull.o | FileCheck %s -DSEC="''"
+
## Check obj2yaml report an error when sh_info field of
## group section contains invalid (too large) signature symbol index.
-# RUN: yaml2obj --docnum=2 %s -o %t2.o
-# RUN: not obj2yaml %t2.o 2>&1 | FileCheck %s --check-prefix ERR
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
-Sections:
- - Name: .group
- Type: SHT_GROUP
- Link: .symtab
- Info: 0xFF
- Members:
- - SectionOrType: GRP_COMDAT
-Symbols: []
+# RUN: yaml2obj -DINFO=0xFF %s -o %t2.o
+# RUN: not obj2yaml %t2.o 2>&1 | FileCheck %s -DFILE=%t2.o --check-prefix=ERR
-# ERR: Error reading file: {{.*}}2.o: unable to get symbol from section [index 2]: invalid symbol index (255)
+# ERR: Error reading file: [[FILE]]: unable to get symbol from section [index 3]: invalid symbol index (255)
More information about the llvm-branch-commits
mailing list