merge bitcoin#23799: Let test_runner.py start multiple jobs per timeslot

This commit is contained in:
Kittywhiskers Van Gogh 2021-12-16 15:19:52 -05:00
parent 1b241a2832
commit 64dd46764c
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD

View File

@ -573,10 +573,12 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, attempts=1, enab
max_len_name = len(max(test_list, key=len))
test_count = len(test_list)
for i in range(test_count):
test_result, testdir, stdout, stderr = job_queue.get_next()
i = 0
while i < test_count:
for test_result, testdir, stdout, stderr in job_queue.get_next():
test_results.append(test_result)
done_str = "{}/{} - {}{}{}".format(i + 1, test_count, BOLD[1], test_result.name, BOLD[0])
i += 1
done_str = "{}/{} - {}{}{}".format(i, test_count, BOLD[1], test_result.name, BOLD[0])
if test_result.status == "Passed":
logging.debug("%s passed, Duration: %s s" % (done_str, test_result.time))
elif test_result.status == "Skipped":
@ -697,8 +699,9 @@ class TestHandler:
dot_count = 0
while True:
# Return first proc that finishes
# Return all procs that have finished, if any. Otherwise sleep until there is one.
time.sleep(.5)
ret = []
for job in self.jobs:
(name, start_time, proc, testdir, log_out, log_err, portseed, attempt) = job
if proc.poll() is not None:
@ -745,7 +748,9 @@ class TestHandler:
clearline = '\r' + (' ' * dot_count) + '\r'
print(clearline, end='', flush=True)
dot_count = 0
return TestResult(name, status, int(time.time() - start_time)), testdir, stdout, stderr
ret.append((TestResult(name, status, int(time.time() - start_time)), testdir, stdout, stderr))
if ret:
return ret
if self.use_term_control:
print('.', end='', flush=True)
dot_count += 1