]> granicus.if.org Git - llvm/commitdiff
[NFC][llvm-objcopy] Fix overly restrictive od output check
authorHubert Tong <hubert.reinterpretcast@gmail.com>
Wed, 19 Jun 2019 16:04:24 +0000 (16:04 +0000)
committerHubert Tong <hubert.reinterpretcast@gmail.com>
Wed, 19 Jun 2019 16:04:24 +0000 (16:04 +0000)
The check against the output of `od` in the affected tests expect a
specific input offset format. They also expect a specific offset value,
not consistent with the EXAMPLE section for `od` in POSIX.1-2017
Chapter 4, while using the `-j` option. In particular, the example shows
that the input offset begins at 0 following the bytes skipped.

This patch adjusts the matching of the input offset to be more generic.
In order to avoid false matches, it restricts the number of bytes to be
formatted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363829 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-objcopy/ELF/segment-test-remove-section.test
test/tools/llvm-objcopy/ELF/strip-sections.test

index 49a9003cb15e40f234ab24061679068b2eddce6c..f9a5dd7811e70de43a3a0935e39458e22dd85f34 100644 (file)
@@ -7,7 +7,7 @@
 # RUN: yaml2obj %s -o %t
 # RUN: llvm-objcopy -R .text2 %t %t2
 # RUN: llvm-readobj --file-headers --program-headers --sections %t2 | FileCheck %s
-# RUN: od -t x1 -j 8192 %t2 | FileCheck %s --check-prefix=DATA
+# RUN: od -t x1 -j 8192 -N 4 %t2 | FileCheck %s --check-prefix=DATA
 
 !ELF
 FileHeader:
@@ -44,7 +44,7 @@ ProgramHeaders:
       - Section: .text3
 
 # Make sure that when we remove a section we overwrite it with zeros
-# DATA: 0020000 00 00 00 00
+# DATA: {{^[^[:blank:]]+}} 00 00 00 00
 
 #CHECK: SectionHeaderCount: 6
 
index 413cff4463958b78c3f2a2201d777f6e0ff17109..492a08215213877b29058f74b0af18eea74c90db 100644 (file)
@@ -1,12 +1,12 @@
 # RUN: yaml2obj %s > %t
 # RUN: llvm-objcopy --strip-sections %t %t2
 # RUN: llvm-readobj --file-headers --program-headers %t2 | FileCheck %s
-# RUN: od -t x1 -j 4096 %t2 | FileCheck %s --check-prefix=DATA
+# RUN: od -t x1 -j 4096 -N 12 %t2 | FileCheck %s --check-prefix=DATA
 
 ## Sanity check the DATA-NOT line by showing that "fe ed fa ce" appears
 ## if --strip-sections is not specified.
 # RUN: llvm-objcopy %t %t3
-# RUN: od -t x1 -j 4096 %t3 | FileCheck %s --check-prefix=VALIDATE
+# RUN: od -t x1 -j 4096 -N 12 %t3 | FileCheck %s --check-prefix=VALIDATE
 
 !ELF
 FileHeader:
@@ -35,10 +35,10 @@ ProgramHeaders:
     - Section: .text
     - Section: .non_alloc_in_segment
 
-# DATA: 0010000 de ad be ef ca fe ba be
+# DATA: {{^[^[:blank:]]+}} de ad be ef ca fe ba be
 # DATA-NOT: fe ed fa ce
 
-# VALIDATE: 0010000 de ad be ef ca fe ba be fe ed fa ce
+# VALIDATE: {{^[^[:blank:]]+}} de ad be ef ca fe ba be fe ed fa ce
 
 # CHECK:      ElfHeader {
 # CHECK-NEXT:   Ident {