mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 938712 - Implement mach mochitest; r=AutomatedTester
The `mach mochitest` command is now implemented. Given test path arguments, it will identify mochitests of any flavor and run the appropriate mochitest suite. If tests from multiple suites are present, it will invoke each suite separately. Although, the output in this mode isn't very friendly. There are a number of enhancements that could be made to this command, including the abilities to filter by flavor and sub-suite. These will come in another patch. --HG-- extra : rebase_source : 9be6000e6bb508ef0c980eda9f9ebe03a4c0f02a
This commit is contained in:
parent
f48009797f
commit
8f52faa679
@ -57,6 +57,14 @@ If you do not have a non-debug gaia profile, you can build one:
|
||||
The profile should be generated in a directory called 'profile'.
|
||||
'''.lstrip()
|
||||
|
||||
# Maps test flavors to mochitest suite type.
|
||||
FLAVORS = {
|
||||
'mochitest': 'plain',
|
||||
'chrome': 'chrome',
|
||||
'browser-chrome': 'browser',
|
||||
'a11y': 'a11y',
|
||||
'webapprt-chrome': 'webapprt-chrome',
|
||||
}
|
||||
|
||||
class UnexpectedFilter(logging.Filter):
|
||||
def filter(self, record):
|
||||
@ -658,7 +666,49 @@ class MachCommands(MachCommandBase):
|
||||
def run_mochitest_webapprt_content(self, test_paths, **kwargs):
|
||||
return self.run_mochitest(test_paths, 'webapprt-content', **kwargs)
|
||||
|
||||
def run_mochitest(self, test_paths, flavor, **kwargs):
|
||||
@Command('mochitest', category='testing',
|
||||
conditions=[conditions.is_firefox],
|
||||
description='Run any flavor of mochitest.')
|
||||
@MochitestCommand
|
||||
def run_mochitest_general(self, test_paths, **kwargs):
|
||||
self._preruntest()
|
||||
|
||||
from mozbuild.testing import TestResolver
|
||||
|
||||
resolver = self._spawn(TestResolver)
|
||||
tests = list(resolver.resolve_tests(paths=test_paths,
|
||||
cwd=self._mach_context.cwd))
|
||||
|
||||
# Our current approach is to group the tests by suite and then perform
|
||||
# an invocation for each suite. Ideally, this would be done
|
||||
# automatically inside of core mochitest code. But it wasn't designed
|
||||
# to do that.
|
||||
#
|
||||
# This does mean our output is less than ideal. When running tests from
|
||||
# multiple suites, we see redundant summary lines. Hopefully once we
|
||||
# have better machine readable output coming from mochitest land we can
|
||||
# aggregate that here and improve the output formatting.
|
||||
|
||||
suites = {}
|
||||
for test in tests:
|
||||
if test['flavor'] not in FLAVORS:
|
||||
continue
|
||||
|
||||
suite = FLAVORS[test['flavor']]
|
||||
suites.setdefault(suite, []).append(test)
|
||||
|
||||
mochitest = self._spawn(MochitestRunner)
|
||||
overall = None
|
||||
for suite, tests in sorted(suites.items()):
|
||||
result = mochitest.run_desktop_test(self._mach_context,
|
||||
test_paths=[test['file_relpath'] for test in tests], suite=suite,
|
||||
**kwargs)
|
||||
if result:
|
||||
overall = result
|
||||
|
||||
return overall
|
||||
|
||||
def _preruntest(self):
|
||||
from mozbuild.controller.building import BuildDriver
|
||||
|
||||
self._ensure_state_subdir_exists('.')
|
||||
@ -666,6 +716,9 @@ class MachCommands(MachCommandBase):
|
||||
driver = self._spawn(BuildDriver)
|
||||
driver.install_tests(remove=False)
|
||||
|
||||
def run_mochitest(self, test_paths, flavor, **kwargs):
|
||||
self._preruntest()
|
||||
|
||||
mochitest = self._spawn(MochitestRunner)
|
||||
|
||||
return mochitest.run_desktop_test(self._mach_context,
|
||||
|
Loading…
Reference in New Issue
Block a user