From: Hubert Tong Date: Wed, 19 Jun 2019 16:04:24 +0000 (+0000) Subject: [NFC][llvm-objcopy] Fix overly restrictive od output check X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=979d3402950ac85be106de454e859cec2b07dd21;p=llvm [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363829 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test b/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test index 49a9003cb15..f9a5dd7811e 100644 --- a/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test +++ b/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test @@ -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 diff --git a/test/tools/llvm-objcopy/ELF/strip-sections.test b/test/tools/llvm-objcopy/ELF/strip-sections.test index 413cff44639..492a0821521 100644 --- a/test/tools/llvm-objcopy/ELF/strip-sections.test +++ b/test/tools/llvm-objcopy/ELF/strip-sections.test @@ -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 {