Skip to content

Commit 9a797be

Browse files
committed
option to wildcard xfail-not
1 parent 78c460b commit 9a797be

File tree

6 files changed

+47
-0
lines changed

6 files changed

+47
-0
lines changed

llvm/docs/CommandGuide/lit.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,11 @@ The timing data is stored in the `test_exec_root` in a file named
356356
primary purpose is to suppress an ``XPASS`` result without modifying a test
357357
case that uses the ``XFAIL`` directive.
358358

359+
.. option:: --exclude-xfail
360+
361+
``XFAIL`` tests won't be run, unless they are listed in the ``--xfail-not``
362+
(or ``LIT_XFAIL_NOT``) lists.
363+
359364
.. option:: --num-shards M
360365

361366
Divide the set of selected tests into ``M`` equal-sized subsets or

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+
# Exclude this test if it's xfail.
251+
self.exclude_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.exclude_xfail and test.isExpectedToFail():
2179+
return lit.Test.Result(Test.EXCLUDED, "excluding 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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,16 @@ 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+
"--exclude-xfail",
308+
help="exclude XFAIL tests (unless they are in the --xfail-not list). "
309+
"Note: This option is implemented in "
310+
"lit.TestRunner.parseIntegratedTestScript and so will have no effect on "
311+
"test formats that do not call that and do not implement the option "
312+
"separately.",
313+
default=False,
314+
action="store_true",
315+
)
306316
selection_group.add_argument(
307317
"--num-shards",
308318
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.exclude_xfail:
244+
t.exclude_xfail = True
243245

244246

245247
def mark_excluded(discovered_tests, selected_tests):

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@
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: --exclude-xfail \
10+
# RUN: %{inputs}/xfail-cl \
11+
# RUN: | FileCheck --check-prefixes=CHECK-EXCLUDED,CHECK-EXCLUDED-NOOVERRIDE %s
12+
13+
# RUN: %{lit} --xfail 'false.txt;false2.txt;top-level-suite :: b :: test.txt' \
14+
# RUN: --xfail-not 'true-xfail.txt' \
15+
# RUN: --exclude-xfail \
16+
# RUN: %{inputs}/xfail-cl \
17+
# RUN: | FileCheck --check-prefixes=CHECK-EXCLUDED,CHECK-EXCLUDED-OVERRIDE %s
18+
19+
820
# RUN: env LIT_XFAIL='false.txt;false2.txt;top-level-suite :: b :: test.txt' \
921
# RUN: LIT_XFAIL_NOT='true-xfail.txt;top-level-suite :: a :: test-xfail.txt' \
1022
# RUN: %{lit} %{inputs}/xfail-cl \
@@ -37,3 +49,16 @@
3749

3850
# CHECK-OVERRIDE: Testing: 1 tests, {{[0-9]*}} workers
3951
# CHECK-OVERRIDE: {{^}}PASS: top-level-suite :: true-xfail.txt
52+
53+
# CHECK-EXCLUDED: Testing: 10 tests, {{[0-9]*}} workers
54+
# CHECK-EXCLUDED-DAG: {{^}}EXCLUDED: top-level-suite :: a :: false.txt
55+
# CHECK-EXCLUDED-DAG: {{^}}EXCLUDED: top-level-suite :: a :: test-xfail.txt
56+
# CHECK-EXCLUDED-DAG: {{^}}PASS: top-level-suite :: a :: test.txt
57+
# CHECK-EXCLUDED-DAG: {{^}}EXCLUDED: top-level-suite :: b :: false.txt
58+
# CHECK-EXCLUDED-DAG: {{^}}EXCLUDED: top-level-suite :: b :: test-xfail.txt
59+
# CHECK-EXCLUDED-DAG: {{^}}EXCLUDED: top-level-suite :: b :: test.txt
60+
# CHECK-EXCLUDED-DAG: {{^}}EXCLUDED: top-level-suite :: false.txt
61+
# CHECK-EXCLUDED-DAG: {{^}}EXCLUDED: top-level-suite :: false2.txt
62+
# CHECK-EXCLUDED-NOOVERRIDE-DAG: {{^}}EXCLUDED: top-level-suite :: true-xfail.txt
63+
# CHECK-EXCLUDED-OVERRIDE-DAG: {{^}}PASS: top-level-suite :: true-xfail.txt
64+
# CHECK-EXCLUDED-DAG: {{^}}PASS: top-level-suite :: true.txt

0 commit comments

Comments
 (0)