Bug 1193223 - Add reftest support to mach test, r=chmanchester
☠☠ backed out by fa0a54cadfd0 ☠ ☠
authorJames Graham <james@hoppipolla.co.uk>
Tue, 08 Sep 2015 15:30:08 +0100
changeset 262260 985f984a97ad034d82ba5fa720863c9768d89baa
parent 262259 6137013d4933c6fb423bc7561c0a9ae7f03ebc1c
child 262261 24f4ad5c55ccfbe237be5b1a4196ac33b893a3e6
push id64965
push userjames@hoppipolla.co.uk
push dateMon, 14 Sep 2015 08:47:16 +0000
treeherdermozilla-inbound@e768739ec812 [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': []},