[llvm] r363829 - [NFC][llvm-objcopy] Fix overly restrictive od output check

Hubert Tong via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 19 09:04:25 PDT 2019


Author: hubert.reinterpretcast
Date: Wed Jun 19 09:04:24 2019
New Revision: 363829

URL: http://llvm.org/viewvc/llvm-project?rev=363829&view=rev
Log:
[NFC][llvm-objcopy] Fix overly restrictive od output check

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.

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

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test?rev=363829&r1=363828&r2=363829&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test Wed Jun 19 09:04:24 2019
@@ -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
 

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/strip-sections.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/strip-sections.test?rev=363829&r1=363828&r2=363829&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/strip-sections.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/strip-sections.test Wed Jun 19 09:04:24 2019
@@ -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 {




More information about the llvm-commits mailing list