[PATCH] D83481: [yaml2obj] - Refactor header-sh-fields.yaml test.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 13 03:18:50 PDT 2020
grimar updated this revision to Diff 277371.
grimar marked an inline comment as done.
grimar added a comment.
- Addressed review comment.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83481/new/
https://reviews.llvm.org/D83481
Files:
llvm/test/tools/yaml2obj/ELF/header-sh-fields.yaml
Index: llvm/test/tools/yaml2obj/ELF/header-sh-fields.yaml
===================================================================
--- llvm/test/tools/yaml2obj/ELF/header-sh-fields.yaml
+++ llvm/test/tools/yaml2obj/ELF/header-sh-fields.yaml
@@ -3,8 +3,8 @@
## First we check the default values.
-# RUN: yaml2obj --docnum=1 %s -o %t1
-# RUN: llvm-readelf --file-headers %t1 | FileCheck %s --check-prefix=DEFAULT
+# RUN: yaml2obj %s -o %t-default
+# RUN: llvm-readelf --file-headers %t-default | FileCheck %s --check-prefix=DEFAULT
# DEFAULT: Start of section headers: 88 (bytes into file)
# DEFAULT: Size of section headers: 64 (bytes)
@@ -18,15 +18,10 @@
Type: ET_REL
Machine: EM_X86_64
-## Override 3 fields: e_shoff, e_shnum and e_shstrndx. Check the output.
-
-# RUN: yaml2obj --docnum=2 %s -o %t2
-# RUN: llvm-readelf --file-headers %t2 | FileCheck %s --check-prefix=CUSTOM
-
-# CUSTOM: Start of section headers: 2 (bytes into file)
-# CUSTOM: Size of section headers: 64 (bytes)
-# CUSTOM: Number of section headers: 3
-# CUSTOM: Section header string table index: 4
+## Check we can override all default values using the same values
+## and this does not change the output.
+# RUN: yaml2obj --docnum=2 %s -o %t-default-override
+# RUN: cmp %t-default %t-default-override
--- !ELF
FileHeader:
@@ -34,28 +29,37 @@
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
- SHEntSize: 64
- SHOff: 2
- SHNum: 3
- SHStrNdx: 4
+ SHEntSize: [[SHENTSIZE=64]]
+ SHOff: [[SHOFF=88]]
+ SHNum: [[SHNUM=3]]
+ SHStrNdx: [[SHSTRNDX=2]]
+
+## Override different fields to check the output produced.
+
+## Override the e_shoff field.
+# RUN: yaml2obj --docnum=2 %s -DSHOFF=3 -o %t2
+# RUN: llvm-readelf --file-headers %t2 | FileCheck %s --check-prefix=SHOFF
+
+# SHOFF: Start of section headers: 3 (bytes into file)
+
+## Override the e_shnum field.
+# RUN: yaml2obj --docnum=2 %s -DSHNUM=2 -o %t3
+# RUN: llvm-readelf --file-headers %t3 | FileCheck %s --check-prefix=SHNUM
+
+# SHNUM: Number of section headers: 2{{$}}
+
+## Override the e_shstrndx field.
+# RUN: yaml2obj --docnum=2 %s -DSHSTRNDX=4 -o %t4
+# RUN: llvm-readelf --file-headers %t4 | FileCheck %s --check-prefix=SHSTRNDX
-## Finally, we use the same YAML as above, but set e_shentsize to 1.
+# SHSTRNDX: Section header string table index: 4{{$}}
+
+## Override the e_shentsize field.
## Check the result using raw output from 'od' because llvm-readelf
## is unable to dump such headers.
-# RUN: yaml2obj --docnum=3 %s -o %t3
-# RUN: od -A n -t x1 -v -j 0x3a -N 1 %t3 | FileCheck %s --check-prefix=NEWSIZE
-# RUN: od -A n -t x1 -v -j 0x3a -N 1 %t2 | FileCheck %s --check-prefix=OLDSIZE
+# RUN: yaml2obj --docnum=2 %s -DSHENTSIZE=1 -o %t5
+# RUN: od -A n -t x1 -v -j 0x3a -N 1 %t5 | FileCheck %s --check-prefix=NEWSIZE
+# RUN: od -A n -t x1 -v -j 0x3a -N 1 %t-default | FileCheck %s --check-prefix=OLDSIZE
# NEWSIZE: 01
# OLDSIZE: 40
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_X86_64
- SHEntSize: 1
- SHOff: 2
- SHNum: 3
- SHStrNdx: 4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83481.277371.patch
Type: text/x-patch
Size: 3189 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200713/56ac7917/attachment.bin>
More information about the llvm-commits
mailing list