1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[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
This commit is contained in:
Fangrui Song 2021-02-08 13:37:03 -08:00
parent 02db0b26fe
commit 6da5cc31da
7 changed files with 6 additions and 46 deletions

View File

@ -2,10 +2,7 @@
; 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
; RUN: FileCheck --allow-unused-prefixes=true --check-prefixes=P1,P2 --input-file %S/Inputs/one-check.txt %S/Inputs/one-check.txt
; 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
;; Note: the default will be changed to 'false', at which time this run line
;; should be changed accordingly.
; RUN: FileCheck --check-prefixes=P1,P2 --input-file %S/Inputs/one-check.txt %S/Inputs/one-check.txt
; RUN: not FileCheck --check-prefixes=P1,P2 --input-file %S/Inputs/one-check.txt %S/Inputs/one-check.txt
; MISSING-ONE: error: no check strings found with prefix 'P2:'
; MISSING-MORE: error: no check strings found with prefixes 'P2:', 'P3:'

View File

@ -54,12 +54,3 @@ config.test_format = lit.formats.ShTest(execute_external=False)
# that test results throughout all test suites are affected.
config.substitutions.append(('%ProtectFileCheckOutput',
'env -u FILECHECK_OPTS'))
# FIXME: remove this once the default is flipped.
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'):
del config.substitutions[0]

View File

@ -39,7 +39,7 @@
; f2() in f3().
; RUN: %python %S/opt-bisect-helper.py --start=0 --end=256 --optcmd=opt \
; RUN: --filecheckcmd=%FileCheckRaw% --test=%s \
; RUN: --filecheckcmd=FileCheck --test=%s \
; RUN: --prefix=CHECK-BISECT-INLINE-HELPER \
; RUN: | FileCheck %s --check-prefix=CHECK-BISECT-INLINE-RESULT
; The helper script uses this to find the optimization that inlines the call.

View File

@ -1,8 +0,0 @@
# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
# FIXME: remove this file when we flip the default for --allow-unused-prefixes.
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'):
del config.substitutions[0]

View File

@ -2,10 +2,4 @@
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'))
config.substitutions.insert(0, (fc.regex, 'FileCheck --allow-unused-prefixes'))

View File

@ -83,20 +83,6 @@ def get_asan_rtlib():
return found_dylibs[0]
####################################################
# 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'))
# When addressing this fixme, replace %FileCheckRaw% with just FileCheck.
config.substitutions.append(('%FileCheckRaw%', 'FileCheck'))
# Also remove the lit.local.cfg under llvm/test/Reduce
# and the pertinent FIXME in llvm/test/FileCheck
####################################################
llvm_config.use_default_substitutions()
# Add site-specific substitutions.
@ -162,8 +148,8 @@ tools = [
# FIXME: Why do we have both `lli` and `%lli` that do slightly different things?
tools.extend([
'dsymutil', 'lli', 'lli-child-target', 'llvm-ar', 'llvm-as',
'llvm-addr2line', 'llvm-bcanalyzer', 'llvm-bitcode-strip', 'llvm-config',
'llvm-cov', 'llvm-cxxdump', 'llvm-cvtres', 'llvm-diff', 'llvm-dis',
'llvm-addr2line', 'llvm-bcanalyzer', 'llvm-bitcode-strip', 'llvm-config',
'llvm-cov', 'llvm-cxxdump', 'llvm-cvtres', 'llvm-diff', 'llvm-dis',
'llvm-dwarfdump', 'llvm-dlltool', 'llvm-exegesis', 'llvm-extract',
'llvm-isel-fuzzer', 'llvm-ifs',
'llvm-install-name-tool', 'llvm-jitlink', 'llvm-opt-fuzzer', 'llvm-lib',

View File

@ -78,7 +78,7 @@ static cl::opt<bool> AllowEmptyInput(
"checks that some error message does not occur, for example."));
static cl::opt<bool> AllowUnusedPrefixes(
"allow-unused-prefixes", cl::init(true), cl::ZeroOrMore,
"allow-unused-prefixes", cl::init(false), cl::ZeroOrMore,
cl::desc("Allow prefixes to be specified but not appear in the test."));
static cl::opt<bool> MatchFullLines(