mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-23 19:09:49 +00:00
Backed out changeset dd3704031d8c (bug 1898051) for causing bug 1900644.
This commit is contained in:
parent
6f7b16b16c
commit
cff092b4d3
@ -321,9 +321,6 @@ def _try_task_config(full_task_graph, parameters, graph_config):
|
||||
if "MOZHARNESS_TEST_PATHS" in parameters["try_task_config"].get("env", {}):
|
||||
matched_tasks = [x for x in matched_tasks if x.endswith("-1")]
|
||||
|
||||
if "MOZHARNESS_TEST_TAG" in parameters["try_task_config"].get("env", {}):
|
||||
matched_tasks = [x for x in matched_tasks if x.endswith("-1")]
|
||||
|
||||
selected_tasks = set(tasks) | set(matched_tasks)
|
||||
missing.update(selected_tasks - set(full_task_graph.tasks))
|
||||
|
||||
|
@ -143,7 +143,6 @@ def mock_mozinfo():
|
||||
fission=False,
|
||||
headless=False,
|
||||
tsan=False,
|
||||
tag="",
|
||||
):
|
||||
return {
|
||||
"os": os,
|
||||
@ -163,7 +162,6 @@ def mock_mozinfo():
|
||||
"webgpu": False,
|
||||
"webcodecs": False,
|
||||
"privatebrowsing": False,
|
||||
"tag": tag,
|
||||
}
|
||||
|
||||
return inner
|
||||
|
@ -229,12 +229,6 @@ def mozharness_test_on_docker(config, job, taskdesc):
|
||||
env["MOZHARNESS_TEST_PATHS"] = json.dumps(
|
||||
{test["suite"]: test["test-manifests"]}, sort_keys=True
|
||||
)
|
||||
elif "MOZHARNESS_TEST_TAG" in config.params["try_task_config"].get("env", {}):
|
||||
command.append(
|
||||
"--tag={}".format(
|
||||
config.params["try_task_config"]["env"]["MOZHARNESS_TEST_TAG"]
|
||||
)
|
||||
)
|
||||
|
||||
# TODO: remove the need for run['chunked']
|
||||
elif mozharness.get("chunked") or test["chunks"] > 1:
|
||||
@ -445,12 +439,6 @@ def mozharness_test_on_generic_worker(config, job, taskdesc):
|
||||
env["MOZHARNESS_TEST_PATHS"] = json.dumps(
|
||||
{test["suite"]: test["test-manifests"]}, sort_keys=True
|
||||
)
|
||||
elif "MOZHARNESS_TEST_TAG" in config.params["try_task_config"].get("env", {}):
|
||||
mh_command.append(
|
||||
"--tag={}".format(
|
||||
config.params["try_task_config"]["env"]["MOZHARNESS_TEST_TAG"]
|
||||
)
|
||||
)
|
||||
|
||||
# TODO: remove the need for run['chunked']
|
||||
elif mozharness.get("chunked") or test["chunks"] > 1:
|
||||
|
@ -92,9 +92,7 @@ def set_test_manifests(config, tasks):
|
||||
continue
|
||||
|
||||
mozinfo = guess_mozinfo_from_task(
|
||||
task,
|
||||
config.params.get("head_repository", ""),
|
||||
config.params.get("try_task_config", {}).get("env", {}),
|
||||
task, config.params.get("head_repository", "")
|
||||
)
|
||||
|
||||
loader_name = task.pop(
|
||||
@ -118,10 +116,7 @@ def set_test_manifests(config, tasks):
|
||||
config.params["try_task_config"]["env"]["MOZHARNESS_TEST_PATHS"]
|
||||
)
|
||||
|
||||
if (
|
||||
mh_test_paths
|
||||
and task["attributes"]["unittest_suite"] in mh_test_paths.keys()
|
||||
):
|
||||
if task["attributes"]["unittest_suite"] in mh_test_paths.keys():
|
||||
input_paths = mh_test_paths[task["attributes"]["unittest_suite"]]
|
||||
remaining_manifests = []
|
||||
|
||||
@ -164,14 +159,6 @@ def set_test_manifests(config, tasks):
|
||||
if remaining_manifests == []:
|
||||
continue
|
||||
|
||||
elif mh_test_paths:
|
||||
# we have test paths and they are not related to the test suite
|
||||
# this could be the test suite doesn't support test paths
|
||||
continue
|
||||
elif not task["test-manifests"]["active"]:
|
||||
# no MH_TEST_PATHS, but MH_TEST_TAG or other filters
|
||||
continue
|
||||
|
||||
# The default loader loads all manifests. If we use a non-default
|
||||
# loader, we'll only run some subset of manifests and the hardcoded
|
||||
# chunk numbers will no longer be valid. Dynamic chunking should yield
|
||||
|
@ -35,7 +35,7 @@ WPT_SUBSUITES = {
|
||||
}
|
||||
|
||||
|
||||
def guess_mozinfo_from_task(task, repo="", env={}):
|
||||
def guess_mozinfo_from_task(task, repo=""):
|
||||
"""Attempt to build a mozinfo dict from a task definition.
|
||||
|
||||
This won't be perfect and many values used in the manifests will be missing. But
|
||||
@ -136,8 +136,6 @@ def guess_mozinfo_from_task(task, repo="", env={}):
|
||||
info[tag] = True
|
||||
else:
|
||||
info[tag] = False
|
||||
|
||||
info["tag"] = env.get("MOZHARNESS_TEST_TAG", "")
|
||||
return info
|
||||
|
||||
|
||||
@ -270,12 +268,9 @@ class DefaultLoader(BaseManifestLoader):
|
||||
|
||||
manifests = {chunk_by_runtime.get_manifest(t) for t in tests}
|
||||
|
||||
filters = []
|
||||
filters = None
|
||||
if mozinfo["condprof"]:
|
||||
filters.extend([tags(["condprof"])])
|
||||
|
||||
if mozinfo["tag"]:
|
||||
filters.extend([tags([mozinfo["tag"]])])
|
||||
filters = [tags(["condprof"])]
|
||||
|
||||
# Compute the active tests.
|
||||
m = TestManifest()
|
||||
|
@ -378,13 +378,6 @@ def verify_test_packaging(task, taskgraph, scratch_pad, graph_config, parameters
|
||||
)
|
||||
)
|
||||
|
||||
test_env = parameters["try_task_config"].get("env", {})
|
||||
if test_env.get("MOZHARNESS_TEST_PATHS", "") or test_env.get(
|
||||
"MOZHARNESS_TEST_TAG", ""
|
||||
):
|
||||
# This is sort of a hack, as we are filtering, we might filter out all test jobs
|
||||
missing_tests_allowed = True
|
||||
|
||||
exceptions = []
|
||||
for task in taskgraph.tasks.values():
|
||||
if task.kind == "build" and not task.attributes.get(
|
||||
|
@ -1031,11 +1031,7 @@ class TestResolver(MozbuildObject):
|
||||
|
||||
# Now look for file/directory matches in the TestResolver.
|
||||
relpath = self._wrap_path_argument(entry).relpath()
|
||||
# since either path or tag can be defined (but not both), here we assume
|
||||
# one or none are defined, but not both
|
||||
tests = list(self.resolve_tests(paths=[relpath]))
|
||||
if not tests:
|
||||
tests = list(self.resolve_tests(tags=entry))
|
||||
run_tests.extend(tests)
|
||||
|
||||
if not tests:
|
||||
|
@ -695,8 +695,6 @@ class DesktopUnittest(TestingMixin, MercurialScript, MozbaseMixin, CodeCoverageM
|
||||
test_paths = self._get_mozharness_test_paths(suite_category, suite)
|
||||
if test_paths:
|
||||
base_cmd.extend(test_paths)
|
||||
elif c["test_tags"]:
|
||||
base_cmd.extend(["--tag={}".format(t) for t in c["test_tags"]])
|
||||
elif c.get("total_chunks") and c.get("this_chunk"):
|
||||
base_cmd.extend(
|
||||
[
|
||||
@ -754,6 +752,10 @@ class DesktopUnittest(TestingMixin, MercurialScript, MozbaseMixin, CodeCoverageM
|
||||
if c["conditioned_profile"]:
|
||||
base_cmd.append("--conditioned-profile")
|
||||
|
||||
# Ensure the --tag flag and its params get passed along
|
||||
if c["test_tags"]:
|
||||
base_cmd.extend(["--tag={}".format(t) for t in c["test_tags"]])
|
||||
|
||||
if suite_category not in c["suite_definitions"]:
|
||||
self.fatal("'%s' not defined in the config!")
|
||||
|
||||
|
@ -80,15 +80,6 @@ class MarionetteTest(TestingMixin, MercurialScript, TransferMixin, CodeCoverageM
|
||||
"tests directory",
|
||||
},
|
||||
],
|
||||
[
|
||||
["--tag"],
|
||||
{
|
||||
"action": "store",
|
||||
"dest": "test_tag",
|
||||
"default": "",
|
||||
"help": "Tag that identifies how to filter which tests to run.",
|
||||
},
|
||||
],
|
||||
[
|
||||
["--total-chunks"],
|
||||
{
|
||||
@ -348,9 +339,6 @@ class MarionetteTest(TestingMixin, MercurialScript, TransferMixin, CodeCoverageM
|
||||
|
||||
cmd = [python, "-u", os.path.join(dirs["abs_marionette_dir"], "runtests.py")]
|
||||
|
||||
if self.config.get("test_tag", ""):
|
||||
cmd.extend(["--tag", self.config["test_tag"]])
|
||||
|
||||
manifest = os.path.join(
|
||||
dirs["abs_marionette_tests_dir"], self.config["test_manifest"]
|
||||
)
|
||||
|
@ -336,50 +336,6 @@ Inside of these tasks, the reftest harness will only run tests that live under
|
||||
``layout/reftests/reftest-sanity``.
|
||||
|
||||
|
||||
Test Tags
|
||||
----------
|
||||
|
||||
Adding a test tag may be specified as positional arguments. When
|
||||
specifying a tag, the list of available tasks to choose from is filtered down such that
|
||||
only suites that have tests annotated with the specific tag. Notably, only the first
|
||||
chunk of each suite/platform appears. When the tasks are scheduled, only tests that have
|
||||
a matching tag in the manifest will be run.
|
||||
|
||||
.. note::
|
||||
|
||||
When using tags, be aware that all tests matching the tag will run in the
|
||||
same chunk. This might produce a different ordering from what gets run on production
|
||||
branches, and may yield different results.
|
||||
|
||||
For suites that restart the browser between each manifest (like mochitest), this
|
||||
shouldn't be as big of a concern.
|
||||
|
||||
The behavior with using a Tag with Paths is that a logical OR is used so all Paths that match
|
||||
and all tests within those paths which have a Tag will match.
|
||||
Tags can be used with the interactive ``fzf`` window, or using the ``-q/--query`` argument.
|
||||
For example, running:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
$ mach try fuzzy --tag indexedDB -q "!pgo !cov !asan 'linux64"
|
||||
|
||||
Would produce the following ``try_task_config.json``:
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"env":{
|
||||
"MOZHARNESS_TEST_PATHS":"{\"mochitest\":\"dom/indeedDB/test\"}"
|
||||
},
|
||||
"tasks":[
|
||||
"test-linux64-qr/debug-mochitest-e10s-1",
|
||||
"test-linux64-qr/opt-mochitest-e10s-1",
|
||||
"test-linux64/debug-mochitest-e10s-1",
|
||||
"test-linux64/opt-mochitest-e10s-1",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
.. _additional-arguments:
|
||||
|
||||
Additional Arguments
|
||||
|
@ -312,24 +312,9 @@ def try_fuzzy(command_context, **kwargs):
|
||||
if not kwargs["query"]:
|
||||
return
|
||||
|
||||
if kwargs.get("tag") and kwargs.get("paths"):
|
||||
command_context._mach_context.handler.parser.error(
|
||||
"ERROR: only --tag or <path> can be used, not both."
|
||||
)
|
||||
return
|
||||
|
||||
if len(kwargs["tag"]) > 1:
|
||||
command_context._mach_context.handler.parser.error(
|
||||
"ERROR: detected multiple tags defined."
|
||||
"please only use --tag once and provide a single value"
|
||||
)
|
||||
|
||||
if kwargs.get("paths"):
|
||||
kwargs["test_paths"] = kwargs["paths"]
|
||||
|
||||
if kwargs.get("tag"):
|
||||
kwargs["test_tag"] = kwargs["tag"]
|
||||
|
||||
return run(command_context, **kwargs)
|
||||
|
||||
|
||||
|
@ -118,7 +118,6 @@ class FuzzyParser(BaseTryParser):
|
||||
"gecko-profile",
|
||||
"new-test-config",
|
||||
"path",
|
||||
"test-tag",
|
||||
"pernosco",
|
||||
"rebuild",
|
||||
"routes",
|
||||
@ -138,7 +137,6 @@ def run(
|
||||
dry_run=False,
|
||||
message="{msg}",
|
||||
test_paths=None,
|
||||
test_tag=None,
|
||||
exact=False,
|
||||
closed_tree=False,
|
||||
show_estimates=False,
|
||||
@ -189,8 +187,8 @@ def run(
|
||||
if not all_tasks:
|
||||
return 1
|
||||
|
||||
if test_paths or test_tag:
|
||||
all_tasks = filter_tasks_by_paths(all_tasks, test_paths, tag=test_tag)
|
||||
if test_paths:
|
||||
all_tasks = filter_tasks_by_paths(all_tasks, test_paths)
|
||||
if not all_tasks:
|
||||
return 1
|
||||
|
||||
|
@ -236,29 +236,6 @@ class Path(TryConfig):
|
||||
}
|
||||
|
||||
|
||||
class Tag(TryConfig):
|
||||
arguments = [
|
||||
[
|
||||
["--tag"],
|
||||
{
|
||||
"action": "append",
|
||||
"default": [],
|
||||
"help": "Run tests matching the specified tag.",
|
||||
},
|
||||
],
|
||||
]
|
||||
|
||||
def try_config(self, tag, **kwargs):
|
||||
if not tag:
|
||||
return
|
||||
|
||||
return {
|
||||
"env": {
|
||||
"MOZHARNESS_TEST_TAG": tag[0],
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Environment(TryConfig):
|
||||
arguments = [
|
||||
[
|
||||
@ -672,7 +649,6 @@ all_task_configs = {
|
||||
"gecko-profile": GeckoProfile,
|
||||
"new-test-config": NewConfig,
|
||||
"path": Path,
|
||||
"test-tag": Tag,
|
||||
"pernosco": Pernosco,
|
||||
"rebuild": Rebuild,
|
||||
"routes": Routes,
|
||||
|
@ -163,17 +163,9 @@ def filter_tasks_by_worker_type(tasks, params):
|
||||
return tasks
|
||||
|
||||
|
||||
def filter_tasks_by_paths(tasks, paths=[], tag=""):
|
||||
def filter_tasks_by_paths(tasks, paths):
|
||||
resolver = TestResolver.from_environment(cwd=here, loader_cls=TestManifestLoader)
|
||||
|
||||
if paths:
|
||||
run_suites, run_tests = resolver.resolve_metadata(paths)
|
||||
elif not paths and tag:
|
||||
run_tests = list(resolver.resolve_tests(paths=[], tags=tag))
|
||||
|
||||
if not run_tests:
|
||||
return {}
|
||||
|
||||
run_suites, run_tests = resolver.resolve_metadata(paths)
|
||||
flavors = {(t["flavor"], t.get("subsuite")) for t in run_tests}
|
||||
|
||||
task_regexes = set()
|
||||
|
@ -121,74 +121,5 @@ def test_query(run_mach, capfd, full):
|
||||
assert tasks == ["source-test-python-taskgraph-tests-py3"]
|
||||
|
||||
|
||||
@pytest.mark.skipif(os.name == "nt", reason="fzf not installed on host")
|
||||
@pytest.mark.parametrize("tag", ["webextensions", "not_a_valid_tag"])
|
||||
def test_query_tags(run_mach, capfd, tag):
|
||||
cmd = [
|
||||
"try",
|
||||
"fuzzy",
|
||||
"--no-push",
|
||||
"--tag",
|
||||
tag,
|
||||
"-q",
|
||||
"^test-linux '64-qr/debug- !http !spi !swr !nofis !headless !xorig",
|
||||
]
|
||||
if tag == "not_a_valid_tag":
|
||||
assert run_mach(cmd) == 1
|
||||
else:
|
||||
assert run_mach(cmd) == 0
|
||||
|
||||
output = capfd.readouterr().out
|
||||
print(output)
|
||||
|
||||
expected = [
|
||||
"test-linux1804-64-qr/debug-mochitest-devtools-chrome-*",
|
||||
"test-linux1804-64-qr/debug-mochitest-chrome-1proc-*",
|
||||
"test-linux1804-64-qr/debug-mochitest-chrome-gpu-1proc",
|
||||
"test-linux1804-64-qr/debug-mochitest-plain-*",
|
||||
"test-linux1804-64-qr/debug-mochitest-plain-gpu",
|
||||
"test-linux1804-64-qr/debug-xpcshell-*",
|
||||
"test-linux1804-64-qr/debug-test-verify",
|
||||
"test-linux1804-64-qr/debug-test-verify-gpu",
|
||||
"test-linux1804-64-qr/debug-test-verify-wpt",
|
||||
]
|
||||
|
||||
delim = "Calculated try_task_config.json:"
|
||||
index = output.find(delim)
|
||||
result = json.loads(output[index + len(delim) :])
|
||||
tasks = result["parameters"]["try_task_config"]["tasks"]
|
||||
assert sorted(tasks) == sorted(expected)
|
||||
|
||||
|
||||
@pytest.mark.skipif(os.name == "nt", reason="fzf not installed on host")
|
||||
@pytest.mark.parametrize(
|
||||
"tag",
|
||||
[
|
||||
{"tags": ["webextensions"], "results": 0},
|
||||
{"tags": ["webextensions", "devtools"], "results": 2},
|
||||
],
|
||||
)
|
||||
def test_query_multiple_tags(run_mach, capfd, tag):
|
||||
cmd = [
|
||||
"try",
|
||||
"fuzzy",
|
||||
"--no-push",
|
||||
"-q",
|
||||
"^test-linux '64-qr/debug- !http !spi !swr !nofis !headless !xorig",
|
||||
]
|
||||
for t in tag["tags"]:
|
||||
cmd.extend(["--tag", t])
|
||||
|
||||
if tag["results"] == 0:
|
||||
assert run_mach(cmd) == 0
|
||||
else:
|
||||
with pytest.raises(SystemExit) as result:
|
||||
run_mach(cmd)
|
||||
assert result.value.code == tag["results"]
|
||||
|
||||
output = capfd.readouterr().out
|
||||
print(output)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
mozunit.main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user