mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1909512 - Update taskgraph to support reftest in the decision task r=jmaher,taskgraph-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D218379
This commit is contained in:
parent
4284000fe4
commit
497f73ed35
@ -46,6 +46,7 @@ export function ReadTopManifest(aFileURL, aFilter, aManifestID) {
|
||||
|
||||
// Note: If you materially change the reftest manifest parsing,
|
||||
// please keep the parser in layout/tools/reftest/__init__.py in sync.
|
||||
// (in particular keep CONDITIONS_JS_TO_MP in sync)
|
||||
// eslint-disable-next-line complexity
|
||||
function ReadManifest(aURL, aFilter, aManifestID) {
|
||||
// Ensure each manifest is only read once. This assumes that manifests that
|
||||
@ -86,6 +87,10 @@ function ReadManifest(aURL, aFilter, aManifestID) {
|
||||
}
|
||||
return sandbox;
|
||||
}
|
||||
var reftest_tests = Services.prefs.getStringPref("reftest.tests", {});
|
||||
var reftest_tests_len = Object.keys(reftest_tests).length;
|
||||
var reftest_manifests = Services.prefs.getStringPref("reftest.manifests", {});
|
||||
var reftest_manifests_len = Object.keys(reftest_manifests).length;
|
||||
|
||||
var lineNo = 0;
|
||||
var urlprefix = "";
|
||||
@ -442,7 +447,9 @@ function ReadManifest(aURL, aFilter, aManifestID) {
|
||||
newManifestID = included;
|
||||
}
|
||||
}
|
||||
ReadManifest(incURI, aFilter, newManifestID);
|
||||
if (reftest_tests_len && !reftest_manifests_len) {
|
||||
ReadManifest(incURI, aFilter, newManifestID);
|
||||
}
|
||||
}
|
||||
} else if (items[0] == TYPE_LOAD || items[0] == TYPE_SCRIPT) {
|
||||
let type = items[0];
|
||||
|
@ -35,6 +35,28 @@ PREF_ITEMS = (
|
||||
"ref-pref",
|
||||
)
|
||||
RE_ANNOTATION = re.compile(r"(.*)\((.*)\)")
|
||||
# NOTE: CONDITIONS_JS_TO_MP should cover the known conditions as found by
|
||||
# https://searchfox.org/mozilla-central/search?q=skip-if.*+include&path=&case=false®exp=true
|
||||
# AND must be kept in sync with the parsers
|
||||
# https://searchfox.org/mozilla-central/source/layout/tools/reftest/manifest.sys.mjs#47
|
||||
CONDITIONS_JS_TO_MP = { # Manifestparser expression grammar
|
||||
"Android": "(os == 'android')",
|
||||
"geckoview": "(os == 'android')",
|
||||
"useDrawSnapshot": "snapshot",
|
||||
"winWidget": "(os == 'win')",
|
||||
"win11_2009": "(os == 'win')",
|
||||
"cocoaWidget": "(os == 'mac')",
|
||||
"appleSilicon": "(os == 'mac' && processor == 'aarch64')",
|
||||
"gtkWidget": "(os == 'linux')",
|
||||
"isDebugBuild": "debug",
|
||||
"ThreadSanitizer": "tsan",
|
||||
"AddressSanitizer": "asan",
|
||||
"is64Bit": "(bits == 64)",
|
||||
"wayland": "(display == 'wayland')",
|
||||
"isCoverageBuild": "ccov",
|
||||
"&&": " && ",
|
||||
"||": " || ",
|
||||
}
|
||||
|
||||
|
||||
class ReftestManifest(object):
|
||||
@ -48,13 +70,35 @@ class ReftestManifest(object):
|
||||
self.tests = []
|
||||
self.finder = finder
|
||||
|
||||
def load(self, path):
|
||||
def translate_condition_for_mozinfo(self, annotation):
|
||||
m = RE_ANNOTATION.match(annotation)
|
||||
if not m and annotation != "skip":
|
||||
return annotation, ""
|
||||
|
||||
if annotation == "skip":
|
||||
key = "skip-if"
|
||||
condition = "true"
|
||||
else:
|
||||
key = m.group(1)
|
||||
condition = m.group(2)
|
||||
for js in CONDITIONS_JS_TO_MP:
|
||||
mp = CONDITIONS_JS_TO_MP[js]
|
||||
condition = condition.replace(js, mp)
|
||||
|
||||
return key, condition
|
||||
|
||||
def get_skip_if_for_mozinfo(self, parent_skip_if, annotations):
|
||||
skip_if = parent_skip_if
|
||||
for annotation in annotations:
|
||||
key, condition = self.translate_condition_for_mozinfo(annotation)
|
||||
if key == "skip-if" and condition:
|
||||
skip_if = "\n".join([t for t in [skip_if, condition] if t])
|
||||
return skip_if
|
||||
|
||||
def load(self, path, parent_skip_if=""):
|
||||
"""Parse a reftest manifest file."""
|
||||
|
||||
def add_test(file, annotations, referenced_test=None):
|
||||
# We can't package about:, data:, or chrome: URIs.
|
||||
# Discarding data isn't correct for a parser. But retaining
|
||||
# all data isn't currently a requirement.
|
||||
def add_test(file, annotations, referenced_test=None, skip_if=""):
|
||||
if RE_PROTOCOL.match(file):
|
||||
return
|
||||
test = os.path.normpath(os.path.join(mdir, urlprefix + file))
|
||||
@ -75,15 +119,18 @@ class ReftestManifest(object):
|
||||
}
|
||||
if referenced_test:
|
||||
test_dict["referenced-test"] = referenced_test
|
||||
|
||||
if skip_if:
|
||||
# when we pass in a skip_if but there isn't one inside the manifest
|
||||
# (i.e. no annotations), it is important to add the inherited skip-if
|
||||
test_dict["skip-if"] = skip_if
|
||||
|
||||
for annotation in annotations:
|
||||
m = RE_ANNOTATION.match(annotation)
|
||||
if m:
|
||||
if m.group(1) not in test_dict:
|
||||
test_dict[m.group(1)] = m.group(2)
|
||||
else:
|
||||
test_dict[m.group(1)] += ";" + m.group(2)
|
||||
else:
|
||||
test_dict[annotation] = None
|
||||
key, condition = self.translate_condition_for_mozinfo(annotation)
|
||||
test_dict[key] = "\n".join(
|
||||
[t for t in [test_dict.get(key, ""), condition] if t]
|
||||
)
|
||||
|
||||
self.tests.append(test_dict)
|
||||
|
||||
normalized_path = os.path.normpath(os.path.abspath(path))
|
||||
@ -125,8 +172,8 @@ class ReftestManifest(object):
|
||||
|
||||
items = defaults + items
|
||||
annotations = []
|
||||
for i in range(len(items)):
|
||||
item = items[i]
|
||||
for j in range(len(items)):
|
||||
item = items[j]
|
||||
|
||||
if item.startswith(FAILURE_TYPES) or item.startswith(PREF_ITEMS):
|
||||
annotations += [item]
|
||||
@ -140,25 +187,26 @@ class ReftestManifest(object):
|
||||
self.dirs.add(os.path.normpath(os.path.join(mdir, m.group(1))))
|
||||
continue
|
||||
|
||||
if i < len(defaults):
|
||||
if j < len(defaults):
|
||||
raise ValueError(
|
||||
"Error parsing manifest {}, line {}: "
|
||||
"Invalid defaults token '{}'".format(path, lineno, item)
|
||||
)
|
||||
|
||||
if item == "url-prefix":
|
||||
urlprefix = items[i + 1]
|
||||
urlprefix = items[j + 1]
|
||||
break
|
||||
|
||||
if item == "include":
|
||||
self.load(os.path.join(mdir, items[i + 1]))
|
||||
skip_if = self.get_skip_if_for_mozinfo(parent_skip_if, annotations)
|
||||
self.load(os.path.join(mdir, items[j + 1]), skip_if)
|
||||
break
|
||||
|
||||
if item == "load" or item == "script":
|
||||
add_test(items[i + 1], annotations)
|
||||
add_test(items[j + 1], annotations, None, parent_skip_if)
|
||||
break
|
||||
|
||||
if item == "==" or item == "!=" or item == "print":
|
||||
add_test(items[i + 1], annotations)
|
||||
add_test(items[i + 2], annotations, items[i + 1])
|
||||
add_test(items[j + 1], annotations, None, parent_skip_if)
|
||||
add_test(items[j + 2], annotations, items[j + 1], parent_skip_if)
|
||||
break
|
||||
|
@ -144,6 +144,10 @@ def mock_mozinfo():
|
||||
headless=False,
|
||||
tsan=False,
|
||||
tag="[]",
|
||||
mingwclang=False,
|
||||
nightly_build=False,
|
||||
repo="try",
|
||||
crashreporter=False,
|
||||
):
|
||||
return {
|
||||
"os": os,
|
||||
|
@ -75,8 +75,13 @@ def guess_mozinfo_from_task(task, repo="", test_tags=[]):
|
||||
"ccov": setting["build"].get("ccov", False),
|
||||
"debug": setting["build"]["type"] in ("debug", "debug-isolated-process"),
|
||||
"tsan": setting["build"].get("tsan", False),
|
||||
"mingwclang": setting["build"].get("mingwclang", False),
|
||||
"nightly_build": repo in ["mozilla-central", "autoland", "try", ""], # trunk
|
||||
"repo": repo,
|
||||
}
|
||||
# the following are used to evaluate reftest skip-if
|
||||
info["release_or_beta"] = not info["nightly_build"] # TO BE VALIDATED
|
||||
info["webrtc"] = not info["mingwclang"]
|
||||
|
||||
for platform in ("android", "linux", "mac", "win"):
|
||||
if p_os["name"].startswith(platform):
|
||||
@ -112,14 +117,16 @@ def guess_mozinfo_from_task(task, repo="", test_tags=[]):
|
||||
info["toolkit"] = "cocoa"
|
||||
else:
|
||||
info["toolkit"] = "gtk"
|
||||
info["display"] = setting["platform"].get("display", "x11")
|
||||
|
||||
# guess os_version
|
||||
os_versions = {
|
||||
("linux", "1804"): "18.04",
|
||||
("macosx", "1015"): "10.15",
|
||||
("macosx", "1100"): "11.00",
|
||||
("windows", "10"): "10.0",
|
||||
("windows", "11"): "11.0",
|
||||
("macosx", "1100"): "11.20",
|
||||
("macosx", "1400"): "14.40",
|
||||
("windows", "10"): "10.2009",
|
||||
("windows", "11"): "11.2009",
|
||||
}
|
||||
for (name, old_ver), new_ver in os_versions.items():
|
||||
if p_os["name"] == name and p_os["version"] == old_ver:
|
||||
@ -264,8 +271,8 @@ class DefaultLoader(BaseManifestLoader):
|
||||
)
|
||||
|
||||
@memoize
|
||||
def get_manifests(self, suite, mozinfo):
|
||||
mozinfo = dict(mozinfo)
|
||||
def get_manifests(self, suite, frozen_mozinfo):
|
||||
mozinfo = dict(frozen_mozinfo)
|
||||
# Compute all tests for the given suite/subsuite.
|
||||
tests = self.get_tests(suite)
|
||||
|
||||
|
@ -11,7 +11,7 @@ task-defaults:
|
||||
android-hw-.*: geckoview-test_runner.apk
|
||||
default: null
|
||||
tier: default
|
||||
test-manifest-loader: null # don't load tests in the taskgraph
|
||||
test-manifest-loader: default
|
||||
mozharness:
|
||||
script:
|
||||
by-test-platform:
|
||||
@ -96,6 +96,7 @@ crashtest-qr:
|
||||
description: "Crashtest Webrender run"
|
||||
schedules-component: crashtest
|
||||
treeherder-symbol: R(C)
|
||||
test-manifest-loader: null # don't load tests in the taskgraph
|
||||
chunks: 1
|
||||
variants:
|
||||
- no-fission
|
||||
@ -112,6 +113,7 @@ jsreftest:
|
||||
schedules-component: jsreftest
|
||||
treeherder-symbol: R(J)
|
||||
instance-size: default
|
||||
test-manifest-loader: null # don't load tests in the taskgraph
|
||||
chunks:
|
||||
by-test-platform:
|
||||
android-hw.*\/debug: 12
|
||||
@ -257,6 +259,7 @@ reftest-qr:
|
||||
description: "Reftest webrender run"
|
||||
treeherder-symbol: R(R)
|
||||
chunks: 2
|
||||
test-manifest-loader: null # don't load tests in the taskgraph
|
||||
variants:
|
||||
- no-fission
|
||||
- webrender-sw+no-fission
|
||||
|
@ -50,7 +50,7 @@ def test_only_important_manifests(params, full_task_graph, filter_tasks):
|
||||
]
|
||||
|
||||
# Manifest scheduling is disabled for mochitest-ally.
|
||||
if attr("unittest_suite") == "mochitest-a11y":
|
||||
if attr("unittest_suite") in ["mochitest-a11y", "crashtest", "reftest"]:
|
||||
assert len(unimportant) > 0
|
||||
else:
|
||||
assert unimportant == []
|
||||
|
@ -741,7 +741,10 @@ class TestResolver(MozbuildObject):
|
||||
if flavor != "devtools" and test.get("flavor") != flavor:
|
||||
continue
|
||||
|
||||
if subsuite and test.get("subsuite", "undefined") != subsuite:
|
||||
test_subsuite = test.get("subsuite", "undefined")
|
||||
if not test_subsuite: # sometimes test['subsuite'] == ''
|
||||
test_subsuite = "undefined"
|
||||
if subsuite and test_subsuite != subsuite:
|
||||
continue
|
||||
|
||||
test_tags = set(test.get("tags", "").split())
|
||||
|
Loading…
Reference in New Issue
Block a user