Bug 1031635 - Add --debugger-args option to reftest mach commands. r=gps
authorL. David Baron <dbaron@dbaron.org>
Wed, 16 Jul 2014 20:10:10 -0700
changeset 216460 84d34426abf6d7a70641efcce748ba6f9c96339c
parent 216459 83d81f2f03727f347b14cfe26413d37770578a05
child 216461 d5be9f365771abe371d1b48f9195da75e865ca43
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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 1031635 - Add --debugger-args option to reftest mach commands. r=gps This allows useful argument combinations such as: --debugger valgrind --debugger-args "--tool=memcheck --leak-check=no --trace-children=yes --num-callers=50"
--- a/layout/tools/reftest/mach_commands.py
+++ b/layout/tools/reftest/mach_commands.py
@@ -209,33 +209,35 @@ class ReftestRunner(MozbuildObject):
         # Don't enable oop for crashtest until they run oop in automation
         if suite == 'reftest':
             options.oop = True
         return reftest.run_remote_reftests(parser, options, args)
     def run_desktop_test(self, test_file=None, filter=None, suite=None,
-            debugger=None, parallel=False, shuffle=False,
+            debugger=None, debugger_args=None, parallel=False, shuffle=False,
             e10s=False, extraPrefs=None, this_chunk=None, total_chunks=None):
         """Runs a reftest.
         test_file is a path to a test file. It can be a relative path from the
         top source directory, an absolute filename, or a directory containing
         test files.
         filter is a regular expression (in JS syntax, as could be passed to the
         RegExp constructor) to select which reftests to run from the manifest.
         suite is the type of reftest to run. It can be one of ('reftest',
         'crashtest', 'jstestbrowser').
         debugger is the program name (in $PATH) or the full path of the
         debugger to run.
+        debugger_args are the arguments passed to the debugger.
         parallel indicates whether tests should be run in parallel or not.
         shuffle indicates whether to run tests in random order.
         if suite not in ('reftest', 'reftest-ipc', 'crashtest', 'crashtest-ipc', 'jstestbrowser'):
             raise Exception('None or unrecognized reftest suite type.')
@@ -250,16 +252,24 @@ class ReftestRunner(MozbuildObject):
         if filter:
             extra_args.extend(['--filter', self._make_shell_string(filter)])
         pass_thru = False
         if debugger:
             extra_args.append('--debugger=%s' % debugger)
             pass_thru = True
+            if debugger_args:
+                # Use _make_shell_string (which quotes) so that we
+                # handle multiple args being passed to the debugger.
+                extra_args.extend(['--debugger-args', self._make_shell_string(debugger_args)])
+        else:
+            if debugger_args:
+                print("--debugger-args passed, but no debugger specified.")
+                return 1
         if parallel:
         if shuffle:
         if e10s:
@@ -287,16 +297,20 @@ class ReftestRunner(MozbuildObject):
 def ReftestCommand(func):
     """Decorator that adds shared command arguments to reftest commands."""
     debugger = CommandArgument('--debugger', metavar='DEBUGGER',
     func = debugger(func)
+    debugger_args = CommandArgument('--debugger-args', metavar='DEBUGGER_ARGS',
+        help='Arguments to pass to the debugger.')
+    func = debugger_args(func)
     flter = CommandArgument('--filter', metavar='REGEX',
         help='A JS regular expression to match test URLs against, to select '
              'a subset of tests to run.')
     func = flter(func)
     path = CommandArgument('test_file', nargs='?', metavar='MANIFEST',
         help='Reftest manifest file, or a directory in which to select '
              'reftest.list. If omitted, the entire test suite is executed.')