Bug 1265124 - [reftest] Make sure marionette waits long enough when attaching a debugger, r?chmanchester draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Fri, 29 Apr 2016 15:41:23 -0400
changeset 357923 9caff54c06df96475c39e3ead9f72dc4d8ab7c16
parent 357771 8c3fd523d75bd30f691ca2d6cfdad18d576392a1
child 519741 32b8bcade912c939ef7e5723853db6423f1bcbc5
push id16887
push userahalberstadt@mozilla.com
push dateFri, 29 Apr 2016 20:36:43 +0000
reviewerschmanchester
bugs1265124, 1245092
milestone49.0a1
Bug 1265124 - [reftest] Make sure marionette waits long enough when attaching a debugger, r?chmanchester As of bug 1245092, reftest depends on marionette. Normally marionette client has an internal timeout of around 60 seconds where it waits for the server to become available. But when using debuggers (and especially valgrind), it can take much much longer than a minute for Firefox to start. This patch adds a couple hidden command line args to reftest to tweak the marionette timeouts. MozReview-Commit-ID: 3xF0InBJNEf
layout/tools/reftest/reftestcommandline.py
layout/tools/reftest/runreftest.py
--- a/layout/tools/reftest/reftestcommandline.py
+++ b/layout/tools/reftest/reftestcommandline.py
@@ -129,16 +129,24 @@ 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("--setenv",
                           action="append",
                           type=str,
                           default=[],
                           dest="environment",
                           metavar="NAME=VALUE",
                           help="sets the given variable in the application's "
                           "environment")
@@ -336,16 +344,22 @@ class DesktopArgumentsParser(ReftestArgu
             if options.totalChunks is not None or options.thisChunk is not None:
                 self.error(
                     "cannot specify thisChunk or totalChunks with parallel tests")
             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_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[
                            'MOZ_BUILD_APP'] != 'mobile/android'
                        else None)
--- a/layout/tools/reftest/runreftest.py
+++ b/layout/tools/reftest/runreftest.py
@@ -597,24 +597,27 @@ class RefTest(object):
                             env=env,
                             process_args=kp_kwargs)
         runner.start(debug_args=debug_args,
                      interactive=interactive,
                      outputTimeout=timeout)
         proc = runner.process_handler
 
         if self.use_marionette:
-            marionette_args = { 'symbols_path': options.symbolsPath }
+            marionette_args = {
+                'socket_timeout': options.marionette_socket_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)
-            marionette.start_session()
+            marionette.start_session(timeout=options.marionette_port_timeout)
 
             addons = Addons(marionette)
             if options.specialPowersExtensionPath:
                 addons.install(options.specialPowersExtensionPath, temp=True)
 
             addons.install(options.reftestExtensionPath, temp=True)
 
             marionette.delete_session()