From 1f6ddfb6a359e8459d2fae8d7a908de03a727c05 Mon Sep 17 00:00:00 2001 From: Hubert Tong Date: Wed, 19 Jun 2019 16:04:24 +0000 Subject: [PATCH] [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. llvm-svn: 363829 --- llvm/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test | 4 ++-- llvm/test/tools/llvm-objcopy/ELF/strip-sections.test | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/llvm/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test b/llvm/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test index 49a9003..f9a5dd7 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test +++ b/llvm/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/llvm/test/tools/llvm-objcopy/ELF/strip-sections.test b/llvm/test/tools/llvm-objcopy/ELF/strip-sections.test index 413cff4..492a082 100644 --- a/llvm/test/tools/llvm-objcopy/ELF/strip-sections.test +++ b/llvm/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 { -- 2.7.4