forked from mirrors/gecko-dev
Bug 1712968 - ensure manifest parser filter: failures(), matches they keyword and the entire expression. r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D116028
This commit is contained in:
parent
3f752fc5a8
commit
9f010baa14
2 changed files with 30 additions and 3 deletions
|
|
@ -460,7 +460,11 @@ class failures(InstanceFilter):
|
||||||
if key not in test:
|
if key not in test:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
matched = [self.keyword in e for e in test[key].splitlines() if e]
|
matched = [
|
||||||
|
self.keyword in e and parse(e, **values)
|
||||||
|
for e in test[key].splitlines()
|
||||||
|
if e
|
||||||
|
]
|
||||||
if any(matched):
|
if any(matched):
|
||||||
test["expected"] = "fail"
|
test["expected"] = "fail"
|
||||||
yield test
|
yield test
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ from manifestparser.filters import (
|
||||||
skip_if,
|
skip_if,
|
||||||
subsuite,
|
subsuite,
|
||||||
tags,
|
tags,
|
||||||
|
failures,
|
||||||
)
|
)
|
||||||
|
|
||||||
here = os.path.dirname(os.path.abspath(__file__))
|
here = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
@ -160,14 +161,17 @@ def create_tests():
|
||||||
def tests(create_tests):
|
def tests(create_tests):
|
||||||
return create_tests(
|
return create_tests(
|
||||||
"test0",
|
"test0",
|
||||||
("test1", {"skip-if": "foo == 'bar'"}),
|
("test1", {"skip-if": "foo == 'bar'\nintermittent&&!debug"}),
|
||||||
("test2", {"run-if": "foo == 'bar'"}),
|
("test2", {"run-if": "foo == 'bar'"}),
|
||||||
("test3", {"fail-if": "foo == 'bar'"}),
|
("test3", {"fail-if": "foo == 'bar'"}),
|
||||||
("test4", {"disabled": "some reason"}),
|
("test4", {"disabled": "some reason"}),
|
||||||
("test5", {"subsuite": "baz"}),
|
("test5", {"subsuite": "baz"}),
|
||||||
("test6", {"subsuite": "baz,foo == 'bar'"}),
|
("test6", {"subsuite": "baz,foo == 'bar'"}),
|
||||||
("test7", {"tags": "foo bar"}),
|
("test7", {"tags": "foo bar"}),
|
||||||
("test8", {"skip-if": "\nbaz\nfoo == 'bar'\nfoo == 'baz'"}),
|
(
|
||||||
|
"test8",
|
||||||
|
{"skip-if": "\nbaz\nfoo == 'bar'\nfoo == 'baz'\nintermittent && debug"},
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -254,6 +258,25 @@ def test_tags(tests):
|
||||||
assert ref[7] in tests
|
assert ref[7] in tests
|
||||||
|
|
||||||
|
|
||||||
|
def test_failures(tests):
|
||||||
|
ref = deepcopy(tests)
|
||||||
|
fail1 = failures("intermittent")
|
||||||
|
tests = list(fail1(tests, {"intermittent": True, "debug": True}))
|
||||||
|
assert len(tests) == 1
|
||||||
|
|
||||||
|
tests = deepcopy(ref)
|
||||||
|
tests = list(fail1(tests, {"intermittent": True}))
|
||||||
|
assert len(tests) == 1
|
||||||
|
|
||||||
|
tests = deepcopy(ref)
|
||||||
|
tests = list(fail1(tests, {}))
|
||||||
|
assert len(tests) == 0
|
||||||
|
|
||||||
|
tests = deepcopy(ref)
|
||||||
|
tests = list(fail1(tests, {"intermittent": False, "debug": True}))
|
||||||
|
assert len(tests) == 0
|
||||||
|
|
||||||
|
|
||||||
def test_pathprefix(create_tests):
|
def test_pathprefix(create_tests):
|
||||||
tests = create_tests(
|
tests = create_tests(
|
||||||
"test0",
|
"test0",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue