diff options
author | MarcoFalke <falke.marco@gmail.com> | 2022-02-07 16:57:47 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2022-02-07 16:57:50 +0100 |
commit | 9392e1350cd8091677d728c72dd2ea842604227b (patch) | |
tree | a5cc8f57be5899ec47275a97286261e8382c7452 /test | |
parent | f7a36477a61b3719859ee4bb0795821c2aa6bd16 (diff) | |
parent | a036358994546e2041d0bf0cc911bab4e4baba3c (diff) |
Merge bitcoin/bitcoin#24195: test: Fix failfast option for functional test runner
a036358994546e2041d0bf0cc911bab4e4baba3c test: Repair failfast option for test runner (Martin Zumsande)
Pull request description:
Fixes #23990
After #23799, the `--failfast` option in the test runner for the functional tests stopped working, because a second outer loop was introduced, which would have needed a `break` too for the test runner to fail immediately. This also led to the errors reported in #23990.
This provides a straightforward fix for that.
There is also #23995 which is a larger refactor, but that hasn't been updated in a while to fix the failfast issue.
ACKs for top commit:
pg156:
Tested ACK a036358994546e2041d0bf0cc911bab4e4baba3c. I agree adding the `all_passed` flag to break out of the outer loop when needed makes sense. The "failfast" option works after this change.
Tree-SHA512: 3e2f775e36c13d180d32a05cd1cfe0883274e8615cdbbd4e069a9899e9b9ea1091066cf085e93f1c5326bd8ecc6ff524e0dad7c638f60dfdb169fefcdb26ee52
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/test_runner.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index e833128063..1a0d62aa8f 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -532,8 +532,11 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage= max_len_name = len(max(test_list, key=len)) test_count = len(test_list) + all_passed = True i = 0 while i < test_count: + if failfast and not all_passed: + break for test_result, testdir, stdout, stderr in job_queue.get_next(): test_results.append(test_result) i += 1 @@ -543,6 +546,7 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage= elif test_result.status == "Skipped": logging.debug("%s skipped" % (done_str)) else: + all_passed = False print("%s failed, Duration: %s s\n" % (done_str, test_result.time)) print(BOLD[1] + 'stdout:\n' + BOLD[0] + stdout + '\n') print(BOLD[1] + 'stderr:\n' + BOLD[0] + stderr + '\n') @@ -576,7 +580,7 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage= if not os.listdir(tmpdir): os.rmdir(tmpdir) - all_passed = all(map(lambda test_result: test_result.was_successful, test_results)) and coverage_passed + all_passed = all_passed and coverage_passed # Clean up dangling processes if any. This may only happen with --failfast option. # Killing the process group will also terminate the current process but that is |