mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 22:35:43 +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, [])):
|
for path in sorted(self._tests_by_flavor.get(flavor, [])):
|
||||||
yield self._tests_by_path[path]
|
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.
|
"""Resolve tests from an identifier.
|
||||||
|
|
||||||
This is a generator of dicts describing each test.
|
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
|
If ``subsuite`` is a string, it will be used to filter returned tests
|
||||||
to only be in the subsuite specified.
|
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):
|
def fltr(tests):
|
||||||
for test in tests:
|
for test in tests:
|
||||||
if flavor:
|
if flavor:
|
||||||
@ -105,6 +112,9 @@ class TestMetadata(object):
|
|||||||
if subsuite and test.get('subsuite') != subsuite:
|
if subsuite and test.get('subsuite') != subsuite:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if tags and not (tags & set(test.get('tags', '').split())):
|
||||||
|
continue
|
||||||
|
|
||||||
if under_path \
|
if under_path \
|
||||||
and not test['file_relpath'].startswith(under_path):
|
and not test['file_relpath'].startswith(under_path):
|
||||||
continue
|
continue
|
||||||
|
@ -387,9 +387,9 @@ class JsapiTestsCommand(MachCommandBase):
|
|||||||
@CommandProvider
|
@CommandProvider
|
||||||
class PushToTry(MachCommandBase):
|
class PushToTry(MachCommandBase):
|
||||||
|
|
||||||
def validate_args(self, paths, tests, builds, platforms):
|
def validate_args(self, paths, tests, tags, builds, platforms):
|
||||||
if not len(paths) and not tests:
|
if not any([len(paths), tests, tags]):
|
||||||
print("Paths or tests must be specified as an argument to autotry.")
|
print("Paths, tests, or tags must be specified.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if platforms is None:
|
if platforms is None:
|
||||||
@ -431,7 +431,7 @@ class PushToTry(MachCommandBase):
|
|||||||
'syntax and selection info).')
|
'syntax and selection info).')
|
||||||
def autotry(self, builds=None, platforms=None, paths=None, verbose=None,
|
def autotry(self, builds=None, platforms=None, paths=None, verbose=None,
|
||||||
extra_tests=None, push=None, tags=None, tests=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
|
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.
|
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).
|
is taken from the AUTOTRY_PLATFORM_HINT environment variable if set).
|
||||||
|
|
||||||
Tests may be further filtered by passing one or more --tag to the
|
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
|
To run suites in addition to those determined from the tree, they
|
||||||
can be passed to the --extra arguent.
|
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.")
|
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)
|
resolver = self._spawn(TestResolver)
|
||||||
|
|
||||||
at = AutoTry(self.topsrcdir, resolver, self._mach_context)
|
at = AutoTry(self.topsrcdir, resolver, self._mach_context)
|
||||||
@ -473,7 +475,7 @@ class PushToTry(MachCommandBase):
|
|||||||
driver = self._spawn(BuildDriver)
|
driver = self._spawn(BuildDriver)
|
||||||
driver.install_tests(remove=False)
|
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:
|
if not manifests_by_flavor and not tests:
|
||||||
print("No tests were found when attempting to resolve paths:\n\n\t%s" %
|
print("No tests were found when attempting to resolve paths:\n\n\t%s" %
|
||||||
|
@ -37,14 +37,13 @@ class AutoTry(object):
|
|||||||
else:
|
else:
|
||||||
self._use_git = True
|
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)
|
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:
|
for t in tests:
|
||||||
if t['flavor'] in AutoTry.test_flavors:
|
if t['flavor'] in AutoTry.test_flavors:
|
||||||
flavor = t['flavor']
|
flavor = t['flavor']
|
||||||
|
Loading…
Reference in New Issue
Block a user