Skip to content
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

gh-110995: Fix test_gdb check_usable_gdb() #110998

Merged
merged 1 commit into from
Oct 17, 2023
Merged

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Oct 17, 2023

Fix detection of gdb built without Python scripting support.

  • check_usable_gdb() doesn't check gdb exit code when calling run_gdb().
  • Use shutil.which() to get the path to the gdb program.

Fix detection of gdb built without Python scripting support.

* check_usable_gdb() doesn't check gdb exit code when calling
  run_gdb().
* Use shutil.which() to get the path to the gdb program.
@hroncok
Copy link
Contributor

hroncok commented Oct 17, 2023

This is what we see with real gdb without embedded Python support:

...
0:02:25 load avg: 3.88 [ 43/469] test.test_gdb.test_backtrace skipped
test.test_gdb.test_backtrace skipped -- gdb not built with embedded python support; stderr: 'Python scripting is not supported in this copy of GDB.\n'
0:02:26 load avg: 3.88 [ 44/469] test.test_gdb.test_cfunction skipped
test.test_gdb.test_cfunction skipped -- gdb not built with embedded python support; stderr: 'Python scripting is not supported in this copy of GDB.\n'
0:02:26 load avg: 3.88 [ 45/469] test.test_gdb.test_cfunction_full skipped
test.test_gdb.test_cfunction_full skipped -- gdb not built with embedded python support; stderr: 'Python scripting is not supported in this copy of GDB.\n'
0:02:27 load avg: 3.89 [ 46/469] test.test_gdb.test_misc skipped
test.test_gdb.test_misc skipped -- gdb not built with embedded python support; stderr: 'Python scripting is not supported in this copy of GDB.\n'
0:02:28 load avg: 3.89 [ 47/469] test.test_gdb.test_pretty_print skipped
test.test_gdb.test_pretty_print skipped -- gdb not built with embedded python support; stderr: 'Python scripting is not supported in this copy of GDB.\n'
...

So at least that case seems to work as expected. We haven't tested with gdb with embedded Python support.

@hroncok
Copy link
Contributor

hroncok commented Oct 17, 2023

@vstinner Should the check function die (either with unittest.SkipTest or with another Exception) when the process had non-zero exit code but the stdout was not empty?

@vstinner
Copy link
Member Author

This is what we see with real gdb without embedded Python support:
0:02:25 load avg: 3.88 [ 43/469] test.test_gdb.test_backtrace skipped
test.test_gdb.test_backtrace skipped -- gdb not built with embedded python support; stderr: 'Python scripting is not supported in this copy of GDB.\n'

Perfect, that's exactly the expected behavior: skip the test.

We haven't tested with gdb with embedded Python support.

GHA Ubuntu ran test_gdb tests: all passed.

@vstinner Should the check function die (either with unittest.SkipTest or with another Exception) when the process had non-zero exit code but the stdout was not empty?

test_gdb is complicated and fragile, in case of doubt, I prefer to not change the code. This change restores the status quo: same code than before.

@vstinner vstinner merged commit 920b3df into python:main Oct 17, 2023
@vstinner vstinner deleted the test_gdb branch October 17, 2023 18:19
@miss-islington-app
Copy link

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 17, 2023
Fix detection of gdb built without Python scripting support.

* check_usable_gdb() doesn't check gdb exit code when calling
  run_gdb().
* Use shutil.which() to get the path to the gdb program.
(cherry picked from commit 920b3df)

Co-authored-by: Victor Stinner <vstinner@python.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 17, 2023
Fix detection of gdb built without Python scripting support.

* check_usable_gdb() doesn't check gdb exit code when calling
  run_gdb().
* Use shutil.which() to get the path to the gdb program.
(cherry picked from commit 920b3df)

Co-authored-by: Victor Stinner <vstinner@python.org>
@bedevere-app
Copy link

bedevere-app bot commented Oct 17, 2023

GH-111003 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Oct 17, 2023
@bedevere-app
Copy link

bedevere-app bot commented Oct 17, 2023

GH-111004 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Oct 17, 2023
vstinner added a commit that referenced this pull request Oct 17, 2023
gh-110995: Fix test_gdb check_usable_gdb() (GH-110998)

Fix detection of gdb built without Python scripting support.

* check_usable_gdb() doesn't check gdb exit code when calling
  run_gdb().
* Use shutil.which() to get the path to the gdb program.
(cherry picked from commit 920b3df)

Co-authored-by: Victor Stinner <vstinner@python.org>
vstinner added a commit that referenced this pull request Oct 17, 2023
gh-110995: Fix test_gdb check_usable_gdb() (GH-110998)

Fix detection of gdb built without Python scripting support.

* check_usable_gdb() doesn't check gdb exit code when calling
  run_gdb().
* Use shutil.which() to get the path to the gdb program.
(cherry picked from commit 920b3df)

Co-authored-by: Victor Stinner <vstinner@python.org>
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
Fix detection of gdb built without Python scripting support.

* check_usable_gdb() doesn't check gdb exit code when calling
  run_gdb().
* Use shutil.which() to get the path to the gdb program.
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Fix detection of gdb built without Python scripting support.

* check_usable_gdb() doesn't check gdb exit code when calling
  run_gdb().
* Use shutil.which() to get the path to the gdb program.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants