Skip to content

Commit 73bcac2

Browse files
[llvm-objdump][MachO] Update check in flaky test that depends on directory path (#150674)
Earlier, function-starts.test failed when directory path contained '_main', because objdump prints out the entire directory path, and there is an implicit-check-not for '_main'. There's three ways in which [function starts are printed by llvm-objdump](https://llvm.org/docs/CommandGuide/llvm-objdump.html#cmdoption-llvm-objdump-function-starts):  With the "addr" mode, there will be no "_main"\ With "names", it'll be printed as "_main\n"\ With "both", it'll be printed as "<addr> _main\n".  The existing check for function-starts=addrs checks that the pattern for "names" or "both" does not get printed. This MR changes the RUN lines to take stdin input, so that no directory path is printed, and stray _main strings in the directory path will not make the test fail.
1 parent bd4f977 commit 73bcac2

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed
Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
11
## This test verifies that llvm-objdump correctly prints function starts data.
22

3-
RUN: llvm-objdump --macho --function-starts %p/Inputs/hello.exe.macho-i386 | FileCheck %s --check-prefix=32-BIT --implicit-check-not=_main
4-
RUN: llvm-objdump --macho --function-starts=addrs %p/Inputs/hello.exe.macho-i386 | FileCheck %s --check-prefix=32-BIT --implicit-check-not=_main
3+
## Note: we read input from stdin instead of from a file, because llvm-objdump prints
4+
## the filename in its output. If the filename contains the string "_main", then the
5+
## check will incorrectly get triggered.
6+
7+
RUN: llvm-objdump --macho --function-starts - < %p/Inputs/hello.exe.macho-i386 | FileCheck %s --check-prefix=32-BIT --implicit-check-not=_main
8+
RUN: llvm-objdump --macho --function-starts=addrs - < %p/Inputs/hello.exe.macho-i386 | FileCheck %s --check-prefix=32-BIT --implicit-check-not=_main
59
32-BIT: 00001f40
610

7-
RUN: llvm-objdump --macho --function-starts=names %p/Inputs/hello.exe.macho-i386 | FileCheck %s --check-prefix=32-BIT-NAMES
11+
RUN: llvm-objdump --macho --function-starts=names - < %p/Inputs/hello.exe.macho-i386 | FileCheck %s --check-prefix=32-BIT-NAMES
812
32-BIT-NAMES: {{^}}_main
913

10-
RUN: llvm-objdump --macho --function-starts=both %p/Inputs/hello.exe.macho-i386 | FileCheck %s --check-prefix=32-BIT-BOTH
14+
RUN: llvm-objdump --macho --function-starts=both - < %p/Inputs/hello.exe.macho-i386 | FileCheck %s --check-prefix=32-BIT-BOTH
1115
32-BIT-BOTH: 00001f40 _main
1216

13-
RUN: llvm-objdump --macho --function-starts %p/Inputs/hello.exe.macho-x86_64 | FileCheck %s --check-prefix=64-BIT --implicit-check-not=_main
14-
RUN: llvm-objdump --macho --function-starts=addrs %p/Inputs/hello.exe.macho-x86_64 | FileCheck %s --check-prefix=64-BIT --implicit-check-not=_main
17+
RUN: llvm-objdump --macho --function-starts - < %p/Inputs/hello.exe.macho-x86_64 | FileCheck %s --check-prefix=64-BIT --implicit-check-not=_main
18+
RUN: llvm-objdump --macho --function-starts=addrs - < %p/Inputs/hello.exe.macho-x86_64 | FileCheck %s --check-prefix=64-BIT --implicit-check-not=_main
1519
64-BIT: 0000000100000f30
1620

17-
RUN: llvm-objdump --macho --function-starts=names %p/Inputs/hello.exe.macho-x86_64 | FileCheck %s --check-prefix=64-BIT-NAMES
21+
RUN: llvm-objdump --macho --function-starts=names - < %p/Inputs/hello.exe.macho-x86_64 | FileCheck %s --check-prefix=64-BIT-NAMES
1822
64-BIT-NAMES: {{^}}_main
1923

20-
RUN: llvm-objdump --macho --function-starts=both %p/Inputs/hello.exe.macho-x86_64 | FileCheck %s --check-prefix=64-BIT-BOTH
24+
RUN: llvm-objdump --macho --function-starts=both - < %p/Inputs/hello.exe.macho-x86_64 | FileCheck %s --check-prefix=64-BIT-BOTH
2125
64-BIT-BOTH: 0000000100000f30 _main
2226

23-
RUN: llvm-strip %p/Inputs/hello.exe.macho-x86_64 -o %t.stripped
24-
RUN: llvm-objdump --macho --function-starts=both %t.stripped | FileCheck %s --check-prefix=BOTH-STRIPPED
27+
RUN: llvm-strip %p/Inputs/hello.exe.macho-x86_64 -o %t.stripped
28+
RUN: llvm-objdump --macho --function-starts=both - < %t.stripped | FileCheck %s --check-prefix=BOTH-STRIPPED
2529
BOTH-STRIPPED: 0000000100000f30 ?
2630

2731
RUN: llvm-strip %p/Inputs/hello.exe.macho-x86_64 -o %t.stripped
28-
RUN: llvm-objdump --macho --function-starts=names %t.stripped | FileCheck %s --check-prefix=NAMES-STRIPPED
29-
NAMES-STRIPPED: function-starts.test.tmp.stripped:
32+
RUN: llvm-objdump --macho --function-starts=names - < %t.stripped | FileCheck %s --check-prefix=NAMES-STRIPPED
33+
NAMES-STRIPPED: -:
3034
NAMES-STRIPPED-EMPTY:

0 commit comments

Comments
 (0)