Backed out changeset c1fa40b0bc3e (bug 1909512) for causinf python failures CLOSED TREE

This commit is contained in:
Noemi Erli 2024-08-02 23:09:55 +03:00
parent 5d28ac8fbb
commit 8e8f8a705f
6 changed files with 29 additions and 101 deletions

View File

@ -46,7 +46,6 @@ 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
@ -87,10 +86,6 @@ 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 = "";
@ -447,9 +442,7 @@ function ReadManifest(aURL, aFilter, aManifestID) {
newManifestID = included;
}
}
if (reftest_tests_len && !reftest_manifests_len) {
ReadManifest(incURI, aFilter, newManifestID);
}
ReadManifest(incURI, aFilter, newManifestID);
}
} else if (items[0] == TYPE_LOAD || items[0] == TYPE_SCRIPT) {
let type = items[0];

View File

@ -35,28 +35,6 @@ 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&regexp=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):
@ -70,35 +48,13 @@ class ReftestManifest(object):
self.tests = []
self.finder = finder
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=""):
def load(self, path):
"""Parse a reftest manifest file."""
def add_test(file, annotations, referenced_test=None, skip_if=""):
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.
if RE_PROTOCOL.match(file):
return
test = os.path.normpath(os.path.join(mdir, urlprefix + file))
@ -119,18 +75,15 @@ 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:
key, condition = self.translate_condition_for_mozinfo(annotation)
test_dict[key] = "\n".join(
[t for t in [test_dict.get(key, ""), condition] if t]
)
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
self.tests.append(test_dict)
normalized_path = os.path.normpath(os.path.abspath(path))
@ -172,8 +125,8 @@ class ReftestManifest(object):
items = defaults + items
annotations = []
for j in range(len(items)):
item = items[j]
for i in range(len(items)):
item = items[i]
if item.startswith(FAILURE_TYPES) or item.startswith(PREF_ITEMS):
annotations += [item]
@ -187,26 +140,25 @@ class ReftestManifest(object):
self.dirs.add(os.path.normpath(os.path.join(mdir, m.group(1))))
continue
if j < len(defaults):
if i < len(defaults):
raise ValueError(
"Error parsing manifest {}, line {}: "
"Invalid defaults token '{}'".format(path, lineno, item)
)
if item == "url-prefix":
urlprefix = items[j + 1]
urlprefix = items[i + 1]
break
if item == "include":
skip_if = self.get_skip_if_for_mozinfo(parent_skip_if, annotations)
self.load(os.path.join(mdir, items[j + 1]), skip_if)
self.load(os.path.join(mdir, items[i + 1]))
break
if item == "load" or item == "script":
add_test(items[j + 1], annotations, None, parent_skip_if)
add_test(items[i + 1], annotations)
break
if item == "==" or item == "!=" or item == "print":
add_test(items[j + 1], annotations, None, parent_skip_if)
add_test(items[j + 2], annotations, items[j + 1], parent_skip_if)
add_test(items[i + 1], annotations)
add_test(items[i + 2], annotations, items[i + 1])
break

View File

@ -144,10 +144,6 @@ def mock_mozinfo():
headless=False,
tsan=False,
tag="[]",
mingwclang=False,
nightly_build=False,
repo="try",
crashreporter=False,
):
return {
"os": os,

View File

@ -75,13 +75,8 @@ 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):
@ -117,16 +112,14 @@ 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.20",
("macosx", "1400"): "14.40",
("windows", "10"): "10.2009",
("windows", "11"): "11.2009",
("macosx", "1100"): "11.00",
("windows", "10"): "10.0",
("windows", "11"): "11.0",
}
for (name, old_ver), new_ver in os_versions.items():
if p_os["name"] == name and p_os["version"] == old_ver:
@ -271,8 +264,8 @@ class DefaultLoader(BaseManifestLoader):
)
@memoize
def get_manifests(self, suite, frozen_mozinfo):
mozinfo = dict(frozen_mozinfo)
def get_manifests(self, suite, mozinfo):
mozinfo = dict(mozinfo)
# Compute all tests for the given suite/subsuite.
tests = self.get_tests(suite)

View File

@ -11,7 +11,7 @@ task-defaults:
android-hw-.*: geckoview-test_runner.apk
default: null
tier: default
test-manifest-loader: default
test-manifest-loader: null # don't load tests in the taskgraph
mozharness:
script:
by-test-platform:
@ -96,7 +96,6 @@ 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
@ -113,7 +112,6 @@ 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
@ -259,7 +257,6 @@ 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

View File

@ -741,10 +741,7 @@ class TestResolver(MozbuildObject):
if flavor != "devtools" and test.get("flavor") != flavor:
continue
test_subsuite = test.get("subsuite", "undefined")
if not test_subsuite: # sometimes test['subsuite'] == ''
test_subsuite = "undefined"
if subsuite and test_subsuite != subsuite:
if subsuite and test.get("subsuite", "undefined") != subsuite:
continue
test_tags = set(test.get("tags", "").split())