Skip to content

Commit

Permalink
Do not skip all the remaining tests when one worker crashes (#46995)
Browse files Browse the repository at this point in the history
* Do not skip all the remaining tests when one worker crashes

When one worker crashes, while tests already assigned to that work will
never be run, the tests in other groups can still be run by other
workers. There is no need to drain all tests in such scenario.

Ideally test_ended should be called for all such tests with a result
SKIP-ped. Chromium handled this separately.

Bug: None

* capture exceptions
  • Loading branch information
WeizhongX committed Jul 5, 2024
1 parent 9394d47 commit 6560385
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tools/wptrunner/wptrunner/testrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,19 +478,18 @@ def run_loop(self, test_queue):
self.logger.debug("TestRunnerManager main loop terminating, starting cleanup")

skipped_tests = []
while True:
_, _, test, _, _ = self.get_next_test()
if test is None:
break
test_group, subsuite, _, _ = self.test_source.current_group
while test_group is not None and len(test_group) > 0:
test = test_group.popleft()
skipped_tests.append(test)

if skipped_tests:
self.logger.critical(
f"Tests left in the queue: {skipped_tests[0].id!r} "
f"Tests left in the queue: {subsuite}:{skipped_tests[0].id!r} "
f"and {len(skipped_tests) - 1} others"
)
for test in skipped_tests[1:]:
self.logger.debug(f"Test left in the queue: {test.id!r}")
self.logger.debug(f"Test left in the queue: {subsuite}:{test.id!r}")

force_stop = (not isinstance(self.state, RunnerManagerState.stop) or
self.state.force_stop)
Expand Down Expand Up @@ -957,6 +956,8 @@ def stop_runner(self, force=False):
try:
self.browser.stop(force=force)
self.ensure_runner_stopped()
except (OSError, PermissionError):
self.logger.error("Failed to stop the runner")
finally:
self.cleanup()

Expand Down

0 comments on commit 6560385

Please sign in to comment.