зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1413928 - [tryselect] Add a new 'path' template r=maja_zf
This sets the MOZHARNESS_TEST_PATHS environment variables for all tasks. When specifying paths, this will cause many test tasks to only run the tests under that directory as opposed to the normal default. MozReview-Commit-ID: IHRXXi5mB4G --HG-- extra : rebase_source : e7132311641f4d36a5bff56424988fbb3ae87238
This commit is contained in:
Родитель
28b0ebdf63
Коммит
9b0698e9b6
|
@ -10,12 +10,15 @@ tasks. They live under taskcluster/taskgraph/templates.
|
|||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import os
|
||||
import sys
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from argparse import Action
|
||||
|
||||
import mozpack.path as mozpath
|
||||
from mozbuild.base import BuildEnvironmentNotFoundException, MozbuildObject
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
build = MozbuildObject.from_environment(cwd=here)
|
||||
|
||||
|
||||
class Template(object):
|
||||
|
@ -48,7 +51,6 @@ class Artifact(Template):
|
|||
if no_artifact:
|
||||
return
|
||||
|
||||
build = MozbuildObject.from_environment(cwd=here)
|
||||
try:
|
||||
if build.substs.get("MOZ_ARTIFACT_BUILDS"):
|
||||
print("Artifact builds enabled, pass --no-artifact to disable")
|
||||
|
@ -59,6 +61,30 @@ class Artifact(Template):
|
|||
pass
|
||||
|
||||
|
||||
class Path(Template):
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('paths', nargs='*',
|
||||
help='Run tasks containing tests under the specified path(s).')
|
||||
|
||||
def context(self, paths, **kwargs):
|
||||
if not paths:
|
||||
return
|
||||
|
||||
for p in paths:
|
||||
if not os.path.exists(p):
|
||||
print("error: '{}' is not a valid path.".format(p), file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
paths = [mozpath.relpath(mozpath.join(os.getcwd(), p), build.topsrcdir) for p in paths]
|
||||
return {
|
||||
'env': {
|
||||
# can't use os.pathsep as machine splitting could be a different platform
|
||||
'MOZHARNESS_TEST_PATHS': ':'.join(paths),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Environment(Template):
|
||||
|
||||
def add_arguments(self, parser):
|
||||
|
@ -107,6 +133,7 @@ class Rebuild(Template):
|
|||
|
||||
all_templates = {
|
||||
'artifact': Artifact,
|
||||
'path': Path,
|
||||
'env': Environment,
|
||||
'rebuild': Rebuild,
|
||||
}
|
||||
|
|
|
@ -23,6 +23,13 @@ TEMPLATE_TESTS = {
|
|||
([], None),
|
||||
(['--env', 'foo=bar', '--env', 'num=10'], {'env': {'foo': 'bar', 'num': '10'}}),
|
||||
],
|
||||
'path': [
|
||||
([], None),
|
||||
(['dom/indexedDB'], {'env': {'MOZHARNESS_TEST_PATHS': 'dom/indexedDB'}}),
|
||||
(['dom/indexedDB', 'testing'],
|
||||
{'env': {'MOZHARNESS_TEST_PATHS': 'dom/indexedDB:testing'}}),
|
||||
(['invalid/path'], SystemExit),
|
||||
],
|
||||
'rebuild': [
|
||||
([], None),
|
||||
(['--rebuild', '10'], {'rebuild': 10}),
|
||||
|
|
Загрузка…
Ссылка в новой задаче