Bug 1511764 - Bail out of startup if we are unable to connect to wpt, r=whimboo
authorJames Graham <james@hoppipolla.co.uk>
Tue, 12 Feb 2019 14:47:07 +0000
changeset 458745 4cf8e31cb261
parent 458744 f754cb84d092
child 458746 74bd0fed9dbe
push id35548
push useropoprus@mozilla.com
push dateWed, 13 Feb 2019 09:48:26 +0000
treeherdermozilla-central@93e37c529818 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhimboo
bugs1511764
milestone67.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 1511764 - Bail out of startup if we are unable to connect to wpt, r=whimboo The previous setup was broken because subclasses could run code after the cinnection failed assuming that the connection had succeeded. Unwinding the stack and sending the failure messages at the top level avoid this pitfall. Depends on D19487 Differential Revision: https://phabricator.services.mozilla.com/D19488
testing/web-platform/tests/tools/wptrunner/wptrunner/executors/protocol.py
testing/web-platform/tests/tools/wptrunner/wptrunner/testrunner.py
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/protocol.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/protocol.py
@@ -49,28 +49,21 @@ class Protocol(object):
 
             msg = None
 
             for cls in self.implements:
                 getattr(self, cls.name).setup()
 
             msg = "Post-connection steps failed"
             self.after_connect()
-        except IOError:
-            self.logger.warning("Timed out waiting for browser to start")
-            self.executor.runner.send_message("init_failed")
-            return
         except Exception:
             if msg is not None:
                 self.logger.warning(msg)
-            self.logger.error(traceback.format_exc())
-            self.executor.runner.send_message("init_failed")
-            return
-        else:
-            self.executor.runner.send_message("init_succeeded")
+            self.logger.warning(traceback.format_exc())
+            raise
 
     @abstractmethod
     def connect(self):
         """Make a connection to the remote browser"""
         pass
 
     @abstractmethod
     def after_connect(self):
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/testrunner.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/testrunner.py
@@ -65,17 +65,23 @@ class TestRunner(object):
     def __enter__(self):
         return self
 
     def __exit__(self, exc_type, exc_value, traceback):
         self.teardown()
 
     def setup(self):
         self.logger.debug("Executor setup")
-        self.executor.setup(self)
+        try:
+            self.executor.setup(self)
+        except Exception:
+            # The caller is responsible for logging the exception if required
+            self.send_message("init_failed")
+        else:
+            self.send_message("init_succeeded")
         self.logger.debug("Executor setup done")
 
     def teardown(self):
         self.executor.teardown()
         self.send_message("runner_teardown")
         self.result_queue = None
         self.command_queue = None
         self.browser = None