Bug 1364228 - Increase marionette startup timeout for Linux mochitests. r=ato, a=test-only
authorGeoff Brown <gbrown@mozilla.com>
Wed, 17 May 2017 10:30:32 -0600
changeset 396448 63e5df87225066221139c162917afcc5758d88d5
parent 396447 6bb1fb5f97c9416a2a547218770092593e408751
child 396449 d5e1be51863d66c5fa4c860883ece938972c4f39
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato, test-only
bugs1364228, 1261598
milestone54.0
Bug 1364228 - Increase marionette startup timeout for Linux mochitests. r=ato, a=test-only Our linux32-debug build is very slow to startup when running mochitests on aws. Sometimes we see similar behavior on other linux platforms. Intermittently, in this environment, startup takes longer than the 120 seconds that marionette waits, resulting in test failures in bug 1261598. Increasing the marionette startup timeout to 180 seconds appears to effectively avoid these failures.
layout/tools/reftest/reftestcommandline.py
layout/tools/reftest/runreftest.py
testing/marionette/client/marionette_driver/marionette.py
testing/mochitest/mochitest_options.py
testing/mochitest/runtests.py
testing/mozharness/configs/unittests/linux_unittest.py
--- a/layout/tools/reftest/reftestcommandline.py
+++ b/layout/tools/reftest/reftestcommandline.py
@@ -139,16 +139,20 @@ class ReftestArgumentsParser(argparse.Ar
         self.add_argument("--marionette-port-timeout",
                           default=None,
                           help=argparse.SUPPRESS)
 
         self.add_argument("--marionette-socket-timeout",
                           default=None,
                           help=argparse.SUPPRESS)
 
+        self.add_argument("--marionette-startup-timeout",
+                          default=None,
+                          help=argparse.SUPPRESS)
+
         self.add_argument("--setenv",
                           action="append",
                           type=str,
                           default=[],
                           dest="environment",
                           metavar="NAME=VALUE",
                           help="sets the given variable in the application's "
                           "environment")
--- a/layout/tools/reftest/runreftest.py
+++ b/layout/tools/reftest/runreftest.py
@@ -614,16 +614,17 @@ class RefTest(object):
         runner.start(debug_args=debug_args,
                      interactive=interactive,
                      outputTimeout=timeout)
         proc = runner.process_handler
 
         if self.use_marionette:
             marionette_args = {
                 'socket_timeout': options.marionette_socket_timeout,
+                'startup_timeout': options.marionette_startup_timeout,
                 'symbols_path': options.symbolsPath,
             }
             if options.marionette:
                 host, port = options.marionette.split(':')
                 marionette_args['host'] = host
                 marionette_args['port'] = int(port)
 
             marionette = Marionette(**marionette_args)
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -594,26 +594,26 @@ class Marionette(object):
         self.profile = None
         self.window = None
         self.chrome_window = None
         self.baseurl = baseurl
         self._test_name = None
         self.socket_timeout = socket_timeout
         self.crashed = 0
 
-        startup_timeout = startup_timeout or self.DEFAULT_STARTUP_TIMEOUT
+        self.startup_timeout = int(startup_timeout or self.DEFAULT_STARTUP_TIMEOUT)
         if self.bin:
             if not Marionette.is_port_available(self.port, host=self.host):
                 ex_msg = "{0}:{1} is unavailable.".format(self.host, self.port)
                 raise errors.MarionetteException(message=ex_msg)
 
             self.instance = GeckoInstance.create(
                 app, host=self.host, port=self.port, bin=self.bin, **instance_args)
             self.instance.start()
-            self.raise_for_port(timeout=startup_timeout)
+            self.raise_for_port(timeout=self.startup_timeout)
 
         self.timeout = Timeouts(self)
 
     @property
     def profile_path(self):
         if self.instance and self.instance.profile:
             return self.instance.profile.profile
 
@@ -1309,16 +1309,17 @@ class Marionette(object):
 
         self.client = transport.TcpTransport(
             self.host,
             self.port,
             self.socket_timeout)
 
         # Call wait_for_port() before attempting to connect in
         # the event gecko hasn't started yet.
+        timeout = timeout or self.startup_timeout
         self.wait_for_port(timeout=timeout)
         self.protocol, _ = self.client.connect()
 
         body = {"capabilities": capabilities, "sessionId": session_id}
         resp = self._send_message("newSession", body)
 
         self.session_id = resp["sessionId"]
         self.session = resp["value"] if self.protocol == 1 else resp["capabilities"]
--- a/testing/mochitest/mochitest_options.py
+++ b/testing/mochitest/mochitest_options.py
@@ -578,16 +578,21 @@ class MochitestArguments(ArgumentContain
           "help": "Timeout while waiting for the marionette port to open.",
           "suppress": True,
           }],
         [["--marionette-socket-timeout"],
          {"default": None,
           "help": "Timeout while waiting to receive a message from the marionette server.",
           "suppress": True,
           }],
+        [["--marionette-startup-timeout"],
+         {"default": None,
+          "help": "Timeout while waiting for marionette server startup.",
+          "suppress": True,
+          }],
         [["--cleanup-crashes"],
          {"action": "store_true",
           "dest": "cleanupCrashes",
           "default": False,
           "help": "Delete pending crash reports before running tests.",
           "suppress": True,
           }],
         [["--websocket-process-bridge-port"],
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -2444,16 +2444,17 @@ toolbar#nav-bar {
                 detectShutdownLeaks = mozinfo.info[
                     "debug"] and options.flavor == 'browser'
 
             self.start_script_kwargs['flavor'] = self.normflavor(options.flavor)
             marionette_args = {
                 'symbols_path': options.symbolsPath,
                 'socket_timeout': options.marionette_socket_timeout,
                 'port_timeout': options.marionette_port_timeout,
+                'startup_timeout': options.marionette_startup_timeout,
             }
 
             if options.marionette:
                 host, port = options.marionette.split(':')
                 marionette_args['host'] = host
                 marionette_args['port'] = int(port)
 
             # testsToFilter parameter is used to filter out the test list that
--- a/testing/mozharness/configs/unittests/linux_unittest.py
+++ b/testing/mozharness/configs/unittests/linux_unittest.py
@@ -111,16 +111,17 @@ config = {
                 "--certificate-path=tests/certs",
                 "--setpref=webgl.force-enabled=true",
                 "--quiet",
                 "--log-raw=%(raw_log_file)s",
                 "--log-errorsummary=%(error_summary_file)s",
                 "--use-test-media-devices",
                 "--screenshot-on-fail",
                 "--cleanup-crashes",
+                "--marionette-startup-timeout=180",
             ],
             "run_filename": "runtests.py",
             "testsdir": "mochitest"
         },
         "mozbase": {
             "options": [
                 "-b",
                 "%(binary_path)s"