Conversation
Remove the num_running variable as it should be implied by the length of the jobs variable. Remove the i variable as it should be implied by the length of the test_results variable. Instead of counting results to determine if we're done, make the queue object itself responsible (by looking at running jobs and jobs left).
|
I think the problem with #23799 was that it introduced a second outer loop As far as I can see, this problem is still there (even though I can't reproduce the "pop from empty list" with this branch). |
|
I see the same behavior as @mzumsande: Here is a suggested fix. (I don't know how to suggest changes on lines unchanged.) Any feedback is appreciated as it is a learning opportunity.
class TestHandler:
"""
Trigger the test scripts passed in via the list.
"""
def __init__(self, *, num_tests_parallel, tests_dir, tmpdir, test_list, flags, use_term_control, failed):
assert num_tests_parallel >= 1
self.num_jobs = num_tests_parallel
self.tests_dir = tests_dir
self.tmpdir = tmpdir
self.test_list = test_list
self.flags = flags
self.jobs = []
self.use_term_control = use_term_control
self.failed = failed
job_queue = TestHandler(
num_tests_parallel=jobs,
tests_dir=tests_dir,
tmpdir=tmpdir,
test_list=test_list,
flags=flags,
use_term_control=use_term_control,
failed=False
)
if failfast:
job_queue.failed = True
logging.debug("Early exiting after test failure")
break
def done(self):
return self.failed or (not (self.jobs or self.test_list)) |
failfast is very useful when having smol computing power
TODO: add some tests to test the tests framework |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
a036358 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 a036358. 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
…nner a036358 test: Repair failfast option for test runner (Martin Zumsande) Pull request description: Fixes bitcoin#23990 After bitcoin#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 bitcoin#23990. This provides a straightforward fix for that. There is also bitcoin#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 a036358. 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
|
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
|
lgtm, but this still needs rebase, either here or in a separate pull. |
|
Concept ACK |
|
Marked up for grabs. |
A few simplifications to test_runner.py to make it easier to reason about (and perhaps fix #23799 (review)):