cpython/Lib/test/libregrtest
Joshua Herman 9e011e7c77
gh-82054: allow test runner to split test_asyncio to execute in parallel by sharding. (#103927)
This runs test_asyncio sub-tests in parallel using sharding from Cinder. This suite is typically the longest-pole in runs because it is a test package with a lot of further sub-tests otherwise run serially. By breaking out the sub-tests as independent modules we can run a lot more in parallel.

After porting we can see the direct impact on a multicore system.

Without this change:
  Running make test is 5 min 26 seconds
With this change:
  Running make test takes 3 min 39 seconds

That'll vary based on system and parallelism. On a `-j 4` run similar to what CI and buildbot systems often do, it reduced the overall test suite completion latency by 10%.

The drawbacks are that this implementation is hacky and due to the sorting of the tests it obscures when the asyncio tests occur and involves changing CPython test infrastructure but, the wall time saved it is worth it, especially in low-core count CI runs as it pulls a long tail. The win for productivity and reserved CI resource usage is significant.

Future tests that deserve to be refactored into split up suites to benefit from are test_concurrent_futures and the way the _test_multiprocessing suite gets run for all start methods. As exposed by passing the -o flag to python -m test to get a list of the 10 longest running tests.

---------

Co-authored-by: Carl Meyer <carl@oddbird.net>
Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google, LLC]
2023-04-29 18:26:24 -07:00
..
__init__.py bpo-37473: Don't import importlib ASAP in tests (GH-14661) 2019-07-14 19:31:12 +02:00
cmdline.py gh-94052: Don't re-run failed tests with --python option (#94054) 2022-06-21 14:42:32 +02:00
main.py bpo-46523: fix tests rerun when `setUp[Class|Module]` fails (#30895) 2023-04-07 12:43:41 +02:00
pgo.py bpo-10572: Fixup Lib/test/libregrtest/pgo.py (GH-29327) 2021-11-01 09:57:28 +00:00
refleak.py gh-84436: Implement Immortal Objects (gh-19474) 2023-04-22 13:39:37 -06:00
runtest.py gh-82054: allow test runner to split test_asyncio to execute in parallel by sharding. (#103927) 2023-04-29 18:26:24 -07:00
runtest_mp.py gh-95027: Fix regrtest stdout encoding on Windows (#98492) 2022-10-21 16:21:36 +02:00
save_env.py gh-72719: Remove asyncore and asynchat modules (#96580) 2022-11-08 16:48:58 +01:00
setup.py Run Tools/scripts/reindent.py (#94225) 2022-06-26 10:34:06 +02:00
utils.py gh-100086: Add build info to test.libregrtest (#100093) 2022-12-08 01:38:47 +01:00
win_utils.py bpo-44336: Prevent tests hanging on child process handles on Windows (GH-26578) 2022-03-22 00:06:55 +00:00