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-109972: Split test_gdb into a package of 3 tests #109977

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Sep 27, 2023

Split test_gdb.py file into a test_gdb package made of multiple
tests, so tests can now be run in parallel.

  • Create Lib/test/test_gdb/ directory.
  • Split test_gdb.py into multiple files in Lib/test/test_gdb/
    directory.
  • Move Lib/test/gdb_sample.py to Lib/test/test_gdb/ directory.
    Update get_sample_script(): use file to locate gdb_sample.py.
  • Move gdb_has_frame_select() and HAS_PYUP_PYDOWN to test_misc.py.
  • Explicitly skip test_gdb on Windows. Previously, test_gdb was
    skipped even if gdb was available because of
    gdb_has_frame_select().

@vstinner
Copy link
Member Author

Test on PPC64LE RHEL8 3.x buildbot.

When Python is built with ./configure --with-pydebug --with-lto && make -j10, test_gdb takes 19 min 45 sec.

With this change, it takes 12 min 2 sec when tests are run in parallel.

$ ./python -m test test_gdb -u all -j0 --slowest 
0:00:00 load avg: 1.39 Run 3 tests in parallel using 3 worker processes
0:00:30 load avg: 3.01 running (3): test_gdb.test_backtrace (30.0 sec), test_gdb.test_misc (30.0 sec), test_gdb.test_pretty_print (30.0 sec)
0:01:00 load avg: 3.34 running (3): test_gdb.test_backtrace (1 min), test_gdb.test_misc (1 min), test_gdb.test_pretty_print (1 min)
0:01:30 load avg: 3.67 running (3): test_gdb.test_backtrace (1 min 30 sec), test_gdb.test_misc (1 min 30 sec), test_gdb.test_pretty_print (1 min 30 sec)
0:01:41 load avg: 3.72 [1/3] test_gdb.test_misc passed (1 min 41 sec) -- running (2): test_gdb.test_backtrace (1 min 41 sec), test_gdb.test_pretty_print (1 min 41 sec)
0:02:11 load avg: 3.49 running (2): test_gdb.test_backtrace (2 min 11 sec), test_gdb.test_pretty_print (2 min 11 sec)
0:02:41 load avg: 3.37 running (2): test_gdb.test_backtrace (2 min 41 sec), test_gdb.test_pretty_print (2 min 41 sec)
0:03:11 load avg: 3.16 running (2): test_gdb.test_backtrace (3 min 11 sec), test_gdb.test_pretty_print (3 min 11 sec)
0:03:41 load avg: 3.17 running (2): test_gdb.test_backtrace (3 min 41 sec), test_gdb.test_pretty_print (3 min 41 sec)
0:04:11 load avg: 3.47 running (2): test_gdb.test_backtrace (4 min 11 sec), test_gdb.test_pretty_print (4 min 11 sec)
0:04:41 load avg: 3.36 running (2): test_gdb.test_backtrace (4 min 41 sec), test_gdb.test_pretty_print (4 min 41 sec)
0:05:11 load avg: 3.22 running (2): test_gdb.test_backtrace (5 min 11 sec), test_gdb.test_pretty_print (5 min 11 sec)
0:05:41 load avg: 3.04 running (2): test_gdb.test_backtrace (5 min 41 sec), test_gdb.test_pretty_print (5 min 41 sec)
0:06:11 load avg: 3.04 running (2): test_gdb.test_backtrace (6 min 11 sec), test_gdb.test_pretty_print (6 min 11 sec)
0:06:41 load avg: 3.02 running (2): test_gdb.test_backtrace (6 min 41 sec), test_gdb.test_pretty_print (6 min 41 sec)
0:07:11 load avg: 3.01 running (2): test_gdb.test_backtrace (7 min 11 sec), test_gdb.test_pretty_print (7 min 11 sec)
0:07:19 load avg: 3.01 [2/3] test_gdb.test_pretty_print passed (7 min 19 sec) -- running (1): test_gdb.test_backtrace (7 min 19 sec)
0:07:49 load avg: 2.55 running (1): test_gdb.test_backtrace (7 min 49 sec)
0:08:19 load avg: 2.18 running (1): test_gdb.test_backtrace (8 min 19 sec)
0:08:49 load avg: 1.71 running (1): test_gdb.test_backtrace (8 min 49 sec)
0:09:19 load avg: 1.67 running (1): test_gdb.test_backtrace (9 min 19 sec)
0:09:49 load avg: 1.46 running (1): test_gdb.test_backtrace (9 min 49 sec)
0:10:19 load avg: 1.28 running (1): test_gdb.test_backtrace (10 min 19 sec)
0:10:49 load avg: 1.17 running (1): test_gdb.test_backtrace (10 min 49 sec)
0:11:19 load avg: 1.10 running (1): test_gdb.test_backtrace (11 min 19 sec)
0:11:49 load avg: 1.06 running (1): test_gdb.test_backtrace (11 min 49 sec)
0:12:02 load avg: 1.05 [3/3] test_gdb.test_backtrace passed (12 min 2 sec)

== Tests result: SUCCESS ==

10 slowest tests:
- test_gdb.test_backtrace: 12 min 2 sec
- test_gdb.test_pretty_print: 7 min 19 sec
- test_gdb.test_misc: 1 min 41 sec

All 3 tests OK.

Total duration: 12 min 2 sec
Total tests: run=51 skipped=1
Total test files: run=3/3
Result: SUCCESS

@vstinner vstinner force-pushed the split_test_gdb branch 2 times, most recently from 754d551 to 534bdad Compare September 28, 2023 07:44
@vstinner
Copy link
Member Author

vstinner commented Sep 28, 2023

I splitted the test even more, I added test_cfunction and test_cfunction_full.

Timings on my Fedora 38 x86-64:

- test_gdb.test_pretty_print: 13.3 sec
- test_gdb.test_cfunction: 10.5 sec
- test_gdb.test_cfunction_full: 6.5 sec
- test_gdb.test_misc: 3.9 sec
- test_gdb.test_backtrace: 2.8 sec

Total duration: 13.4 sec

Timings on RHEL8 ppc64le, buildbot with slowest test_gdb:

10 slowest tests:
- test_gdb.test_cfunction: 9 min 33 sec
- test_gdb.test_pretty_print: 8 min 36 sec
- test_gdb.test_cfunction_full: 2 min 56 sec
- test_gdb.test_misc: 1 min 49 sec
- test_gdb.test_backtrace: 1 min 45 sec

Total duration: 9 min 33 sec

@vstinner vstinner force-pushed the split_test_gdb branch 4 times, most recently from 3c6bfc9 to c29b162 Compare September 28, 2023 10:30
@vstinner
Copy link
Member Author

Hum, I went too far in terms of refactoring. I made this PR as simple as possible, to only split test_gdb into multiple files.

I will write a follow-up PR for the heavy refactoring.

Split test_gdb.py file into a test_gdb package made of multiple
tests, so tests can now be run in parallel.

* Create Lib/test/test_gdb/ directory.
* Split test_gdb.py into multiple files in Lib/test/test_gdb/
  directory.
* Move Lib/test/gdb_sample.py to Lib/test/test_gdb/ directory.
  Update get_sample_script(): use __file__ to locate gdb_sample.py.
* Move gdb_has_frame_select() and HAS_PYUP_PYDOWN to test_misc.py.
* Explicitly skip test_gdb on Windows. Previously, test_gdb was
  skipped even if gdb was available because of
  gdb_has_frame_select().
@vstinner
Copy link
Member Author

I added 5 minutes to buildbot timeout: python/buildmaster-config#408 Before, buildbots always removed 5 minutes to their default timeout of 20 minutes. I fixed this issue to have use more consistent timeouts on all Python CIs.

@vstinner vstinner merged commit 8f324b7 into python:main Sep 28, 2023
23 checks passed
@vstinner vstinner deleted the split_test_gdb branch September 28, 2023 11:24
@vstinner vstinner added the needs backport to 3.12 bug and security fixes label Sep 28, 2023
@miss-islington
Copy link
Contributor

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @vstinner, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 8f324b7ecd2df3036fab098c4c8ac185ac07b277 3.12

csm10495 pushed a commit to csm10495/cpython that referenced this pull request Sep 29, 2023
Split test_gdb.py file into a test_gdb package made of multiple
tests, so tests can now be run in parallel.

* Create Lib/test/test_gdb/ directory.
* Split test_gdb.py into multiple files in Lib/test/test_gdb/
  directory.
* Move Lib/test/gdb_sample.py to Lib/test/test_gdb/ directory.
  Update get_sample_script(): use __file__ to locate gdb_sample.py.
* Move gdb_has_frame_select() and HAS_PYUP_PYDOWN to test_misc.py.
* Explicitly skip test_gdb on Windows. Previously, test_gdb was
  skipped even if gdb was available because of
  gdb_has_frame_select().
@vstinner vstinner added needs backport to 3.12 bug and security fixes and removed needs backport to 3.12 bug and security fixes labels Oct 4, 2023
@miss-islington
Copy link
Contributor

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @vstinner, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 8f324b7ecd2df3036fab098c4c8ac185ac07b277 3.12

vstinner added a commit to vstinner/cpython that referenced this pull request Oct 4, 2023
Split test_gdb.py file into a test_gdb package made of multiple
tests, so tests can now be run in parallel.

* Create Lib/test/test_gdb/ directory.
* Split test_gdb.py into multiple files in Lib/test/test_gdb/
  directory.
* Move Lib/test/gdb_sample.py to Lib/test/test_gdb/ directory.
  Update get_sample_script(): use __file__ to locate gdb_sample.py.
* Move gdb_has_frame_select() and HAS_PYUP_PYDOWN to test_misc.py.
* Explicitly skip test_gdb on Windows. Previously, test_gdb was
  skipped even if gdb was available because of
  gdb_has_frame_select().

(cherry picked from commit 8f324b7)
@bedevere-app
Copy link

bedevere-app bot commented Oct 4, 2023

GH-110339 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 4, 2023
vstinner added a commit that referenced this pull request Oct 4, 2023
…110339)

gh-109972: Split test_gdb.py into test_gdb package (#109977)

Split test_gdb.py file into a test_gdb package made of multiple
tests, so tests can now be run in parallel.

* Create Lib/test/test_gdb/ directory.
* Split test_gdb.py into multiple files in Lib/test/test_gdb/
  directory.
* Move Lib/test/gdb_sample.py to Lib/test/test_gdb/ directory.
  Update get_sample_script(): use __file__ to locate gdb_sample.py.
* Move gdb_has_frame_select() and HAS_PYUP_PYDOWN to test_misc.py.
* Explicitly skip test_gdb on Windows. Previously, test_gdb was
  skipped even if gdb was available because of
  gdb_has_frame_select().

(cherry picked from commit 8f324b7)
vstinner added a commit to vstinner/cpython that referenced this pull request Oct 4, 2023
…on#109977) (python#110339)

pythongh-109972: Split test_gdb.py into test_gdb package (python#109977)

Split test_gdb.py file into a test_gdb package made of multiple
tests, so tests can now be run in parallel.

* Create Lib/test/test_gdb/ directory.
* Split test_gdb.py into multiple files in Lib/test/test_gdb/
  directory.
* Move Lib/test/gdb_sample.py to Lib/test/test_gdb/ directory.
  Update get_sample_script(): use __file__ to locate gdb_sample.py.
* Move gdb_has_frame_select() and HAS_PYUP_PYDOWN to test_misc.py.
* Explicitly skip test_gdb on Windows. Previously, test_gdb was
  skipped even if gdb was available because of
  gdb_has_frame_select().

(cherry picked from commit 8f324b7)
(cherry picked from commit e7a61d3)
vstinner added a commit that referenced this pull request Oct 4, 2023
#110343)

[3.12] gh-109972: Split test_gdb.py into test_gdb package (#109977) (#110339)

gh-109972: Split test_gdb.py into test_gdb package (#109977)

Split test_gdb.py file into a test_gdb package made of multiple
tests, so tests can now be run in parallel.

* Create Lib/test/test_gdb/ directory.
* Split test_gdb.py into multiple files in Lib/test/test_gdb/
  directory.
* Move Lib/test/gdb_sample.py to Lib/test/test_gdb/ directory.
  Update get_sample_script(): use __file__ to locate gdb_sample.py.
* Move gdb_has_frame_select() and HAS_PYUP_PYDOWN to test_misc.py.
* Explicitly skip test_gdb on Windows. Previously, test_gdb was
  skipped even if gdb was available because of
  gdb_has_frame_select().

(cherry picked from commit 8f324b7)
(cherry picked from commit e7a61d3)
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Split test_gdb.py file into a test_gdb package made of multiple
tests, so tests can now be run in parallel.

* Create Lib/test/test_gdb/ directory.
* Split test_gdb.py into multiple files in Lib/test/test_gdb/
  directory.
* Move Lib/test/gdb_sample.py to Lib/test/test_gdb/ directory.
  Update get_sample_script(): use __file__ to locate gdb_sample.py.
* Move gdb_has_frame_select() and HAS_PYUP_PYDOWN to test_misc.py.
* Explicitly skip test_gdb on Windows. Previously, test_gdb was
  skipped even if gdb was available because of
  gdb_has_frame_select().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants