Bug 1414882 - Marionette executor has to use raise_for_port. r=ato,jgraham
authorHenrik Skupin <mail@hskupin.info>
Wed, 08 Nov 2017 21:30:38 +0100
changeset 444544 065dbcb0a21d4b656edc75c0fb45dd0e900caa18
parent 444543 96cbaf1268ad66536431159e7a76a3916fcc7373
child 444545 1843a786310a24d555f2cd5083ac94c667685325
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato, jgraham
bugs1414882
milestone58.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 1414882 - Marionette executor has to use raise_for_port. r=ato,jgraham To allow more fine-grained failure details when waiting for a port, raise_for_port has to be used. MozReview-Commit-ID: 5Anfd9yRVY0
testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py
@@ -57,40 +57,37 @@ class MarionetteProtocol(Protocol):
         """Connect to browser via Marionette."""
         Protocol.setup(self, runner)
 
         self.logger.debug("Connecting to Marionette on port %i" % self.marionette_port)
         startup_timeout = marionette.Marionette.DEFAULT_STARTUP_TIMEOUT * self.timeout_multiplier
         self.marionette = marionette.Marionette(host='localhost',
                                                 port=self.marionette_port,
                                                 socket_timeout=None,
-                                                startup_timeout=None)
-
-        # XXX Move this timeout somewhere
-        self.logger.debug("Waiting for Marionette connection")
-        while True:
-            success = self.marionette.wait_for_port(startup_timeout)
-            #When running in a debugger wait indefinitely for firefox to start
-            if success or self.executor.debug_info is None:
-                break
+                                                startup_timeout=startup_timeout)
 
-        session_started = False
-        if success:
-            try:
-                self.logger.debug("Starting Marionette session")
-                self.marionette.start_session()
-            except Exception as e:
-                self.logger.warning("Starting marionette session failed: %s" % e)
-            else:
-                self.logger.debug("Marionette session started")
-                session_started = True
+        try:
+            self.logger.debug("Waiting for Marionette connection")
+            while True:
+                try:
+                    self.marionette.raise_for_port()
+                    break
+                except IOError:
+                    # When running in a debugger wait indefinitely for Firefox to start
+                    if self.executor.debug_info is None:
+                        raise
 
-        if not success or not session_started:
-            self.logger.warning("Failed to connect to Marionette")
+            self.logger.debug("Starting Marionette session")
+            self.marionette.start_session()
+            self.logger.debug("Marionette session started")
+
+        except Exception as e:
+            self.logger.warning("Failed to start a Marionette session: %s" % e)
             self.executor.runner.send_message("init_failed")
+
         else:
             try:
                 self.after_connect()
             except Exception:
                 self.logger.warning("Post-connection steps failed")
                 self.logger.error(traceback.format_exc())
                 self.executor.runner.send_message("init_failed")
             else: