summaryrefslogtreecommitdiffstats
path: root/Lib/test/libregrtest
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-03-24 11:04:15 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-03-24 11:04:15 (GMT)
commit56db16cd445603f688084d9ace4c271b13e4ec01 (patch)
tree0aaa7a5795b9c8644e5c0d6047f453fb39967f41 /Lib/test/libregrtest
parent2b60b7237e81895b71e8763dd94946cd76bf2d16 (diff)
downloadcpython-56db16cd445603f688084d9ace4c271b13e4ec01.zip
cpython-56db16cd445603f688084d9ace4c271b13e4ec01.tar.gz
cpython-56db16cd445603f688084d9ace4c271b13e4ec01.tar.bz2
regrtest: when parallel tests are interrupted, display progress
Diffstat (limited to 'Lib/test/libregrtest')
-rw-r--r--Lib/test/libregrtest/runtest_mp.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/Lib/test/libregrtest/runtest_mp.py b/Lib/test/libregrtest/runtest_mp.py
index 96db196..aa97f05 100644
--- a/Lib/test/libregrtest/runtest_mp.py
+++ b/Lib/test/libregrtest/runtest_mp.py
@@ -21,6 +21,9 @@ from test.libregrtest.setup import setup_tests
# Display the running tests if nothing happened last N seconds
PROGRESS_UPDATE = 30.0 # seconds
+# If interrupted, display the wait process every N seconds
+WAIT_PROGRESS = 2.0 # seconds
+
def run_test_in_subprocess(testname, ns):
"""Run the given test in a subprocess with --slaveargs.
@@ -224,9 +227,18 @@ def run_tests_multiprocess(regrtest):
if use_timeout:
faulthandler.cancel_dump_traceback_later()
- running = [worker.current_test for worker in workers]
- running = list(filter(bool, running))
- if running:
- print("Waiting for %s" % ', '.join(running))
- for worker in workers:
- worker.join()
+ # If tests are interrupted, wait until tests complete
+ wait_start = time.monotonic()
+ while True:
+ running = [worker.current_test for worker in workers]
+ running = list(filter(bool, running))
+ if not running:
+ break
+
+ dt = time.monotonic() - wait_start
+ line = "Waiting for %s (%s tests)" % (', '.join(running), len(running))
+ if dt >= WAIT_PROGRESS:
+ line = "%s since %.0f sec" % (line, dt)
+ print(line)
+ for worker in workers:
+ worker.join(WAIT_PROGRESS)