Skip to content

Commit 5a76e04

Browse files
committed
option to wildcard xfail-not
1 parent 78c460b commit 5a76e04

File tree

5 files changed

+31
-0
lines changed

5 files changed

+31
-0
lines changed

llvm/utils/lit/lit/Test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ def __init__(
247247
# and will be honored when the test result is supplied.
248248
self.xfails = []
249249

250+
# Skip this test if it's xfail.
251+
self.skip_xfail = False
252+
250253
# If true, ignore all items in self.xfails.
251254
self.xfail_not = False
252255

llvm/utils/lit/lit/TestRunner.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,6 +2175,8 @@ def parseIntegratedTestScript(test, additional_parsers=[], require_script=True):
21752175
assert parsed["DEFINE:"] == script
21762176
assert parsed["REDEFINE:"] == script
21772177
test.xfails += parsed["XFAIL:"] or []
2178+
if test.xfails and test.skip_xfail:
2179+
return lit.Test.Result(Test.SKIPPED, "skipping XFAIL tests")
21782180
test.requires += parsed["REQUIRES:"] or []
21792181
test.unsupported += parsed["UNSUPPORTED:"] or []
21802182
if parsed["ALLOW_RETRIES:"]:

llvm/utils/lit/lit/cl_arguments.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,12 @@ def parse_args():
303303
help="do not XFAIL tests with paths in the semicolon separated list",
304304
default=os.environ.get("LIT_XFAIL_NOT", ""),
305305
)
306+
selection_group.add_argument(
307+
"--skip-xfail",
308+
help="do not XFAIL tests with paths in the semicolon separated list.",
309+
default=False,
310+
action="store_true",
311+
)
306312
selection_group.add_argument(
307313
"--num-shards",
308314
dest="numShards",

llvm/utils/lit/lit/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ def mark_xfail(selected_tests, opts):
240240
t.xfails += "*"
241241
if test_file in opts.xfail_not or test_full_name in opts.xfail_not:
242242
t.xfail_not = True
243+
if opts.skip_xfail:
244+
t.skip_xfail = True
243245

244246

245247
def mark_excluded(discovered_tests, selected_tests):

llvm/utils/lit/tests/xfail-cl.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
# RUN: %{inputs}/xfail-cl \
66
# RUN: | FileCheck --check-prefix=CHECK-FILTER %s
77

8+
# RUN: %{lit} --xfail 'false.txt;false2.txt;top-level-suite :: b :: test.txt' \
9+
# RUN: --skip-xfail \
10+
# RUN: %{inputs}/xfail-cl \
11+
# RUN: | FileCheck --check-prefix=CHECK-SKIP %s
12+
13+
814
# RUN: env LIT_XFAIL='false.txt;false2.txt;top-level-suite :: b :: test.txt' \
915
# RUN: LIT_XFAIL_NOT='true-xfail.txt;top-level-suite :: a :: test-xfail.txt' \
1016
# RUN: %{lit} %{inputs}/xfail-cl \
@@ -37,3 +43,15 @@
3743

3844
# CHECK-OVERRIDE: Testing: 1 tests, {{[0-9]*}} workers
3945
# CHECK-OVERRIDE: {{^}}PASS: top-level-suite :: true-xfail.txt
46+
47+
# CHECK-SKIP: Testing: 10 tests, {{[0-9]*}} workers
48+
# CHECK-SKIP-DAG: {{^}}SKIPPED: top-level-suite :: a :: false.txt
49+
# CHECK-SKIP-DAG: {{^}}SKIPPED: top-level-suite :: a :: test-xfail.txt
50+
# CHECK-SKIP-DAG: {{^}}PASS: top-level-suite :: a :: test.txt
51+
# CHECK-SKIP-DAG: {{^}}SKIPPED: top-level-suite :: b :: false.txt
52+
# CHECK-SKIP-DAG: {{^}}SKIPPED: top-level-suite :: b :: test-xfail.txt
53+
# CHECK-SKIP-DAG: {{^}}SKIPPED: top-level-suite :: b :: test.txt
54+
# CHECK-SKIP-DAG: {{^}}SKIPPED: top-level-suite :: false.txt
55+
# CHECK-SKIP-DAG: {{^}}SKIPPED: top-level-suite :: false2.txt
56+
# CHECK-SKIP-DAG: {{^}}SKIPPED: top-level-suite :: true-xfail.txt
57+
# CHECK-SKIP-DAG: {{^}}PASS: top-level-suite :: true.txt

0 commit comments

Comments
 (0)