Bug 1560960 - Fix waiting for wpt servers to start, r=whimboo
authorJames Graham <james@hoppipolla.co.uk>
Mon, 24 Jun 2019 20:13:13 +0000
changeset 542797 13f1ce87a10a685a12e8b57f0e0b5358025b9b9e
parent 542796 d8a3b12ffb3d6099c3ac02170f888eec68319e85
child 542798 d72bc20634561de8374822e149fcec3c6e06db5e
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhimboo
bugs1560960
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1560960 - Fix waiting for wpt servers to start, r=whimboo Differential Revision: https://phabricator.services.mozilla.com/D35658
testing/web-platform/tests/tools/wptrunner/wptrunner/environment.py
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/environment.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/environment.py
@@ -202,32 +202,34 @@ class TestEnvironment(object):
         if "/" not in self.test_paths:
             del route_builder.mountpoint_routes["/"]
 
         return route_builder.get_routes()
 
     def ensure_started(self):
         # Pause for a while to ensure that the server has a chance to start
         total_sleep_secs = 30
-        each_sleep_secs = 0.01
-        for _ in xrange(int(total_sleep_secs / each_sleep_secs)):
+        each_sleep_secs = 0.5
+        end_time = time.time() + total_sleep_secs
+        while time.time() < end_time:
             failed = self.test_servers()
             if not failed:
                 return
             time.sleep(each_sleep_secs)
         raise EnvironmentError("Servers failed to start: %s" %
                                ", ".join("%s:%s" % item for item in failed))
 
     def test_servers(self):
         failed = []
         host = self.config["server_host"]
         for scheme, servers in self.servers.iteritems():
             for port, server in servers:
                 if self.test_server_port:
                     s = socket.socket()
+                    s.settimeout(0.1)
                     try:
                         s.connect((host, port))
                     except socket.error:
                         failed.append((host, port))
                     finally:
                         s.close()
 
                 if not server.is_alive():