-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-101525: Skip test_gdb if the binary is relocated by BOLT. #118572
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
Conversation
corona10
commented
May 4, 2024
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: Make BOLT as stable feature #101525
Now the all tests are fully passed with BOLTed binary. |
Lib/test/support/__init__.py
Outdated
binary_path = sys.executable | ||
with open(binary_path, 'rb') as f: | ||
binary = f.read() | ||
if b'.note.bolt_info' in binary: |
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.
Can you call readelf -e <binary_path>
and grep .note.bolt_info
? Checking headers is efficient and robust.
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.
I also think it will be the best way to handle this issue. But I am not sure it will be okay to call external binary for this. I may need to get opinions from @vstinner and @erlend-aasland WDYT?
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.
Why not checking sysconfig? This check looks slow and not reliable.
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.
Why not checking sysconfig? This check looks slow and not reliable.
Do you have any recommendation points? CFLAG does not guarantee the build is BOLTed.
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.
Maybe test:
'--enable-bolt' in sysconfig.get_config_var('CONFIG_ARGS')
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.
Only put the code in test_gdb if you're worried that the the test is not reliable. And add a comment to explain it.
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.
Well then there is no way to display the optimization information but okay got it.
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.
You cannot expect "readelf" to be available, it would be a new dependency. I dislike looking for a string in a binary without parsing the ELF binary.
We call external binaries in test.support
to determine macOS features, so there is precedent for doing that sort of thing; is readelf
a standalone package, or is it part of the compiler toolchain?
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.
; is readelf a standalone package, or is it part of the compiler toolchain?
AFAIK, it's part of binutils: https://sourceware.org/binutils/docs/binutils/readelf.html
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.
AFAIK, it's part of binutils: https://sourceware.org/binutils/docs/binutils/readelf.html
Thanks. binutils
is preinstalled on the Ubuntu runners GitHub provides, so there is no more dependencies for the CI there. Also, anyone who wants to build their own CPython probably already did apt install build-essential
, which includes binutils
. Looks to me like there are no more deps introduced. What about macOS?
By the way, since |
Well, when I run a test_gdb with BOLTed binary, sometimes it fails, well let me try with other systems too. |
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.
LGTM
I suggest to backport the change to 3.12, and maybe also to 3.11. |
Lib/test/support/__init__.py
Outdated
@@ -856,6 +856,14 @@ def check_cflags_pgo(): | |||
return any(option in cflags_nodist for option in pgo_options) | |||
|
|||
|
|||
def check_bolt_optimized(): | |||
# Always return false, if the platform is WASI. |
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.
This comment only says what the code does, but not why. Could you rewrite it to state why this is happening? I can easily see by the code that we always return false if we're on WASI; there is no need to manifest that info into a comment ;)
@vstinner @erlend-aasland |
d77cc23
to
ea13917
Compare
@vstinner @erlend-aasland I've updated the staled PR, Can you please take a look again? |
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.
LGTM
Misc/NEWS.d/next/Tests/2024-05-04-22-56-41.gh-issue-101525.LHK166.rst
Outdated
Show resolved
Hide resolved
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.
LGTM
Thanks @corona10 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
…ythongh-118572) (cherry picked from commit f95fc4d) Co-authored-by: Donghee Na <donghee.na@python.org>
Sorry, @corona10, I could not cleanly backport this to
|
GH-123601 is a backport of this pull request to the 3.13 branch. |
…OLT. (pythongh-118572) (cherry picked from commit f95fc4d) Co-authored-by: Donghee Na <donghee.na@python.org>
GH-123603 is a backport of this pull request to the 3.12 branch. |