Skip to content

Commit 1f6ddfb

Browse files
committedJun 19, 2019
[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
1 parent e9983ee commit 1f6ddfb

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed
 

‎llvm/test/tools/llvm-objcopy/ELF/segment-test-remove-section.test

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# RUN: yaml2obj %s -o %t
88
# RUN: llvm-objcopy -R .text2 %t %t2
99
# RUN: llvm-readobj --file-headers --program-headers --sections %t2 | FileCheck %s
10-
# RUN: od -t x1 -j 8192 %t2 | FileCheck %s --check-prefix=DATA
10+
# RUN: od -t x1 -j 8192 -N 4 %t2 | FileCheck %s --check-prefix=DATA
1111

1212
!ELF
1313
FileHeader:
@@ -44,7 +44,7 @@ ProgramHeaders:
4444
- Section: .text3
4545

4646
# Make sure that when we remove a section we overwrite it with zeros
47-
# DATA: 0020000 00 00 00 00
47+
# DATA: {{^[^[:blank:]]+}} 00 00 00 00
4848

4949
#CHECK: SectionHeaderCount: 6
5050

‎llvm/test/tools/llvm-objcopy/ELF/strip-sections.test

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# RUN: yaml2obj %s > %t
22
# RUN: llvm-objcopy --strip-sections %t %t2
33
# RUN: llvm-readobj --file-headers --program-headers %t2 | FileCheck %s
4-
# RUN: od -t x1 -j 4096 %t2 | FileCheck %s --check-prefix=DATA
4+
# RUN: od -t x1 -j 4096 -N 12 %t2 | FileCheck %s --check-prefix=DATA
55

66
## Sanity check the DATA-NOT line by showing that "fe ed fa ce" appears
77
## if --strip-sections is not specified.
88
# RUN: llvm-objcopy %t %t3
9-
# RUN: od -t x1 -j 4096 %t3 | FileCheck %s --check-prefix=VALIDATE
9+
# RUN: od -t x1 -j 4096 -N 12 %t3 | FileCheck %s --check-prefix=VALIDATE
1010

1111
!ELF
1212
FileHeader:
@@ -35,10 +35,10 @@ ProgramHeaders:
3535
- Section: .text
3636
- Section: .non_alloc_in_segment
3737

38-
# DATA: 0010000 de ad be ef ca fe ba be
38+
# DATA: {{^[^[:blank:]]+}} de ad be ef ca fe ba be
3939
# DATA-NOT: fe ed fa ce
4040

41-
# VALIDATE: 0010000 de ad be ef ca fe ba be fe ed fa ce
41+
# VALIDATE: {{^[^[:blank:]]+}} de ad be ef ca fe ba be fe ed fa ce
4242

4343
# CHECK: ElfHeader {
4444
# CHECK-NEXT: Ident {

0 commit comments

Comments
 (0)
Please sign in to comment.