Show in-progress tests when rpc-tests is interrupted
Interrupting rpc-tests (e.g., with Ctrl-c) will print a list of the tests that were running when the interrupt was received. This is useful for identifying tests that aren’t terminating. For example: ``` wallet_broadcast.py: Pass: True, Duration: 62 s ................. zmq_test.py: Pass: True, Duration: 29 s .....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................^C The following tests were running when interrupted: • mempool_reorg.py Traceback (most recent call last): ... ```
This commit is contained in:
parent
af4994c1ae
commit
cbc0511cd2
|
@ -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))
|
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]
|
results = BOLD[1] + "%s | %s | %s\n\n" % ("TEST".ljust(max_len_name), "PASSED", "DURATION") + BOLD[0]
|
||||||
|
try:
|
||||||
for _ in range(len(test_list)):
|
for _ in range(len(test_list)):
|
||||||
(name, stdout, stderr, passed, duration) = job_queue.get_next()
|
(name, stdout, stderr, passed, duration) = job_queue.get_next()
|
||||||
all_passed = all_passed and passed
|
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))
|
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)
|
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('')
|
||||||
|
raise
|
||||||
|
|
||||||
results += BOLD[1] + "\n%s | %s | %s s (accumulated)" % ("ALL".ljust(max_len_name), str(all_passed).ljust(6), time_sum) + BOLD[0]
|
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)
|
print(results)
|
||||||
|
|
Loading…
Reference in New Issue