Bug 1193223 - Add reftest support to mach test, r=chmanchester
☠☠ backed out by 5a8d86582839 ☠ ☠
authorJames Graham <james@hoppipolla.co.uk>
Tue, 08 Sep 2015 15:30:08 +0100
changeset 294581 0d6532c1e99efe43ba6b51fef198dbc583b87c94
parent 294580 da3dd2f650d0f664dfaf1d67754b1f8db99ef66c
child 294582 eb2d48b71c370e3eba7c7933d2a94d017e771ba3
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1193223
milestone43.0a1
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 1193223 - Add reftest support to mach test, r=chmanchester
layout/tools/reftest/mach_commands.py
testing/mach_commands.py
--- a/layout/tools/reftest/mach_commands.py
+++ b/layout/tools/reftest/mach_commands.py
@@ -210,16 +210,29 @@ class ReftestRunner(MozbuildObject):
         #Remove the stdout handler from the internal logger and let mach deal with it
         runreftest.log.removeHandler(runreftest.log.handlers[0])
         self.log_manager.enable_unstructured()
         rv = runreftest.run(**kwargs)
         self.log_manager.disable_unstructured()
 
         return rv
 
+
+def process_test_objects(kwargs):
+    """|mach test| works by providing a test_objects argument, from
+    which the test path must be extracted and converted into a normal
+    reftest tests argument."""
+
+    if "test_objects" in kwargs:
+        if kwargs["tests"] is None:
+            kwargs["tests"] = []
+        kwargs["tests"].extend(item["path"] for item in kwargs["test_objects"])
+        del kwargs["test_objects"]
+
+
 @CommandProvider
 class MachCommands(MachCommandBase):
     @Command('reftest',
              category='testing',
              description='Run reftests (layout and graphics correctness).',
              parser=reftestcommandline.DesktopArgumentsParser)
     def run_reftest(self, **kwargs):
         kwargs["suite"] = "reftest"
@@ -258,16 +271,17 @@ class MachCommands(MachCommandBase):
              description='Run IPC crashtests (Check if crashes on a page, separate process).',
              parser=reftestcommandline.DesktopArgumentsParser)
     def run_crashtest_ipc(self, **kwargs):
         kwargs["ipc"] = True
         kwargs["suite"] = "crashtest"
         return self._run_reftest(**kwargs)
 
     def _run_reftest(self, **kwargs):
+        process_test_objects(kwargs)
         reftest = self._spawn(ReftestRunner)
         return reftest.run_desktop_test(**kwargs)
 
 
 # TODO For now b2g commands will only work with the emulator,
 # they should be modified to work with all devices.
 def is_emulator(cls):
     """Emulator needs to be configured."""
@@ -302,16 +316,17 @@ class B2GCommands(MachCommandBase):
              description='Run a remote crashtest (Check if b2g crashes on a page, remote device).',
              conditions=[conditions.is_b2g, is_emulator],
              parser=reftestcommandline.B2GArgumentParser)
     def run_crashtest_remote(self, test_file, **kwargs):
         kwargs["suite"] = "crashtest"
         return self._run_reftest(**kwargs)
 
     def _run_reftest(self, **kwargs):
+        process_test_objects(kwargs)
         if self.device_name:
             if self.device_name.startswith('emulator'):
                 emulator = 'arm'
                 if 'x86' in self.device_name:
                     emulator = 'x86'
                 kwargs['emulator'] = emulator
 
         reftest = self._spawn(ReftestRunner)
--- a/testing/mach_commands.py
+++ b/testing/mach_commands.py
@@ -91,17 +91,17 @@ TEST_SUITES = {
     },
     'luciddream': {
         'mach_command': 'luciddream',
         'kwargs': {'test_paths': None},
     },
     'reftest': {
         'aliases': ('RR', 'rr', 'Rr'),
         'mach_command': 'reftest',
-        'kwargs': {'test_file': None},
+        'kwargs': {'tests': None},
     },
     'reftest-ipc': {
         'aliases': ('Ripc',),
         'mach_command': 'reftest-ipc',
         'kwargs': {'test_file': None},
     },
     'web-platform-tests': {
         'aliases': ('wpt',),
@@ -134,17 +134,20 @@ TEST_FLAVORS = {
     'chrome': {
         'mach_command': 'mochitest',
         'kwargs': {'flavor': 'chrome', 'test_paths': []},
     },
     'mochitest': {
         'mach_command': 'mochitest',
         'kwargs': {'flavor': 'mochitest', 'test_paths': []},
     },
-    'reftest': { },
+    'reftest': {
+        'mach_command': 'reftest',
+        'kwargs': {'tests': []}
+    },
     'steeplechase': { },
     'web-platform-tests': {
         'mach_command': 'web-platform-tests',
         'kwargs': {'include': []}
     },
     'webapprt-chrome': {
         'mach_command': 'mochitest',
         'kwargs': {'flavor': 'webapprt-chrome', 'test_paths': []},