Merge pull request #6417 from sellout/rpc-tests-interrupt-context

Show in-progress tests when rpc-tests is interrupted
This commit is contained in:
str4d 2023-02-14 15:14:44 +00:00 committed by GitHub
commit efa2dc70e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 9 deletions

View File

@ -334,6 +334,7 @@ def run_tests(test_handler, test_list, src_dir, build_dir, exeext, jobs=1, enabl
max_len_name = len(max(test_list, key=len))
results = BOLD[1] + "%s | %s | %s\n\n" % ("TEST".ljust(max_len_name), "PASSED", "DURATION") + BOLD[0]
try:
for _ in range(len(test_list)):
(name, stdout, stderr, passed, duration) = job_queue.get_next()
all_passed = all_passed and passed
@ -345,6 +346,12 @@ def run_tests(test_handler, test_list, src_dir, build_dir, exeext, jobs=1, enabl
print("Pass: %s%s%s, Duration: %s s\n" % (BOLD[1], passed, BOLD[0], duration))
results += "%s | %s | %s s\n" % (name.ljust(max_len_name), str(passed).ljust(6), duration)
except (InterruptedError, KeyboardInterrupt):
print('\nThe following tests were running when interrupted:')
for j in job_queue.jobs:
print("", j[0])
print('\n', end='')
raise
results += BOLD[1] + "\n%s | %s | %s s (accumulated)" % ("ALL".ljust(max_len_name), str(all_passed).ljust(6), time_sum) + BOLD[0]
print(results)