Bug 1352351 - Fix infinite loop getting next test with --run-by-dir, r=ato
If getting a test from the queue failed, we would loop forever rather
than trying the next queue.
MozReview-Commit-ID: K5YxCZPtx4l
--- a/testing/web-platform/harness/wptrunner/testloader.py
+++ b/testing/web-platform/harness/wptrunner/testloader.py
@@ -622,17 +622,16 @@ class PathGroupedSource(TestSource):
if not self.current_queue or self.current_queue.empty():
try:
data = self.test_queue.get(block=True, timeout=1)
self.current_queue = Queue()
for item in data:
self.current_queue.put(item)
except Empty:
return None
-
return self.current_queue
def requeue_test(self, test):
self.current_queue.put(test)
def __exit__(self, *args, **kwargs):
if self.current_queue:
self.current_queue.close()
--- a/testing/web-platform/harness/wptrunner/testrunner.py
+++ b/testing/web-platform/harness/wptrunner/testrunner.py
@@ -494,19 +494,20 @@ class TestRunnerManager(threading.Thread
while test is None:
if test_queue is None:
test_queue = self.test_source.get_queue()
if test_queue is None:
self.logger.info("No more tests")
return None, None
try:
# Need to block here just to allow for contention with other processes
- test = test_queue.get(block=True, timeout=1)
+ test = test_queue.get(block=True, timeout=2)
except Empty:
- pass
+ if test_queue.empty():
+ test_queue = None
return test, test_queue
def run_test(self):
assert isinstance(self.state, RunnerManagerState.running)
assert self.state.test is not None
self.logger.test_start(self.state.test.id)
self.send_message("run_test", self.state.test)