-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[llvm-objdump][MachO] Update check in flaky test that depends on directory path #150674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-llvm-binary-utilities @llvm/pr-subscribers-mc Author: Akshay Deodhar (akshayrdeodhar) ChangesEarlier, 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'. With the "addr" mode, there will be no "_main" The existing check for function-starts=addrs checks that the pattern for "names" or "both" does not get printed. This MR makes the check more specific, so that stray _main strings in the directory path will not make the test fail. Full diff: https://github.com/llvm/llvm-project/pull/150674.diff 1 Files Affected:
diff --git a/llvm/test/tools/llvm-objdump/MachO/function-starts.test b/llvm/test/tools/llvm-objdump/MachO/function-starts.test
index 8c013174c4eca..509bc8629b014 100644
--- a/llvm/test/tools/llvm-objdump/MachO/function-starts.test
+++ b/llvm/test/tools/llvm-objdump/MachO/function-starts.test
@@ -1,7 +1,7 @@
## This test verifies that llvm-objdump correctly prints function starts data.
-RUN: llvm-objdump --macho --function-starts %p/Inputs/hello.exe.macho-i386 | FileCheck %s --check-prefix=32-BIT --implicit-check-not=_main
-RUN: llvm-objdump --macho --function-starts=addrs %p/Inputs/hello.exe.macho-i386 | FileCheck %s --check-prefix=32-BIT --implicit-check-not=_main
+RUN: llvm-objdump --macho --function-starts %p/Inputs/hello.exe.macho-i386 | FileCheck %s --check-prefix=32-BIT --implicit-check-not='{{(^| )_main}}'
+RUN: llvm-objdump --macho --function-starts=addrs %p/Inputs/hello.exe.macho-i386 | FileCheck %s --check-prefix=32-BIT --implicit-check-not='{{(^| )_main}}'
32-BIT: 00001f40
RUN: llvm-objdump --macho --function-starts=names %p/Inputs/hello.exe.macho-i386 | FileCheck %s --check-prefix=32-BIT-NAMES
@@ -10,8 +10,8 @@ RUN: llvm-objdump --macho --function-starts=names %p/Inputs/hello.exe.macho-i386
RUN: llvm-objdump --macho --function-starts=both %p/Inputs/hello.exe.macho-i386 | FileCheck %s --check-prefix=32-BIT-BOTH
32-BIT-BOTH: 00001f40 _main
-RUN: llvm-objdump --macho --function-starts %p/Inputs/hello.exe.macho-x86_64 | FileCheck %s --check-prefix=64-BIT --implicit-check-not=_main
-RUN: llvm-objdump --macho --function-starts=addrs %p/Inputs/hello.exe.macho-x86_64 | FileCheck %s --check-prefix=64-BIT --implicit-check-not=_main
+RUN: llvm-objdump --macho --function-starts %p/Inputs/hello.exe.macho-x86_64 | FileCheck %s --check-prefix=64-BIT --implicit-check-not='{{(^| )_main}}'
+RUN: llvm-objdump --macho --function-starts=addrs %p/Inputs/hello.exe.macho-x86_64 | FileCheck %s --check-prefix=64-BIT --implicit-check-not='{{(^| )_main}}'
64-BIT: 0000000100000f30
RUN: llvm-objdump --macho --function-starts=names %p/Inputs/hello.exe.macho-x86_64 | FileCheck %s --check-prefix=64-BIT-NAMES
|
|
@@ -1,7 +1,7 @@ | |||
## This test verifies that llvm-objdump correctly prints function starts data. | |||
|
|||
RUN: llvm-objdump --macho --function-starts %p/Inputs/hello.exe.macho-i386 | FileCheck %s --check-prefix=32-BIT --implicit-check-not=_main | |||
RUN: llvm-objdump --macho --function-starts=addrs %p/Inputs/hello.exe.macho-i386 | FileCheck %s --check-prefix=32-BIT --implicit-check-not=_main | |||
RUN: llvm-objdump --macho --function-starts %p/Inputs/hello.exe.macho-i386 | FileCheck %s --check-prefix=32-BIT --implicit-check-not='{{(^| )_main}}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit edge-casey, but this will still fail for paths like /my/contrived _main/path
. Adding $
might help. assuming that the strings we're talking about are always at the end of lines (I'm not familiar with the details of this output).
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:
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 " _main\n".
The existing check for function-starts=addrs checks that the pattern for "names" or "both" does not get printed. This MR makes the check more specific, so that stray _main strings in the directory path will not make the test fail.