[llvm-branch-commits] [llvm] ade2fbb - [llvm-readobj][test] - Merge 2 test cases together.

Georgii Rymar via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Dec 1 01:57:02 PST 2020


Author: Georgii Rymar
Date: 2020-12-01T12:51:07+03:00
New Revision: ade2fbbfb09c03ed665271247542774ecd540344

URL: https://github.com/llvm/llvm-project/commit/ade2fbbfb09c03ed665271247542774ecd540344
DIFF: https://github.com/llvm/llvm-project/commit/ade2fbbfb09c03ed665271247542774ecd540344.diff

LOG: [llvm-readobj][test] - Merge 2 test cases together.

This merges `invalid-attr-section-size.test` and `invalid-attr-version.test`
into `invalid-attributes-sec.test`.

This allows to have a single place where other related test cases can be added.

Differential revision: https://reviews.llvm.org/D92316

Added: 
    llvm/test/tools/llvm-readobj/ELF/RISCV/attributes-invalid.test

Modified: 
    

Removed: 
    llvm/test/tools/llvm-readobj/ELF/RISCV/invalid-attr-section-size.test
    llvm/test/tools/llvm-readobj/ELF/RISCV/invalid-attr-version.test


################################################################################
diff  --git a/llvm/test/tools/llvm-readobj/ELF/RISCV/attributes-invalid.test b/llvm/test/tools/llvm-readobj/ELF/RISCV/attributes-invalid.test
new file mode 100644
index 000000000000..547ed93bcd10
--- /dev/null
+++ b/llvm/test/tools/llvm-readobj/ELF/RISCV/attributes-invalid.test
@@ -0,0 +1,32 @@
+## Check how we dump invalid SHT_RISCV_ATTRIBUTES sections.
+
+## This test case is used to ensure llvm-readobj checks the version of
+## attribute sections correctly. The only supported format is 'A' (41),
+## here we use 'B' (42).
+
+# RUN: yaml2obj %s -D BITS=32 -DCONTENT=42 -o %t1.32.o
+# RUN: llvm-readobj -A %t1.32.o 2>&1 | FileCheck -DFILE=%t1 %s --check-prefix=ERR-FORMAT
+# RUN: yaml2obj %s -D BITS=64 -DCONTENT=42 -o %t1.64.o
+# RUN: llvm-readobj -A %t1.64.o 2>&1 | FileCheck -DFILE=%t1 %s --check-prefix=ERR-FORMAT
+
+# ERR-FORMAT: warning: '[[FILE]].{{32|64}}.o': unrecognised FormatVersion: 0x42
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS[[BITS=64]]
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_RISCV
+Sections:
+  - Name:    .riscv.attributes
+    Type:    SHT_RISCV_ATTRIBUTES
+    Content: [[CONTENT]]
+
+## Check we report a warning when we are unable to parse the attribute section data.
+
+# RUN: yaml2obj %s -D BITS=32 -DCONTENT=4100000000 -o %t2.32.o
+# RUN: llvm-readobj -A %t2.32.o 2>&1 | FileCheck -DFILE=%t2 %s --check-prefix=ERR-LENGTH
+# RUN: yaml2obj %s -D BITS=64 -DCONTENT=4100000000 -o %t2.64.o
+# RUN: llvm-readobj -A %t2.64.o 2>&1 | FileCheck -DFILE=%t2 %s --check-prefix=ERR-LENGTH
+
+# ERR-LENGTH: warning: '[[FILE]].{{32|64}}.o': invalid section length 0 at offset 0x1

diff  --git a/llvm/test/tools/llvm-readobj/ELF/RISCV/invalid-attr-section-size.test b/llvm/test/tools/llvm-readobj/ELF/RISCV/invalid-attr-section-size.test
deleted file mode 100644
index 524134e1579b..000000000000
--- a/llvm/test/tools/llvm-readobj/ELF/RISCV/invalid-attr-section-size.test
+++ /dev/null
@@ -1,20 +0,0 @@
-## This test case is used to ensure the error code is caught by llvm-readobj.
-
-# RUN: yaml2obj %s -D BITS=32 -o %t.32.o
-# RUN: llvm-readobj -A %t.32.o 2>&1 | FileCheck -DFILE=%t %s
-# RUN: yaml2obj %s -D BITS=64 -o %t.64.o
-# RUN: llvm-readobj -A %t.64.o 2>&1 | FileCheck -DFILE=%t %s
-
-# CHECK: warning: '[[FILE]].{{32|64}}.o': invalid section length 0 at offset 0x1
-
---- !ELF
-FileHeader:
-  Class:   ELFCLASS[[BITS]]
-  Data:    ELFDATA2LSB
-  Type:    ET_REL
-  Machine: EM_RISCV
-Sections:
-  - Name:    .riscv.attributes
-    Type:    SHT_RISCV_ATTRIBUTES
-## Version: 'A'(0x41), section length: 0
-    Content: 4100000000

diff  --git a/llvm/test/tools/llvm-readobj/ELF/RISCV/invalid-attr-version.test b/llvm/test/tools/llvm-readobj/ELF/RISCV/invalid-attr-version.test
deleted file mode 100644
index 9a4d81bcc4f1..000000000000
--- a/llvm/test/tools/llvm-readobj/ELF/RISCV/invalid-attr-version.test
+++ /dev/null
@@ -1,21 +0,0 @@
-## This test case is used to ensure llvm-readobj checks the version of
-## attribute sections correctly.
-
-# RUN: yaml2obj %s -D BITS=32 -o %t.32.o
-# RUN: llvm-readobj -A %t.32.o 2>&1 | FileCheck -DFILE=%t %s
-# RUN: yaml2obj %s -D BITS=64 -o %t.64.o
-# RUN: llvm-readobj -A %t.64.o 2>&1 | FileCheck -DFILE=%t %s
-
-# CHECK: warning: '[[FILE]].{{32|64}}.o': unrecognised FormatVersion: 0x42
-
---- !ELF
-FileHeader:
-  Class:   ELFCLASS[[BITS]]
-  Data:    ELFDATA2LSB
-  Type:    ET_REL
-  Machine: EM_RISCV
-Sections:
-  - Name:    .riscv.attributes
-    Type:    SHT_RISCV_ATTRIBUTES
-## Version: 'B'
-    Content: 42


        


More information about the llvm-branch-commits mailing list