[llvm] fd9fd4f - [llvm-objdump][test] Improve address test
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 2 10:50:00 PDT 2022
Author: Fangrui Song
Date: 2022-10-02T10:49:52-07:00
New Revision: fd9fd4fa087176c0e1882b136da4dd95cb5252ab
URL: https://github.com/llvm/llvm-project/commit/fd9fd4fa087176c0e1882b136da4dd95cb5252ab
DIFF: https://github.com/llvm/llvm-project/commit/fd9fd4fa087176c0e1882b136da4dd95cb5252ab.diff
LOG: [llvm-objdump][test] Improve address test
Added:
Modified:
llvm/test/tools/llvm-objdump/X86/disassemble-data.test
llvm/test/tools/llvm-objdump/X86/print-symbol-addr.s
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-objdump/X86/disassemble-data.test b/llvm/test/tools/llvm-objdump/X86/disassemble-data.test
index e9c4e7e1e5f2d..7e96185383a22 100644
--- a/llvm/test/tools/llvm-objdump/X86/disassemble-data.test
+++ b/llvm/test/tools/llvm-objdump/X86/disassemble-data.test
@@ -1,4 +1,8 @@
-// This test checks that -D disassembles from a data section
-// RUN: llvm-objdump -D %p/Inputs/disassemble-data.obj | FileCheck %s
+# This test checks that -D disassembles from a data section.
+# RUN: llvm-objdump -D %p/Inputs/disassemble-data.obj | FileCheck %s --match-full-lines --strict-whitespace
-// CHECK: Disassembly of section .data:
\ No newline at end of file
+# CHECK:Disassembly of section .data:
+#CHECK-EMPTY:
+# CHECK:00000000 <.data>:
+# CHECK-NEXT: 0: 00 00{{ +}} addb %al, (%eax)
+# CHECK-NOT:{{.}}
diff --git a/llvm/test/tools/llvm-objdump/X86/print-symbol-addr.s b/llvm/test/tools/llvm-objdump/X86/print-symbol-addr.s
index 6b233be632945..95023f35918fc 100644
--- a/llvm/test/tools/llvm-objdump/X86/print-symbol-addr.s
+++ b/llvm/test/tools/llvm-objdump/X86/print-symbol-addr.s
@@ -2,24 +2,35 @@
# RUN: llvm-mc %s -filetype=obj -triple=x86_64 -o %t.64.o
## Check we print the address of `foo` and `bar`.
-# RUN: llvm-objdump -d %t.32.o | FileCheck --check-prefixes=ADDR32,ADDR %s
-# RUN: llvm-objdump -d %t.64.o | FileCheck --check-prefixes=ADDR64,ADDR %s
-# ADDR32: 00000000 <foo>:
-# ADDR64: 0000000000000000 <foo>:
-# ADDR-NEXT: 0: {{.*}} nop
-# ADDR-NEXT: 1: {{.*}} nop
-# ADDR32: 00000002 <bar>:
-# ADDR64: 0000000000000002 <bar>:
-# ADDR-NEXT: 2: {{.*}} nop
+# RUN: llvm-objdump -D %t.32.o | FileCheck --check-prefixes=ADDR32,ADDR %s --match-full-lines --strict-whitespace
+# RUN: llvm-objdump -D %t.64.o | FileCheck --check-prefixes=ADDR64,ADDR %s --match-full-lines --strict-whitespace
+# ADDR32:00000000 <foo>:
+# ADDR64:0000000000000000 <foo>:
+# ADDR-NEXT: 0: 90{{ +}} nop
+# ADDR-NEXT: 1: 90{{ +}} nop
+#ADDR-EMPTY:
+# ADDR32:00000002 <bar>:
+# ADDR64:0000000000000002 <bar>:
+# ADDR-NEXT: 2: 90{{ +}} nop
+# ADDR:Disassembly of section .data:
+#ADDR-EMPTY:
+# ADDR32:00000000 <.data>:
+# ADDR64:0000000000000000 <.data>:
+# ADDR-NEXT: 0: 01 00{{ +}} addl %eax, (%{{[er]}}ax)
+#ADDR-EMPTY:
## Check we do not print the addresses with --no-leading-addr.
-# RUN: llvm-objdump -d --no-leading-addr %t.32.o | FileCheck %s --check-prefix=NOADDR
-# RUN: llvm-objdump -d --no-leading-addr %t.64.o | FileCheck %s --check-prefix=NOADDR
-# NOADDR: <foo>:
-# NOADDR-NEXT: {{.*}} nop
-# NOADDR-NEXT: {{.*}} nop
-# NOADDR: <bar>:
-# NOADDR-NEXT: {{.*}} nop
+# RUN: llvm-objdump -d --no-leading-addr %t.32.o > %t.32.txt
+# RUN: llvm-objdump -d --no-leading-addr %t.64.o > %t.64.txt
+# RUN: FileCheck --input-file=%t.32.txt %s --check-prefix=NOADDR --match-full-lines --strict-whitespace
+# RUN: FileCheck --input-file=%t.64.txt %s --check-prefix=NOADDR --match-full-lines --strict-whitespace
+
+# NOADDR:<foo>:
+# NOADDR-NEXT: 90{{ +}} nop
+# NOADDR-NEXT: 90{{ +}} nop
+#NOADDR-EMPTY:
+# NOADDR:<bar>:
+# NOADDR-NEXT: 90{{ +}} nop
.text
.globl foo
@@ -30,3 +41,6 @@ foo:
bar:
nop
+
+.data
+ .word 1
More information about the llvm-commits
mailing list