Skip to content

Commit 2439bc4

Browse files
[llvm-objcopy] Fix gap-fill/pad-to tests (#75631)
The tests added in PR #65815 fail on Apple buildbot because the `od` printed addresses have a different number of leading zeroes. Mask leading zeroes with a regex. To support the `od` output format on z/OS, add `--ignore-case` to FileCheck.
1 parent 21edad7 commit 2439bc4

File tree

2 files changed

+66
-66
lines changed

2 files changed

+66
-66
lines changed

llvm/test/tools/llvm-objcopy/ELF/gap-fill.test

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -23,66 +23,66 @@
2323

2424
## Test no gap fill with all allocatable output sections.
2525
# RUN: llvm-objcopy -O binary %t %t-default
26-
# RUN: od -v -Ax -t x1 %t-default | FileCheck %s --check-prefix=DEFAULT --match-full-lines
27-
# DEFAULT: 000000 ee ff 11 22 33 44 aa bb cc dd fe dc ba 00 a1 b2
28-
# DEFAULT-NEXT: 000010 c3 d4 00 00 00 00 00 00 00 00 00 00 00 00 00 00
29-
# DEFAULT-NEXT: 000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
30-
# DEFAULT-NEXT: 000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
31-
# DEFAULT-NEXT: 000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
32-
# DEFAULT-NEXT: 000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
33-
# DEFAULT-NEXT: 000060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
34-
# DEFAULT-NEXT: 000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
35-
# DEFAULT-NEXT: 000080 00 00 89 ab cd ef
36-
# DEFAULT-NEXT: 000086
26+
# RUN: od -v -Ax -t x1 %t-default | FileCheck %s --check-prefix=DEFAULT --ignore-case --match-full-lines
27+
# DEFAULT: {{0*}}00 ee ff 11 22 33 44 aa bb cc dd fe dc ba 00 a1 b2
28+
# DEFAULT-NEXT: {{0*}}10 c3 d4 00 00 00 00 00 00 00 00 00 00 00 00 00 00
29+
# DEFAULT-NEXT: {{0*}}20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
30+
# DEFAULT-NEXT: {{0*}}30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
31+
# DEFAULT-NEXT: {{0*}}40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
32+
# DEFAULT-NEXT: {{0*}}50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
33+
# DEFAULT-NEXT: {{0*}}60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
34+
# DEFAULT-NEXT: {{0*}}70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
35+
# DEFAULT-NEXT: {{0*}}80 00 00 89 ab cd ef
36+
# DEFAULT-NEXT: {{0*}}86
3737

3838
## Test gap fill with all allocatable output sections.
3939
# RUN: llvm-objcopy -O binary --gap-fill=0xe9 %t %t-filled
40-
# RUN: od -v -Ax -t x1 %t-filled | FileCheck %s --check-prefix=FULL --match-full-lines
41-
# FULL: 000000 ee ff 11 22 33 44 aa bb cc dd fe dc ba e9 a1 b2
42-
# FULL-NEXT: 000010 c3 d4 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
43-
# FULL-NEXT: 000020 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
44-
# FULL-NEXT: 000030 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
45-
# FULL-NEXT: 000040 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
46-
# FULL-NEXT: 000050 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
47-
# FULL-NEXT: 000060 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
48-
# FULL-NEXT: 000070 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
49-
# FULL-NEXT: 000080 e9 e9 89 ab cd ef
50-
# FULL-NEXT: 000086
40+
# RUN: od -v -Ax -t x1 %t-filled | FileCheck %s --check-prefix=FULL --ignore-case --match-full-lines
41+
# FULL: {{0*}}00 ee ff 11 22 33 44 aa bb cc dd fe dc ba e9 a1 b2
42+
# FULL-NEXT: {{0*}}10 c3 d4 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
43+
# FULL-NEXT: {{0*}}20 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
44+
# FULL-NEXT: {{0*}}30 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
45+
# FULL-NEXT: {{0*}}40 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
46+
# FULL-NEXT: {{0*}}50 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
47+
# FULL-NEXT: {{0*}}60 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
48+
# FULL-NEXT: {{0*}}70 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
49+
# FULL-NEXT: {{0*}}80 e9 e9 89 ab cd ef
50+
# FULL-NEXT: {{0*}}86
5151

5252
## Test gap fill with a decimal value.
5353
# RUN: llvm-objcopy -O binary --gap-fill=99 %t %t-filled-decimal
54-
# RUN: od -v -Ax -t x1 %t-filled-decimal | FileCheck %s --check-prefix=DEC --match-full-lines
55-
# DEC: 000000 ee ff 11 22 33 44 aa bb cc dd fe dc ba 63 a1 b2
56-
# DEC-NEXT: 000010 c3 d4 63 63 63 63 63 63 63 63 63 63 63 63 63 63
57-
# DEC-NEXT: 000020 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63
58-
# DEC-NEXT: 000030 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63
59-
# DEC-NEXT: 000040 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63
60-
# DEC-NEXT: 000050 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63
61-
# DEC-NEXT: 000060 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63
62-
# DEC-NEXT: 000070 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63
63-
# DEC-NEXT: 000080 63 63 89 ab cd ef
64-
# DEC-NEXT: 000086
54+
# RUN: od -v -Ax -t x1 %t-filled-decimal | FileCheck %s --check-prefix=DEC --ignore-case --match-full-lines
55+
# DEC: {{0*}}00 ee ff 11 22 33 44 aa bb cc dd fe dc ba 63 a1 b2
56+
# DEC-NEXT: {{0*}}10 c3 d4 63 63 63 63 63 63 63 63 63 63 63 63 63 63
57+
# DEC-NEXT: {{0*}}20 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63
58+
# DEC-NEXT: {{0*}}30 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63
59+
# DEC-NEXT: {{0*}}40 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63
60+
# DEC-NEXT: {{0*}}50 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63
61+
# DEC-NEXT: {{0*}}60 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63
62+
# DEC-NEXT: {{0*}}70 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63
63+
# DEC-NEXT: {{0*}}80 63 63 89 ab cd ef
64+
# DEC-NEXT: {{0*}}86
6565

6666
## Test gap fill with the last section removed, should be truncated.
6767
# RUN: llvm-objcopy -O binary --gap-fill=0xe9 --remove-section=.foo %t %t-filled
68-
# RUN: od -v -Ax -t x1 %t-filled | FileCheck %s --check-prefix=REMOVE-LAST-SECTION --match-full-lines
69-
# REMOVE-LAST-SECTION: 000000 ee ff 11 22 33 44 aa bb cc dd fe dc ba e9 a1 b2
70-
# REMOVE-LAST-SECTION-NEXT: 000010 c3 d4
71-
# REMOVE-LAST-SECTION-NEXT: 000012
68+
# RUN: od -v -Ax -t x1 %t-filled | FileCheck %s --check-prefix=REMOVE-LAST-SECTION --ignore-case --match-full-lines
69+
# REMOVE-LAST-SECTION: {{0*}}00 ee ff 11 22 33 44 aa bb cc dd fe dc ba e9 a1 b2
70+
# REMOVE-LAST-SECTION-NEXT: {{0*}}10 c3 d4
71+
# REMOVE-LAST-SECTION-NEXT: {{0*}}12
7272

7373
## Test gap fill with the middle section removed, should be filled.
7474
# RUN: llvm-objcopy -O binary --gap-fill=0xe9 --remove-section=.gap2 %t %t-filled
75-
# RUN: od -v -Ax -t x1 %t-filled | FileCheck %s --check-prefix=REMOVE-MIDDLE-SECTION --match-full-lines
76-
# REMOVE-MIDDLE-SECTION: 000000 ee ff 11 22 33 44 aa bb cc dd fe dc ba e9 e9 e9
77-
# REMOVE-MIDDLE-SECTION-NEXT: 000010 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
78-
# REMOVE-MIDDLE-SECTION-NEXT: 000020 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
79-
# REMOVE-MIDDLE-SECTION-NEXT: 000030 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
80-
# REMOVE-MIDDLE-SECTION-NEXT: 000040 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
81-
# REMOVE-MIDDLE-SECTION-NEXT: 000050 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
82-
# REMOVE-MIDDLE-SECTION-NEXT: 000060 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
83-
# REMOVE-MIDDLE-SECTION-NEXT: 000070 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
84-
# REMOVE-MIDDLE-SECTION-NEXT: 000080 e9 e9 89 ab cd ef
85-
# REMOVE-MIDDLE-SECTION-NEXT: 000086
75+
# RUN: od -v -Ax -t x1 %t-filled | FileCheck %s --check-prefix=REMOVE-MIDDLE-SECTION --ignore-case --match-full-lines
76+
# REMOVE-MIDDLE-SECTION: {{0*}}00 ee ff 11 22 33 44 aa bb cc dd fe dc ba e9 e9 e9
77+
# REMOVE-MIDDLE-SECTION-NEXT: {{0*}}10 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
78+
# REMOVE-MIDDLE-SECTION-NEXT: {{0*}}20 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
79+
# REMOVE-MIDDLE-SECTION-NEXT: {{0*}}30 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
80+
# REMOVE-MIDDLE-SECTION-NEXT: {{0*}}40 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
81+
# REMOVE-MIDDLE-SECTION-NEXT: {{0*}}50 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
82+
# REMOVE-MIDDLE-SECTION-NEXT: {{0*}}60 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
83+
# REMOVE-MIDDLE-SECTION-NEXT: {{0*}}70 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
84+
# REMOVE-MIDDLE-SECTION-NEXT: {{0*}}80 e9 e9 89 ab cd ef
85+
# REMOVE-MIDDLE-SECTION-NEXT: {{0*}}86
8686

8787
--- !ELF
8888
FileHeader:
@@ -149,8 +149,8 @@ Sections:
149149

150150
# RUN: yaml2obj --docnum=2 %s -o %t.2
151151
# RUN: llvm-objcopy -O binary --gap-fill=0xe9 %t.2 %t.2.filled
152-
# RUN: od -v -Ax -t x1 %t.2.filled | FileCheck --match-full-lines %s
153-
# CHECK: 000000 aa bb cc dd e9 e9 e9 e9 11 22 33 44
152+
# RUN: od -v -Ax -t x1 %t.2.filled | FileCheck --ignore-case --match-full-lines %s
153+
# CHECK: {{0*}}00 aa bb cc dd e9 e9 e9 e9 11 22 33 44
154154

155155
--- !ELF
156156
FileHeader:

llvm/test/tools/llvm-objcopy/ELF/pad-to.test

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,31 @@
2929

3030
## Pad all allocatable sections to a valid address.
3131
# RUN: llvm-objcopy -O binary --pad-to=0x218 %t %t-pad-default
32-
# RUN: od -v -Ax -t x1 %t-pad-default | FileCheck %s --check-prefix=DEFAULT --match-full-lines
33-
# DEFAULT: 000000 11 22 33 44 55 66 00 00 00 00 00 00 00 00 00 00
34-
# DEFAULT-NEXT: 000010 77 88 99 aa 00 00 00 00
35-
# DEFAULT-NEXT: 000018
32+
# RUN: od -v -Ax -t x1 %t-pad-default | FileCheck %s --check-prefix=DEFAULT --ignore-case --match-full-lines
33+
# DEFAULT: {{0*}}00 11 22 33 44 55 66 00 00 00 00 00 00 00 00 00 00
34+
# DEFAULT-NEXT: {{0*}}10 77 88 99 aa 00 00 00 00
35+
# DEFAULT-NEXT: {{0*}}18
3636

3737
## Use a decimal number for the padding address and verify it is not misunderstood.
3838
# RUN: llvm-objcopy -O binary --pad-to=536 %t %t-pad-decimal
39-
# RUN: od -v -Ax -t x1 %t-pad-decimal | FileCheck %s --check-prefix=DECIMAL --match-full-lines
40-
# DECIMAL: 000000 11 22 33 44 55 66 00 00 00 00 00 00 00 00 00 00
41-
# DECIMAL-NEXT: 000010 77 88 99 aa 00 00 00 00
42-
# DECIMAL-NEXT: 000018
39+
# RUN: od -v -Ax -t x1 %t-pad-decimal | FileCheck %s --check-prefix=DECIMAL --ignore-case --match-full-lines
40+
# DECIMAL: {{0*}}00 11 22 33 44 55 66 00 00 00 00 00 00 00 00 00 00
41+
# DECIMAL-NEXT: {{0*}}10 77 88 99 aa 00 00 00 00
42+
# DECIMAL-NEXT: {{0*}}18
4343

4444
## Pad all allocatable sections to a valid address, using --gap-fill.
4545
# RUN: llvm-objcopy -O binary --pad-to=0x218 --gap-fill=0xe9 %t %t-pad-fill
46-
# RUN: od -v -Ax -t x1 %t-pad-fill | FileCheck %s --check-prefix=FILL --match-full-lines
47-
# FILL: 000000 11 22 33 44 55 66 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
48-
# FILL-NEXT: 000010 77 88 99 aa e9 e9 e9 e9
49-
# FILL-NEXT: 000018
46+
# RUN: od -v -Ax -t x1 %t-pad-fill | FileCheck %s --check-prefix=FILL --ignore-case --match-full-lines
47+
# FILL: {{0*}}00 11 22 33 44 55 66 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
48+
# FILL-NEXT: {{0*}}10 77 88 99 aa e9 e9 e9 e9
49+
# FILL-NEXT: {{0*}}18
5050

5151
## Remove the last section containing data and test that the padded space is gap filled.
5252
# RUN: llvm-objcopy -O binary --pad-to=0x218 --gap-fill=0xe9 --remove-section=.section2 %t %t-filled
53-
# RUN: od -v -Ax -t x1 %t-filled | FileCheck %s --check-prefix=REMOVE-SECTION --match-full-lines
54-
# REMOVE-SECTION: 000000 11 22 33 44 55 66 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
55-
# REMOVE-SECTION-NEXT: 000010 e9 e9 e9 e9 e9 e9 e9 e9
56-
# REMOVE-SECTION-NEXT: 000018
53+
# RUN: od -v -Ax -t x1 %t-filled | FileCheck %s --check-prefix=REMOVE-SECTION --ignore-case --match-full-lines
54+
# REMOVE-SECTION: {{0*}}00 11 22 33 44 55 66 e9 e9 e9 e9 e9 e9 e9 e9 e9 e9
55+
# REMOVE-SECTION-NEXT: {{0*}}10 e9 e9 e9 e9 e9 e9 e9 e9
56+
# REMOVE-SECTION-NEXT: {{0*}}18
5757

5858
--- !ELF
5959
FileHeader:

0 commit comments

Comments
 (0)