Bug 1265124 - [reftest] Make sure marionette waits long enough when attaching a debugger, r=chmanchester
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Fri, 29 Apr 2016 15:41:23 -0400
changeset 295552 a17e8323ae15f62945bc64d62719f393a7bc1a74
parent 295551 506eacf36f935c80636b68363f69e7e87d1ee52a
child 295553 b498e6f7c6b03c7ea7217e8cec7edb178bd0ea07
push id19015
push usercbook@mozilla.com
push dateMon, 02 May 2016 09:39:23 +0000
treeherderfx-team@2080375bc69d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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()