mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 12:55:46 +00:00
Bug 1183232 - Allow selecting tests and suites with just a tag from mach try. r=ahal,gps
--HG-- extra : commitid : 7vcXR0ipE8b
This commit is contained in:
parent
ca276a1334
commit
46566aee20
@ -72,7 +72,8 @@ class TestMetadata(object):
|
||||
for path in sorted(self._tests_by_flavor.get(flavor, [])):
|
||||
yield self._tests_by_path[path]
|
||||
|
||||
def resolve_tests(self, paths=None, flavor=None, subsuite=None, under_path=None):
|
||||
def resolve_tests(self, paths=None, flavor=None, subsuite=None, under_path=None,
|
||||
tags=None):
|
||||
"""Resolve tests from an identifier.
|
||||
|
||||
This is a generator of dicts describing each test.
|
||||
@ -94,7 +95,13 @@ class TestMetadata(object):
|
||||
|
||||
If ``subsuite`` is a string, it will be used to filter returned tests
|
||||
to only be in the subsuite specified.
|
||||
|
||||
If ``tags`` are specified, they will be used to filter returned tests
|
||||
to only those with a matching tag.
|
||||
"""
|
||||
if tags:
|
||||
tags = set(tags)
|
||||
|
||||
def fltr(tests):
|
||||
for test in tests:
|
||||
if flavor:
|
||||
@ -105,6 +112,9 @@ class TestMetadata(object):
|
||||
if subsuite and test.get('subsuite') != subsuite:
|
||||
continue
|
||||
|
||||
if tags and not (tags & set(test.get('tags', '').split())):
|
||||
continue
|
||||
|
||||
if under_path \
|
||||
and not test['file_relpath'].startswith(under_path):
|
||||
continue
|
||||
|
@ -387,9 +387,9 @@ class JsapiTestsCommand(MachCommandBase):
|
||||
@CommandProvider
|
||||
class PushToTry(MachCommandBase):
|
||||
|
||||
def validate_args(self, paths, tests, builds, platforms):
|
||||
if not len(paths) and not tests:
|
||||
print("Paths or tests must be specified as an argument to autotry.")
|
||||
def validate_args(self, paths, tests, tags, builds, platforms):
|
||||
if not any([len(paths), tests, tags]):
|
||||
print("Paths, tests, or tags must be specified.")
|
||||
sys.exit(1)
|
||||
|
||||
if platforms is None:
|
||||
@ -431,7 +431,7 @@ class PushToTry(MachCommandBase):
|
||||
'syntax and selection info).')
|
||||
def autotry(self, builds=None, platforms=None, paths=None, verbose=None,
|
||||
extra_tests=None, push=None, tags=None, tests=None):
|
||||
"""Autotry is in beta, please file bugs blocking 1149670.
|
||||
"""mach try is under development, please file bugs blocking 1149670.
|
||||
|
||||
Pushes the specified tests to try. The simplest way to specify tests is
|
||||
by using the -u argument, which will behave as usual for try syntax.
|
||||
@ -445,7 +445,9 @@ class PushToTry(MachCommandBase):
|
||||
is taken from the AUTOTRY_PLATFORM_HINT environment variable if set).
|
||||
|
||||
Tests may be further filtered by passing one or more --tag to the
|
||||
command.
|
||||
command. If one or more --tag is specified with out paths or -u,
|
||||
tests with the given tags will be run in a single chunk of
|
||||
applicable suites.
|
||||
|
||||
To run suites in addition to those determined from the tree, they
|
||||
can be passed to the --extra arguent.
|
||||
@ -462,7 +464,7 @@ class PushToTry(MachCommandBase):
|
||||
|
||||
print("mach try is under development, please file bugs blocking 1149670.")
|
||||
|
||||
builds, platforms = self.validate_args(paths, tests, builds, platforms)
|
||||
builds, platforms = self.validate_args(paths, tests, tags, builds, platforms)
|
||||
resolver = self._spawn(TestResolver)
|
||||
|
||||
at = AutoTry(self.topsrcdir, resolver, self._mach_context)
|
||||
@ -473,7 +475,7 @@ class PushToTry(MachCommandBase):
|
||||
driver = self._spawn(BuildDriver)
|
||||
driver.install_tests(remove=False)
|
||||
|
||||
manifests_by_flavor = at.manifests_by_flavor(paths)
|
||||
manifests_by_flavor = at.resolve_manifests(paths=paths, tags=tags)
|
||||
|
||||
if not manifests_by_flavor and not tests:
|
||||
print("No tests were found when attempting to resolve paths:\n\n\t%s" %
|
||||
|
@ -37,14 +37,13 @@ class AutoTry(object):
|
||||
else:
|
||||
self._use_git = True
|
||||
|
||||
def manifests_by_flavor(self, paths):
|
||||
def resolve_manifests(self, paths=None, tags=None):
|
||||
assert tags or paths
|
||||
tests = list(self.resolver.resolve_tests(tags=tags,
|
||||
paths=paths,
|
||||
cwd=self.mach_context.cwd))
|
||||
manifests_by_flavor = defaultdict(set)
|
||||
|
||||
if not paths:
|
||||
return dict(manifests_by_flavor)
|
||||
|
||||
tests = list(self.resolver.resolve_tests(paths=paths,
|
||||
cwd=self.mach_context.cwd))
|
||||
for t in tests:
|
||||
if t['flavor'] in AutoTry.test_flavors:
|
||||
flavor = t['flavor']
|
||||
|
Loading…
Reference in New Issue
Block a user