[clang] 74c94b5 - [test] Default clang/test to FileCheck --allow-unused-prefixes=false

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 2 11:22:53 PST 2021


Author: Fangrui Song
Date: 2021-02-02T11:22:46-08:00
New Revision: 74c94b5d9c2b19333b43684c9d60decd41543d50

URL: https://github.com/llvm/llvm-project/commit/74c94b5d9c2b19333b43684c9d60decd41543d50
DIFF: https://github.com/llvm/llvm-project/commit/74c94b5d9c2b19333b43684c9d60decd41543d50.diff

LOG: [test] Default clang/test to FileCheck --allow-unused-prefixes=false

Added: 
    clang/test/OpenMP/lit.local.cfg

Modified: 
    clang/test/Analysis/lit.local.cfg
    clang/test/Driver/lit.local.cfg
    clang/test/lit.cfg.py

Removed: 
    clang/test/CodeGen/lit.local.cfg
    clang/test/CodeGenCXX/lit.local.cfg


################################################################################
diff  --git a/clang/test/Analysis/lit.local.cfg b/clang/test/Analysis/lit.local.cfg
index 1560848b1f756..1e8cf4c3b7c4b 100644
--- a/clang/test/Analysis/lit.local.cfg
+++ b/clang/test/Analysis/lit.local.cfg
@@ -26,9 +26,3 @@ config.substitutions.append(('%normalize_sarif',
 
 if not config.root.clang_staticanalyzer:
     config.unsupported = True
-
-fc = ToolSubst('FileCheck', unresolved='fatal')
-# Insert this first. Then, we'll first update the blank FileCheck command; then,
-# the default substitution of FileCheck will replace it to its full path.
-config.substitutions.insert(0, (fc.regex,
-    'FileCheck --allow-unused-prefixes=false'))

diff  --git a/clang/test/CodeGen/lit.local.cfg b/clang/test/CodeGen/lit.local.cfg
deleted file mode 100644
index c5bb8b60a52a3..0000000000000
--- a/clang/test/CodeGen/lit.local.cfg
+++ /dev/null
@@ -1,9 +0,0 @@
-# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
-from lit.llvm.subst import ToolSubst
-
-fc = ToolSubst('FileCheck', unresolved='fatal')
-# Insert this first. Then, we'll first update the blank FileCheck command; then,
-# the default substitution of FileCheck will replace it to its full path.
-config.substitutions.insert(0, (fc.regex,
-    'FileCheck --allow-unused-prefixes=false'))
-

diff  --git a/clang/test/CodeGenCXX/lit.local.cfg b/clang/test/CodeGenCXX/lit.local.cfg
deleted file mode 100644
index c5bb8b60a52a3..0000000000000
--- a/clang/test/CodeGenCXX/lit.local.cfg
+++ /dev/null
@@ -1,9 +0,0 @@
-# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
-from lit.llvm.subst import ToolSubst
-
-fc = ToolSubst('FileCheck', unresolved='fatal')
-# Insert this first. Then, we'll first update the blank FileCheck command; then,
-# the default substitution of FileCheck will replace it to its full path.
-config.substitutions.insert(0, (fc.regex,
-    'FileCheck --allow-unused-prefixes=false'))
-

diff  --git a/clang/test/Driver/lit.local.cfg b/clang/test/Driver/lit.local.cfg
index 7dbadaeed12fe..ad3f0e92cacdd 100644
--- a/clang/test/Driver/lit.local.cfg
+++ b/clang/test/Driver/lit.local.cfg
@@ -1,11 +1,3 @@
-from lit.llvm.subst import ToolSubst
-
-fc = ToolSubst('FileCheck', unresolved='fatal')
-# Insert this first. Then, we'll first update the blank FileCheck command; then,
-# the default substitution of FileCheck will replace it to its full path.
-config.substitutions.insert(0, (fc.regex,
-    'FileCheck --allow-unused-prefixes=false'))
-
 config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.F90', '.f95',
                    '.cu', '.rs', '.cl', '.hip']
 config.substitutions = list(config.substitutions)

diff  --git a/clang/test/OpenMP/lit.local.cfg b/clang/test/OpenMP/lit.local.cfg
new file mode 100644
index 0000000000000..ac72c2de97773
--- /dev/null
+++ b/clang/test/OpenMP/lit.local.cfg
@@ -0,0 +1,10 @@
+# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
+from lit.llvm.subst import ToolSubst
+
+fc = ToolSubst('FileCheck', unresolved='fatal')
+# the parent introduced the opposite rule, so we replace it if we see it.
+if len(config.substitutions) > 0 and config.substitutions[0] == (fc.regex, 'FileCheck --allow-unused-prefixes=false'):
+    config.substitutions[0] = (
+        fc.regex, 'FileCheck --allow-unused-prefixes=true')
+else:
+    config.substitutions.insert(0, (fc.regex, 'FileCheck --allow-unused-prefixes=true'))

diff  --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index 863ab444fb023..a47ebe74ddbae 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -43,6 +43,14 @@
 
 llvm_config.use_clang()
 
+# FIXME: remove this when we flip the default value for --allow-unused-prefixes
+# to false.
+fc = ToolSubst('FileCheck', unresolved='fatal')
+# Insert this first. Then, we'll first update the blank FileCheck command; then,
+# the default substitution of FileCheck will replace it to its full path.
+config.substitutions.insert(0, (fc.regex,
+    'FileCheck --allow-unused-prefixes=false'))
+
 config.substitutions.append(
     ('%src_include_dir', config.clang_src_dir + '/include'))
 


        


More information about the cfe-commits mailing list