Bug 938712 - Add --flavor to mach mochitest; r=AutomatedTester

`mach mochitest` now accepts a --flavor argument to limit execution to
tests of a certain flavor. Executing `mach mochitest --flavor=X` should
be equivalent to executing `mach mochitest-X`.

This paves the road to deprecating the various `mach mochitest-X`
commands.

--HG--
extra : rebase_source : 0f8370425f54a4ec86e7f668bcbff69362e017f7
This commit is contained in:
Gregory Szorc 2014-06-17 15:49:41 -07:00
parent b3a110713e
commit c15e536e73

View File

@ -670,7 +670,9 @@ class MachCommands(MachCommandBase):
conditions=[conditions.is_firefox],
description='Run any flavor of mochitest.')
@MochitestCommand
def run_mochitest_general(self, test_paths, **kwargs):
@CommandArgument('-f', '--flavor', choices=FLAVORS.keys(),
help='Only run tests of this flavor.')
def run_mochitest_general(self, test_paths, flavor=None, **kwargs):
self._preruntest()
from mozbuild.testing import TestResolver
@ -691,9 +693,13 @@ class MachCommands(MachCommandBase):
suites = {}
for test in tests:
# Filter out non-mochitests.
if test['flavor'] not in FLAVORS:
continue
if flavor and test['flavor'] != flavor:
continue
suite = FLAVORS[test['flavor']]
suites.setdefault(suite, []).append(test)