Bug 1352351 - Fix infinite loop getting next test with --run-by-dir, r=ato draft
authorJames Graham <james@hoppipolla.co.uk>
Thu, 23 Mar 2017 22:30:35 +0000
changeset 554247 2a87d7170b48eea26e175984d890d391751ed92f
parent 552445 d4af7ec6cfcd9b81cd1f433a00b412de61e95b62
child 554248 a2b9cb67e6d0e6069a59aba9c11d5c9a4df770e2
push id51879
push userbmo:james@hoppipolla.co.uk
push dateFri, 31 Mar 2017 08:57:22 +0000
reviewersato
bugs1352351
milestone55.0a1
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
testing/web-platform/harness/wptrunner/testloader.py
testing/web-platform/harness/wptrunner/testrunner.py
--- 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)