зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1907273 - strict=true for .toml expressions. r=extension-reviewers,robwu,perftest-reviewers,sparky
Differential Revision: https://phabricator.services.mozilla.com/D220794
This commit is contained in:
Родитель
fcf785ee45
Коммит
90e8dd7b5a
|
@ -77,7 +77,7 @@ skip-if = ["true"]
|
|||
|
||||
["browser_very_fission.js"]
|
||||
support-files = ["file_dummy.html"]
|
||||
run-if = ["widget == 'gtk'"]
|
||||
run-if = ["os == 'linux'"]
|
||||
|
||||
["browser_wpi_isolate_everything.js"]
|
||||
support-files = ["browser_wpi_base.js"]
|
||||
|
|
|
@ -1790,6 +1790,7 @@ toolbar#nav-bar {
|
|||
disabled=disabled,
|
||||
filters=filters,
|
||||
noDefaultFilters=noDefaultFilters,
|
||||
strictExpressions=True,
|
||||
**info
|
||||
)
|
||||
|
||||
|
@ -3422,6 +3423,11 @@ toolbar#nav-bar {
|
|||
"xorigin": options.xOriginTests,
|
||||
"condprof": options.conditionedProfile,
|
||||
"msix": "WindowsApps" in options.app,
|
||||
"android_version": mozinfo.info.get("android_version", -1),
|
||||
"android": mozinfo.info.get("android", False),
|
||||
"is_emulator": mozinfo.info.get("is_emulator", False),
|
||||
"cm6": mozinfo.info.get("cm6", False),
|
||||
"coverage": mozinfo.info.get("coverage", False),
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ class ExpressionParser(object):
|
|||
__call__ = parse
|
||||
|
||||
|
||||
def parse(text, **values):
|
||||
def parse(text, strict=False, **values):
|
||||
"""
|
||||
Parse and evaluate a boolean expression.
|
||||
:param text: The expression to parse, as a string.
|
||||
|
@ -321,4 +321,4 @@ def parse(text, **values):
|
|||
:rtype: the final value of the expression.
|
||||
:raises: :py:exc::ParseError: will be raised if parsing fails.
|
||||
"""
|
||||
return ExpressionParser(text, values).parse()
|
||||
return ExpressionParser(text, values, strict=strict).parse()
|
||||
|
|
|
@ -20,49 +20,49 @@ from .util import normsep
|
|||
# built-in filters
|
||||
|
||||
|
||||
def _match(exprs, **values):
|
||||
if any(parse(e, **values) for e in exprs.splitlines() if e):
|
||||
def _match(exprs, strict, **values):
|
||||
if any(parse(e, strict=strict, **values) for e in exprs.splitlines() if e):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def skip_if(tests, values):
|
||||
def skip_if(tests, values, strict=False):
|
||||
"""
|
||||
Sets disabled on all tests containing the `skip-if` tag and whose condition
|
||||
is True. This filter is added by default.
|
||||
"""
|
||||
tag = "skip-if"
|
||||
for test in tests:
|
||||
if tag in test and _match(test[tag], **values):
|
||||
if tag in test and _match(test[tag], strict, **values):
|
||||
test.setdefault("disabled", "{}: {}".format(tag, test[tag]))
|
||||
yield test
|
||||
|
||||
|
||||
def run_if(tests, values):
|
||||
def run_if(tests, values, strict=False):
|
||||
"""
|
||||
Sets disabled on all tests containing the `run-if` tag and whose condition
|
||||
is False. This filter is added by default.
|
||||
"""
|
||||
tag = "run-if"
|
||||
for test in tests:
|
||||
if tag in test and not _match(test[tag], **values):
|
||||
if tag in test and not _match(test[tag], strict, **values):
|
||||
test.setdefault("disabled", "{}: {}".format(tag, test[tag]))
|
||||
yield test
|
||||
|
||||
|
||||
def fail_if(tests, values):
|
||||
def fail_if(tests, values, strict=False):
|
||||
"""
|
||||
Sets expected to 'fail' on all tests containing the `fail-if` tag and whose
|
||||
condition is True. This filter is added by default.
|
||||
"""
|
||||
tag = "fail-if"
|
||||
for test in tests:
|
||||
if tag in test and _match(test[tag], **values):
|
||||
if tag in test and _match(test[tag], strict, **values):
|
||||
test["expected"] = "fail"
|
||||
yield test
|
||||
|
||||
|
||||
def enabled(tests, values):
|
||||
def enabled(tests, values, strict=False):
|
||||
"""
|
||||
Removes all tests containing the `disabled` key. This filter can be
|
||||
added by passing `disabled=False` into `active_tests`.
|
||||
|
@ -72,7 +72,7 @@ def enabled(tests, values):
|
|||
yield test
|
||||
|
||||
|
||||
def exists(tests, values):
|
||||
def exists(tests, values, strict=False):
|
||||
"""
|
||||
Removes all tests that do not exist on the file system. This filter is
|
||||
added by default, but can be removed by passing `exists=False` into
|
||||
|
@ -135,7 +135,7 @@ class subsuite(InstanceFilter):
|
|||
InstanceFilter.__init__(self, name=name)
|
||||
self.name = name
|
||||
|
||||
def __call__(self, tests, values):
|
||||
def __call__(self, tests, values, strict=False):
|
||||
# Look for conditional subsuites, and replace them with the subsuite
|
||||
# itself (if the condition is true), or nothing.
|
||||
for test in tests:
|
||||
|
@ -145,7 +145,7 @@ class subsuite(InstanceFilter):
|
|||
subsuite, cond = subsuite.split(",")
|
||||
except ValueError:
|
||||
raise ParseError("subsuite condition can't contain commas")
|
||||
matched = parse(cond, **values)
|
||||
matched = parse(cond, strict, **values)
|
||||
if matched:
|
||||
test["subsuite"] = subsuite
|
||||
else:
|
||||
|
@ -178,7 +178,7 @@ class chunk_by_slice(InstanceFilter):
|
|||
self.total_chunks = total_chunks
|
||||
self.disabled = disabled
|
||||
|
||||
def __call__(self, tests, values):
|
||||
def __call__(self, tests, values, strict=False):
|
||||
tests = list(tests)
|
||||
if self.disabled:
|
||||
chunk_tests = tests[:]
|
||||
|
@ -230,7 +230,7 @@ class chunk_by_dir(InstanceFilter):
|
|||
self.total_chunks = total_chunks
|
||||
self.depth = depth
|
||||
|
||||
def __call__(self, tests, values):
|
||||
def __call__(self, tests, values, strict=False):
|
||||
tests_by_dir = defaultdict(list)
|
||||
ordered_dirs = []
|
||||
for test in tests:
|
||||
|
@ -283,7 +283,7 @@ class chunk_by_manifest(InstanceFilter):
|
|||
self.this_chunk = this_chunk
|
||||
self.total_chunks = total_chunks
|
||||
|
||||
def __call__(self, tests, values):
|
||||
def __call__(self, tests, values, strict=False):
|
||||
tests = list(tests)
|
||||
manifests = set(t["manifest"] for t in tests)
|
||||
|
||||
|
@ -372,7 +372,7 @@ class chunk_by_runtime(InstanceFilter):
|
|||
chunks.sort(key=lambda x: (x[0], len(x[1])))
|
||||
return chunks
|
||||
|
||||
def __call__(self, tests, values):
|
||||
def __call__(self, tests, values, strict=False):
|
||||
tests = list(tests)
|
||||
manifests = set(self.get_manifest(t) for t in tests)
|
||||
chunks = self.get_chunked_manifests(manifests)
|
||||
|
@ -414,7 +414,7 @@ class tags(InstanceFilter):
|
|||
tags = [tags]
|
||||
self.tags = tags
|
||||
|
||||
def __call__(self, tests, values):
|
||||
def __call__(self, tests, values, strict=False):
|
||||
for test in tests:
|
||||
if "tags" not in test:
|
||||
continue
|
||||
|
@ -440,14 +440,14 @@ class failures(InstanceFilter):
|
|||
InstanceFilter.__init__(self, keyword)
|
||||
self.keyword = keyword.strip('"')
|
||||
|
||||
def __call__(self, tests, values):
|
||||
def __call__(self, tests, values, strict=False):
|
||||
for test in tests:
|
||||
for key in ["skip-if", "fail-if"]:
|
||||
if key not in test:
|
||||
continue
|
||||
|
||||
matched = [
|
||||
self.keyword in e and parse(e, **values)
|
||||
self.keyword in e and parse(e, strict, **values)
|
||||
for e in test[key].splitlines()
|
||||
if e
|
||||
]
|
||||
|
@ -470,7 +470,7 @@ class pathprefix(InstanceFilter):
|
|||
self.paths = paths
|
||||
self.missing = set()
|
||||
|
||||
def __call__(self, tests, values):
|
||||
def __call__(self, tests, values, strict=False):
|
||||
seen = set()
|
||||
for test in tests:
|
||||
for testpath in self.paths:
|
||||
|
|
|
@ -888,7 +888,13 @@ class TestManifest(ManifestParser):
|
|||
self.last_used_filters = []
|
||||
|
||||
def active_tests(
|
||||
self, exists=True, disabled=True, filters=None, noDefaultFilters=False, **values
|
||||
self,
|
||||
exists=True,
|
||||
disabled=True,
|
||||
filters=None,
|
||||
noDefaultFilters=False,
|
||||
strictExpressions=False,
|
||||
**values,
|
||||
):
|
||||
"""
|
||||
Run all applied filters on the set of tests.
|
||||
|
@ -925,7 +931,7 @@ class TestManifest(ManifestParser):
|
|||
|
||||
self.last_used_filters = fltrs[:]
|
||||
for fn in fltrs:
|
||||
tests = fn(tests, values)
|
||||
tests = fn(tests, values, strict=strictExpressions)
|
||||
return list(tests)
|
||||
|
||||
def test_paths(self):
|
||||
|
|
|
@ -736,7 +736,7 @@ class _PrintTests(_StopAction):
|
|||
# exit Raptor
|
||||
parser.exit()
|
||||
|
||||
def filter_app(self, tests, values):
|
||||
def filter_app(self, tests, values, strict=True):
|
||||
for test in tests:
|
||||
if values["app"] in test["apps"]:
|
||||
yield test
|
||||
|
|
|
@ -42,7 +42,7 @@ playback_settings = [
|
|||
]
|
||||
|
||||
|
||||
def filter_app(tests, values):
|
||||
def filter_app(tests, values, strict=False):
|
||||
for test in tests:
|
||||
if values["app"] in [app.strip() for app in test["apps"].split(",")]:
|
||||
yield test
|
||||
|
|
|
@ -1133,6 +1133,7 @@ class XPCShellTests(object):
|
|||
mp.active_tests(
|
||||
filters=filters,
|
||||
noDefaultFilters=noDefaultFilters,
|
||||
strictExpressions=True,
|
||||
**mozinfo.info,
|
||||
),
|
||||
)
|
||||
|
@ -1579,22 +1580,22 @@ class XPCShellTests(object):
|
|||
)
|
||||
|
||||
self.mozInfo["condprof"] = options.get("conditionedProfile", False)
|
||||
|
||||
if options.get("variant", ""):
|
||||
self.mozInfo["msix"] = options["variant"] == "msix"
|
||||
self.mozInfo["msix"] = options.get("variant", "") == "msix"
|
||||
|
||||
self.mozInfo["is_ubuntu"] = "Ubuntu" in platform.version()
|
||||
|
||||
mozinfo.update(self.mozInfo)
|
||||
|
||||
# TODO: remove this when crashreporter is fixed on mac via bug 1910777
|
||||
if self.mozInfo["os"] == "mac":
|
||||
(release, versioninfo, machine) = platform.mac_ver()
|
||||
versionNums = release.split(".")[:2]
|
||||
os_version = "%s.%s" % (versionNums[0], versionNums[1].ljust(2, "0"))
|
||||
if os_version == "14.40":
|
||||
if os_version == "14.40" and self.mozInfo["arch"] == "aarch64":
|
||||
self.mozInfo["crashreporter"] = False
|
||||
|
||||
# we default to false for e10s on xpcshell
|
||||
self.mozInfo["e10s"] = self.mozInfo.get("e10s", False)
|
||||
|
||||
mozinfo.update(self.mozInfo)
|
||||
return True
|
||||
|
||||
@property
|
||||
|
|
|
@ -63,7 +63,7 @@ support-files = ["head_abuse_report.js"]
|
|||
|
||||
["browser_colorwaybuiltins_migration.js"]
|
||||
skip-if = [
|
||||
"app-name != 'firefox'",
|
||||
"appname != 'firefox'",
|
||||
]
|
||||
|
||||
["browser_dragdrop.js"]
|
||||
|
|
|
@ -7,7 +7,6 @@ tags = "addons"
|
|||
|
||||
["test_filepointer.js"]
|
||||
skip-if = [
|
||||
"!allow_legacy_extensions",
|
||||
"require_signing",
|
||||
]
|
||||
|
||||
|
|
|
@ -312,7 +312,6 @@ skip-if = ["os == 'android'"]
|
|||
["test_signed_updatepref.js"]
|
||||
skip-if = [
|
||||
"require_signing",
|
||||
"!allow_legacy_extensions",
|
||||
"os == 'android'",
|
||||
]
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче