[llvm] [lit] Support wildcard in --xfail-not option (PR #151191)

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 29 12:50:35 PDT 2025


https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/151191

>From 5af21ad6132a5d5865e9aec5c43fea4ccdc125ba Mon Sep 17 00:00:00 2001
From: Mircea Trofin <mtrofin at google.com>
Date: Tue, 29 Jul 2025 09:41:17 -0700
Subject: [PATCH] option to wildcard xfail-not

---
 llvm/utils/lit/lit/main.py       |  6 +++++-
 llvm/utils/lit/tests/xfail-cl.py | 10 ++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index 0939838b78ceb..a4a78c209f746 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -238,7 +238,11 @@ def mark_xfail(selected_tests, opts):
         test_full_name = t.getFullName()
         if test_file in opts.xfail or test_full_name in opts.xfail:
             t.xfails += "*"
-        if test_file in opts.xfail_not or test_full_name in opts.xfail_not:
+        if (
+            test_file in opts.xfail_not
+            or test_full_name in opts.xfail_not
+            or opts.xfail_not == [".*"]
+        ):
             t.xfail_not = True
 
 
diff --git a/llvm/utils/lit/tests/xfail-cl.py b/llvm/utils/lit/tests/xfail-cl.py
index ef1bb0414cfea..b82fb87847c41 100644
--- a/llvm/utils/lit/tests/xfail-cl.py
+++ b/llvm/utils/lit/tests/xfail-cl.py
@@ -5,11 +5,21 @@
 # RUN:   %{inputs}/xfail-cl \
 # RUN: | FileCheck --check-prefix=CHECK-FILTER %s
 
+# RUN: %{lit} --xfail 'false.txt;false2.txt;top-level-suite :: b :: test.txt' \
+# RUN:   --xfail-not '*' \
+# RUN:   %{inputs}/xfail-cl \
+# RUN: | FileCheck --check-prefix=CHECK-FILTER %s
+
 # RUN: env LIT_XFAIL='false.txt;false2.txt;top-level-suite :: b :: test.txt' \
 # RUN:   LIT_XFAIL_NOT='true-xfail.txt;top-level-suite :: a :: test-xfail.txt' \
 # RUN: %{lit} %{inputs}/xfail-cl \
 # RUN: | FileCheck --check-prefix=CHECK-FILTER %s
 
+# RUN: env LIT_XFAIL='false.txt;false2.txt;top-level-suite :: b :: test.txt' \
+# RUN:   LIT_XFAIL_NOT='*' \
+# RUN: %{lit} %{inputs}/xfail-cl \
+# RUN: | FileCheck --check-prefix=CHECK-FILTER %s
+
 # Check that --xfail-not and LIT_XFAIL_NOT always have precedence.
 
 # RUN: env LIT_XFAIL=true-xfail.txt \



More information about the llvm-commits mailing list