Issue #25220, libregrtest: more verbose output for -jN
When the -jN command line option is used, display tests running since at least 30 seconds every minute.
This commit is contained in:
parent
b40843546b
commit
17f9716676
|
@ -1,11 +1,11 @@
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import queue
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
import types
|
import types
|
||||||
import unittest
|
import unittest
|
||||||
from queue import Queue
|
|
||||||
from test import support
|
from test import support
|
||||||
try:
|
try:
|
||||||
import threading
|
import threading
|
||||||
|
@ -21,6 +21,9 @@ from test.libregrtest.setup import setup_tests
|
||||||
# the test is running in background
|
# the test is running in background
|
||||||
PROGRESS_MIN_TIME = 30.0 # seconds
|
PROGRESS_MIN_TIME = 30.0 # seconds
|
||||||
|
|
||||||
|
# Display the running tests if nothing happened last N seconds
|
||||||
|
PROGRESS_UPDATE = 60.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.
|
||||||
|
@ -145,18 +148,39 @@ class MultiprocessThread(threading.Thread):
|
||||||
|
|
||||||
|
|
||||||
def run_tests_multiprocess(regrtest):
|
def run_tests_multiprocess(regrtest):
|
||||||
output = Queue()
|
output = queue.Queue()
|
||||||
pending = MultiprocessIterator(regrtest.tests)
|
pending = MultiprocessIterator(regrtest.tests)
|
||||||
|
|
||||||
workers = [MultiprocessThread(pending, output, regrtest.ns)
|
workers = [MultiprocessThread(pending, output, regrtest.ns)
|
||||||
for i in range(regrtest.ns.use_mp)]
|
for i in range(regrtest.ns.use_mp)]
|
||||||
for worker in workers:
|
for worker in workers:
|
||||||
worker.start()
|
worker.start()
|
||||||
|
|
||||||
|
def get_running(workers):
|
||||||
|
running = []
|
||||||
|
for worker in workers:
|
||||||
|
current_test = worker.current_test
|
||||||
|
if not current_test:
|
||||||
|
continue
|
||||||
|
dt = time.monotonic() - worker.start_time
|
||||||
|
if dt >= PROGRESS_MIN_TIME:
|
||||||
|
running.append('%s (%.0f sec)' % (current_test, dt))
|
||||||
|
return running
|
||||||
|
|
||||||
finished = 0
|
finished = 0
|
||||||
test_index = 1
|
test_index = 1
|
||||||
|
timeout = max(PROGRESS_UPDATE, PROGRESS_MIN_TIME)
|
||||||
try:
|
try:
|
||||||
while finished < regrtest.ns.use_mp:
|
while finished < regrtest.ns.use_mp:
|
||||||
test, stdout, stderr, result = output.get()
|
try:
|
||||||
|
item = output.get(timeout=PROGRESS_UPDATE)
|
||||||
|
except queue.Empty:
|
||||||
|
running = get_running(workers)
|
||||||
|
if running:
|
||||||
|
print('running: %s' % ', '.join(running))
|
||||||
|
continue
|
||||||
|
|
||||||
|
test, stdout, stderr, result = item
|
||||||
if test is None:
|
if test is None:
|
||||||
finished += 1
|
finished += 1
|
||||||
continue
|
continue
|
||||||
|
@ -168,14 +192,7 @@ def run_tests_multiprocess(regrtest):
|
||||||
if (ok not in (CHILD_ERROR, INTERRUPTED)
|
if (ok not in (CHILD_ERROR, INTERRUPTED)
|
||||||
and test_time >= PROGRESS_MIN_TIME):
|
and test_time >= PROGRESS_MIN_TIME):
|
||||||
text += ' (%.0f sec)' % test_time
|
text += ' (%.0f sec)' % test_time
|
||||||
running = []
|
running = get_running(workers)
|
||||||
for worker in workers:
|
|
||||||
current_test = worker.current_test
|
|
||||||
if not current_test:
|
|
||||||
continue
|
|
||||||
dt = time.monotonic() - worker.start_time
|
|
||||||
if dt >= PROGRESS_MIN_TIME:
|
|
||||||
running.append('%s (%.0f sec)' % (current_test, dt))
|
|
||||||
if running:
|
if running:
|
||||||
text += ' -- running: %s' % ', '.join(running)
|
text += ' -- running: %s' % ', '.join(running)
|
||||||
regrtest.display_progress(test_index, text)
|
regrtest.display_progress(test_index, text)
|
||||||
|
|
Loading…
Reference in New Issue