Skip to content

Commit 87dbdd2

Browse files
committed
[FileCheck] Default --allow-unused-prefixes to false
Link: https://lists.llvm.org/pipermail/llvm-dev/2020-October/146162.html "[RFC] FileCheck: (dis)allowing unused prefixes" If a downstream project using lit needs time for transition, add the following to `lit.local.cfg`: ``` from lit.llvm.subst import ToolSubst fc = ToolSubst('FileCheck', unresolved='fatal') config.substitutions.insert(0, (fc.regex, 'FileCheck --allow-unused-prefixes')) ``` Differential Revision: https://reviews.llvm.org/D95849
1 parent ad60802 commit 87dbdd2

File tree

10 files changed

+8
-61
lines changed

10 files changed

+8
-61
lines changed

clang/test/Driver/crash-report-null.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: env FORCE_CLANG_DIAGNOSTICS_CRASH=1 not %clang -fsyntax-only -x c /dev/null -lstdc++ 2>&1 | FileCheck %s
22

33
// FIXME: Investigating. "fatal error: file 'nul' modified since it was first processed"
4-
// XFAIL: windows-gnu
4+
// UNSUPPORTED: system-windows
55

66
// CHECK: PLEASE submit a bug report to {{.*}} and include the crash backtrace, preprocessed source, and associated run script.
77
// CHECK: Preprocessed source(s) and associated run script(s) are located at:

clang/test/OpenMP/lit.local.cfg

+1-6
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,4 @@
22
from lit.llvm.subst import ToolSubst
33

44
fc = ToolSubst('FileCheck', unresolved='fatal')
5-
# the parent introduced the opposite rule, so we replace it if we see it.
6-
if len(config.substitutions) > 0 and config.substitutions[0] == (fc.regex, 'FileCheck --allow-unused-prefixes=false'):
7-
config.substitutions[0] = (
8-
fc.regex, 'FileCheck --allow-unused-prefixes=true')
9-
else:
10-
config.substitutions.insert(0, (fc.regex, 'FileCheck --allow-unused-prefixes=true'))
5+
config.substitutions.insert(0, (fc.regex, 'FileCheck --allow-unused-prefixes'))

clang/test/lit.cfg.py

-8
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@
4343

4444
llvm_config.use_clang()
4545

46-
# FIXME: remove this when we flip the default value for --allow-unused-prefixes
47-
# to false.
48-
fc = ToolSubst('FileCheck', unresolved='fatal')
49-
# Insert this first. Then, we'll first update the blank FileCheck command; then,
50-
# the default substitution of FileCheck will replace it to its full path.
51-
config.substitutions.insert(0, (fc.regex,
52-
'FileCheck --allow-unused-prefixes=false'))
53-
5446
config.substitutions.append(
5547
('%src_include_dir', config.clang_src_dir + '/include'))
5648

llvm/test/FileCheck/allow-unused-prefixes.txt

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
; RUN: %ProtectFileCheckOutput not FileCheck --allow-unused-prefixes=false --check-prefixes=P1,P2,P3 --input-file %S/Inputs/one-check.txt %S/Inputs/one-check.txt 2>&1 | FileCheck --check-prefix=MISSING-MORE %s
33
; RUN: FileCheck --allow-unused-prefixes=true --check-prefixes=P1,P2 --input-file %S/Inputs/one-check.txt %S/Inputs/one-check.txt
44
; RUN: FileCheck --allow-unused-prefixes=false --allow-unused-prefixes=true --check-prefixes=P1,P2 --input-file %S/Inputs/one-check.txt %S/Inputs/one-check.txt
5-
6-
;; Note: the default will be changed to 'false', at which time this run line
7-
;; should be changed accordingly.
8-
; RUN: FileCheck --check-prefixes=P1,P2 --input-file %S/Inputs/one-check.txt %S/Inputs/one-check.txt
5+
; RUN: not FileCheck --check-prefixes=P1,P2 --input-file %S/Inputs/one-check.txt %S/Inputs/one-check.txt
96

107
; MISSING-ONE: error: no check strings found with prefix 'P2:'
118
; MISSING-MORE: error: no check strings found with prefixes 'P2:', 'P3:'

llvm/test/FileCheck/lit.local.cfg

-9
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,3 @@ config.test_format = lit.formats.ShTest(execute_external=False)
5454
# that test results throughout all test suites are affected.
5555
config.substitutions.append(('%ProtectFileCheckOutput',
5656
'env -u FILECHECK_OPTS'))
57-
58-
# FIXME: remove this once the default is flipped.
59-
from lit.llvm.subst import ToolSubst
60-
61-
fc = ToolSubst('FileCheck', unresolved='fatal')
62-
# the parent introduced the opposite rule, so we replace it if we see it.
63-
if len(config.substitutions) > 0 and config.substitutions[0] == (fc.regex, 'FileCheck --allow-unused-prefixes=false'):
64-
del config.substitutions[0]
65-

llvm/test/Other/opt-bisect-legacy-pass-manager.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
; f2() in f3().
4040

4141
; RUN: %python %S/opt-bisect-helper.py --start=0 --end=256 --optcmd=opt \
42-
; RUN: --filecheckcmd=%FileCheckRaw% --test=%s \
42+
; RUN: --filecheckcmd=FileCheck --test=%s \
4343
; RUN: --prefix=CHECK-BISECT-INLINE-HELPER \
4444
; RUN: | FileCheck %s --check-prefix=CHECK-BISECT-INLINE-RESULT
4545
; The helper script uses this to find the optimization that inlines the call.

llvm/test/Reduce/lit.local.cfg

-8
This file was deleted.

llvm/test/Transforms/Attributor/lit.local.cfg

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,4 @@
22
from lit.llvm.subst import ToolSubst
33

44
fc = ToolSubst('FileCheck', unresolved='fatal')
5-
# the parent introduced the opposite rule, so we replace it if we see it.
6-
if len(config.substitutions) > 0 and config.substitutions[0] == (fc.regex, 'FileCheck --allow-unused-prefixes=false'):
7-
config.substitutions[0] = (
8-
fc.regex, 'FileCheck --allow-unused-prefixes=true')
9-
else:
10-
config.substitutions.insert(0, (fc.regex,
11-
'FileCheck --allow-unused-prefixes=true'))
5+
config.substitutions.insert(0, (fc.regex, 'FileCheck --allow-unused-prefixes'))

llvm/test/lit.cfg.py

+2-16
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,6 @@ def get_asan_rtlib():
8383
return found_dylibs[0]
8484

8585

86-
####################################################
87-
# FIXME: remove this when we flip the default value for --allow-unused-prefixes
88-
# to false.
89-
fc = ToolSubst('FileCheck', unresolved='fatal')
90-
# Insert this first. Then, we'll first update the blank FileCheck command; then,
91-
# the default substitution of FileCheck will replace it to its full path.
92-
config.substitutions.insert(0, (fc.regex,
93-
'FileCheck --allow-unused-prefixes=false'))
94-
# When addressing this fixme, replace %FileCheckRaw% with just FileCheck.
95-
config.substitutions.append(('%FileCheckRaw%', 'FileCheck'))
96-
# Also remove the lit.local.cfg under llvm/test/Reduce
97-
# and the pertinent FIXME in llvm/test/FileCheck
98-
####################################################
99-
10086
llvm_config.use_default_substitutions()
10187

10288
# Add site-specific substitutions.
@@ -162,8 +148,8 @@ def get_asan_rtlib():
162148
# FIXME: Why do we have both `lli` and `%lli` that do slightly different things?
163149
tools.extend([
164150
'dsymutil', 'lli', 'lli-child-target', 'llvm-ar', 'llvm-as',
165-
'llvm-addr2line', 'llvm-bcanalyzer', 'llvm-bitcode-strip', 'llvm-config',
166-
'llvm-cov', 'llvm-cxxdump', 'llvm-cvtres', 'llvm-diff', 'llvm-dis',
151+
'llvm-addr2line', 'llvm-bcanalyzer', 'llvm-bitcode-strip', 'llvm-config',
152+
'llvm-cov', 'llvm-cxxdump', 'llvm-cvtres', 'llvm-diff', 'llvm-dis',
167153
'llvm-dwarfdump', 'llvm-dlltool', 'llvm-exegesis', 'llvm-extract',
168154
'llvm-isel-fuzzer', 'llvm-ifs',
169155
'llvm-install-name-tool', 'llvm-jitlink', 'llvm-opt-fuzzer', 'llvm-lib',

llvm/utils/FileCheck/FileCheck.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static cl::opt<bool> AllowEmptyInput(
7878
"checks that some error message does not occur, for example."));
7979

8080
static cl::opt<bool> AllowUnusedPrefixes(
81-
"allow-unused-prefixes", cl::init(true), cl::ZeroOrMore,
81+
"allow-unused-prefixes", cl::init(false), cl::ZeroOrMore,
8282
cl::desc("Allow prefixes to be specified but not appear in the test."));
8383

8484
static cl::opt<bool> MatchFullLines(

0 commit comments

Comments
 (0)