Bug 1399592 - Increase Marionette startup timeout for mochitest/reftest. draft
authorHenrik Skupin <mail@hskupin.info>
Thu, 14 Sep 2017 16:18:58 +0200
changeset 664868 74a03fceaf7dd49b45f692e1a3906ba23e13e2d2
parent 664736 dd6b788f149763c4014c27f2fe1a1d13228bda82
child 731572 89b9e1016c86846e96c78cbda4782344cce42c9c
push id79835
push userbmo:hskupin@gmail.com
push dateThu, 14 Sep 2017 14:27:51 +0000
bugs1399592
milestone57.0a1
Bug 1399592 - Increase Marionette startup timeout for mochitest/reftest. Currently the mochitest and reftest runners are forcing a timeout of 60s (or 900s for valgrind or debug builds) when calling `start_session` of Marionette. While this method still offers a timeout parameter, the timeout should be set via the `startup_timeout` argument for Marionette. Reason is that Marionette doesn't control the browser instance and is getting called right after the application gets launched. As such slow running builds can cause timeouts once it takes longer than 60s for the Marionette server to get started. By using `startup_timeout` the timeout will even be configurable via the command line and mozharness config files. MozReview-Commit-ID: EV7GklBcJjU
layout/tools/reftest/reftestcommandline.py
layout/tools/reftest/runreftest.py
testing/mochitest/mochitest_options.py
testing/mochitest/runtests.py
--- a/layout/tools/reftest/reftestcommandline.py
+++ b/layout/tools/reftest/reftestcommandline.py
@@ -131,20 +131,16 @@ class ReftestArgumentsParser(argparse.Ar
                           "The extension file's name should be <id>.xpi where <id> is "
                           "the extension's id as indicated in its install.rdf. "
                           "An optional path can be specified too.")
 
         self.add_argument("--marionette",
                           default=None,
                           help="host:port to use when connecting to Marionette")
 
-        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)
 
@@ -368,17 +364,17 @@ class DesktopArgumentsParser(ReftestArgu
             if options.focusFilterMode != "all":
                 self.error("cannot specify focusFilterMode with parallel tests")
             if options.debugger is not None:
                 self.error("cannot specify a debugger with parallel tests")
 
         if options.debugger:
             # valgrind and some debuggers may cause Gecko to start slowly. Make sure
             # marionette waits long enough to connect.
-            options.marionette_port_timeout = 900
+            options.marionette_startup_timeout = 900
             options.marionette_socket_timeout = 540
 
         if not options.tests:
             self.error("No test files specified.")
 
         if options.app is None:
             bin_dir = (self.build_obj.get_binary_path() if
                        self.build_obj and self.build_obj.substs[
--- a/layout/tools/reftest/runreftest.py
+++ b/layout/tools/reftest/runreftest.py
@@ -694,17 +694,17 @@ class RefTest(object):
                 '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)
-            marionette.start_session(timeout=options.marionette_port_timeout)
+            marionette.start_session()
 
             addons = Addons(marionette)
             if options.specialPowersExtensionPath:
                 addons.install(options.specialPowersExtensionPath, temp=True)
 
             addons.install(options.reftestExtensionPath, temp=True)
 
             marionette.delete_session()
--- a/testing/mochitest/mochitest_options.py
+++ b/testing/mochitest/mochitest_options.py
@@ -547,21 +547,16 @@ class MochitestArguments(ArgumentContain
           "dest": "enableCPOWWarnings",
           "help": "Enable logging of unsafe CPOW usage, which is disabled by default for tests",
           "suppress": True,
           }],
         [["--marionette"],
          {"default": None,
           "help": "host:port to use when connecting to Marionette",
           }],
-        [["--marionette-port-timeout"],
-         {"default": None,
-          "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.",
@@ -742,17 +737,17 @@ class MochitestArguments(ArgumentContain
 
         if options.debuggerArgs and not options.debugger:
             parser.error(
                 "--debugger-args requires --debugger.")
 
         if options.valgrind or options.debugger:
             # valgrind and some debuggers may cause Gecko to start slowly. Make sure
             # marionette waits long enough to connect.
-            options.marionette_port_timeout = 900
+            options.marionette_startup_timeout = 900
             options.marionette_socket_timeout = 540
 
         if options.store_chrome_manifest:
             options.store_chrome_manifest = os.path.abspath(options.store_chrome_manifest)
             if not os.path.isdir(os.path.dirname(options.store_chrome_manifest)):
                 parser.error(
                     "directory for %s does not exist as a destination to copy a "
                     "chrome manifest." % options.store_chrome_manifest)
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -2147,19 +2147,18 @@ toolbar#nav-bar {
             self.log.info("runtests.py | Application pid: %d" % proc.pid)
 
             gecko_id = "GECKO(%d)" % proc.pid
             self.log.process_start(gecko_id)
             self.message_logger.gecko_id = gecko_id
 
             # start marionette and kick off the tests
             marionette_args = marionette_args or {}
-            port_timeout = marionette_args.pop('port_timeout', 60)
             self.marionette = Marionette(**marionette_args)
-            self.marionette.start_session(timeout=port_timeout)
+            self.marionette.start_session()
 
             # install specialpowers and mochikit addons
             addons = Addons(self.marionette)
 
             addons.install(create_zip(
                 os.path.join(here, 'extensions', 'specialpowers')
             ))
             addons.install(create_zip(self.mochijar))
@@ -2580,17 +2579,16 @@ toolbar#nav-bar {
             if options.jscov_dir_prefix is None:
                 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)