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