Kaydet (Commit) 56db16cd authored tarafından Victor Stinner's avatar Victor Stinner

regrtest: when parallel tests are interrupted, display progress

üst 2b60b723
...@@ -21,6 +21,9 @@ from test.libregrtest.setup import setup_tests ...@@ -21,6 +21,9 @@ from test.libregrtest.setup import setup_tests
# Display the running tests if nothing happened last N seconds # Display the running tests if nothing happened last N seconds
PROGRESS_UPDATE = 30.0 # 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): def run_test_in_subprocess(testname, ns):
"""Run the given test in a subprocess with --slaveargs. """Run the given test in a subprocess with --slaveargs.
...@@ -224,9 +227,18 @@ def run_tests_multiprocess(regrtest): ...@@ -224,9 +227,18 @@ def run_tests_multiprocess(regrtest):
if use_timeout: if use_timeout:
faulthandler.cancel_dump_traceback_later() faulthandler.cancel_dump_traceback_later()
running = [worker.current_test for worker in workers] # If tests are interrupted, wait until tests complete
running = list(filter(bool, running)) wait_start = time.monotonic()
if running: while True:
print("Waiting for %s" % ', '.join(running)) running = [worker.current_test for worker in workers]
for worker in workers: running = list(filter(bool, running))
worker.join() 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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment