[FileCheck] Make FILECHECK_OPTS useful for its test suite

Without this patch, `FILECHECK_OPTS` isn't propagated to FileCheck's
test suite so that `FILECHECK_OPTS` doesn't inadvertently affect test
results by affecting the output of FileCheck calls under test.  As a
result, `FILECHECK_OPTS` is useless for debugging FileCheck's test
suite.

In `llvm/test/FileCheck/lit.local.cfg`, this patch provides a new
subsitution, `%ProtectFileCheckOutput`, to address this problem for
both `FILECHECK_OPTS` and the deprecated
`FILECHECK_DUMP_INPUT_ON_FAILURE`.  The rest of the patch uses
`%ProtectFileCheckOutput` throughout the test suite

Fixes PR40284.

Reviewed By: probinson, thopre

Differential Revision: https://reviews.llvm.org/D65121
This commit is contained in:
Joel E. Denny
2019-11-20 17:12:29 -05:00
parent b8b57087d3
commit f471eb8e99
30 changed files with 317 additions and 114 deletions
+7
View File
@@ -549,6 +549,13 @@ RUN lines:
``i686-pc-mingw32``. This allows a test to run with a specific ABI without
constraining it to a specific triple.
**FileCheck-specific substitutions:**
``%ProtectFileCheckOutput``
This should precede a ``FileCheck`` call if and only if the call's textual
output affects test results. It's usually easy to tell: just look for
redirection or piping of the ``FileCheck`` call's stdout or stderr.
To add more substituations, look at ``test/lit.cfg`` or ``lit.local.cfg``.
+21 -7
View File
@@ -4,19 +4,27 @@
this is something else
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-ERR1 2>&1 | FileCheck %s --check-prefix=ERRCOUNT1
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-ERR1 2>&1 \
; RUN: | FileCheck %s --check-prefix=ERRCOUNT1
CHECK-ERR1-COUNT-xx: this
ERRCOUNT1: [[@LINE-1]]:18: error: invalid count in -COUNT specification on prefix 'CHECK-ERR1'
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-ERR2 2>&1 | FileCheck %s --check-prefix=ERRCOUNT2
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-ERR2 2>&1 \
; RUN: | FileCheck %s --check-prefix=ERRCOUNT2
CHECK-ERR2-COUNT-0x1: something
ERRCOUNT2: [[@LINE-1]]:19: error: invalid count in -COUNT specification on prefix 'CHECK-ERR2'
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-ERR3 2>&1 | FileCheck %s --check-prefix=ERRCOUNT3
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-ERR3 2>&1 \
; RUN: | FileCheck %s --check-prefix=ERRCOUNT3
CHECK-ERR3-COUNT-100x: else
ERRCOUNT3: [[@LINE-1]]:21: error: invalid count in -COUNT specification on prefix 'CHECK-ERR3'
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-ERR4 2>&1 | FileCheck %s --check-prefix=ERRCOUNT4
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-ERR4 2>&1 \
; RUN: | FileCheck %s --check-prefix=ERRCOUNT4
CHECK-ERR4-COUNT-0: else
ERRCOUNT4: [[@LINE-1]]:19: error: invalid count in -COUNT specification on prefix 'CHECK-ERR4'
@@ -80,17 +88,23 @@ CHECK-CNTMANY-EMPTY:
; Tests on mismatches:
;
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-MIS1 2>&1 | FileCheck %s --check-prefix=MISCOUNT1
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-MIS1 2>&1 \
; RUN: | FileCheck %s --check-prefix=MISCOUNT1
CHECK-MIS1-COUNT-3: this is duplicate
CHECK-MIS1: {{^}}this is not duplicate
MISCOUNT1: [[@LINE-1]]:13: error: CHECK-MIS1: expected string not found in input
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-MIS2 2>&1 | FileCheck %s --check-prefix=MISCOUNT2
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-MIS2 2>&1 \
; RUN: | FileCheck %s --check-prefix=MISCOUNT2
CHECK-MIS2-COUNT-10: {{^this is duplicate}}
CHECK-MIS2: {{^}}this is not duplicate
MISCOUNT2: [[@LINE-2]]:22: error: CHECK-MIS2-COUNT: expected string not found in input
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-MIS3 2>&1 | FileCheck %s --check-prefix=MISCOUNT3
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-MIS3 2>&1 \
; RUN: | FileCheck %s --check-prefix=MISCOUNT3
CHECK-MIS3-COUNT-5: this is duplicate
CHECK-MIS3-EMPTY:
CHECK-MIS3-LABEL: Many-label:
+18 -6
View File
@@ -8,32 +8,44 @@ CHECK1-EMPTY:
CHECK1-NEXT: bar
; next line must be blank
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK2A 2>&1 | FileCheck %s --check-prefix=CHECK2B
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK2A 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK2B
badger
CHECK2A: badger
CHECK2A-EMPTY:
CHECK2B: CHECK2A-EMPTY: is not on the line after the previous match
; CHECK-EMPTY must have empty pattern
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK3A 2>&1 | FileCheck %s --check-prefix=CHECK3B
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK3A 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK3B
CHECK3A: foo
CHECK3A-EMPTY: this is not empty
CHECK3B: found non-empty check string for empty check with prefix 'CHECK3A:'
; CHECK-EMPTY cannot be the first check
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK4A 2>&1 | FileCheck %s --check-prefix=CHECK4B
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK4A 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK4B
CHECK4A-EMPTY:
CHECK4B: found 'CHECK4A-EMPTY' without previous 'CHECK4A: line
; CHECK-EMPTY-NOT and CHECK-NOT-EMPTY rejected
; RUN: not FileCheck %s --input-file %s --check-prefixes=CHECK5A 2>&1 | FileCheck %s --check-prefix=CHECK5C
; RUN: not FileCheck %s --input-file %s --check-prefixes=CHECK5B 2>&1 | FileCheck %s --check-prefix=CHECK5C
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck %s --input-file %s --check-prefixes=CHECK5A 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK5C
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck %s --input-file %s --check-prefixes=CHECK5B 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK5C
CHECK5A-EMPTY-NOT:
CHECK5B-NOT-EMPTY:
CHECK5C: unsupported -NOT combo on prefix 'CHECK5{{A|B}}'
; whitespace does not count as empty
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK6A --match-full-lines 2>&1 | FileCheck %s --check-prefix=CHECK6B
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK6A --match-full-lines \
; RUN: 2>&1 | FileCheck %s --check-prefix=CHECK6B
CHECK6A: the next line has spaces
CHECK6A-EMPTY:
CHECK6B: expected string not found in input
+15 -4
View File
@@ -1,7 +1,18 @@
// RUN: not FileCheck -check-prefix=FOO %s </dev/null 2>&1 | FileCheck -check-prefix=EMPTY-ERR %s
// RUN: not FileCheck -check-prefix=NOFOO %s </dev/null 2>&1 | FileCheck -check-prefix=EMPTY-ERR %s
// RUN: not FileCheck -check-prefix=FOO -allow-empty %s </dev/null 2>&1 | FileCheck -check-prefix=NO-EMPTY-ERR -check-prefix=NOT-FOUND %s
// RUN: FileCheck -check-prefix=NOFOO -allow-empty %s </dev/null 2>&1 | FileCheck -allow-empty -check-prefix=NO-EMPTY-ERR %s
// RUN: %ProtectFileCheckOutput \
// RUN: not FileCheck -check-prefix=FOO %s </dev/null 2>&1 \
// RUN: | FileCheck -check-prefix=EMPTY-ERR %s
//
// RUN: %ProtectFileCheckOutput \
// RUN: not FileCheck -check-prefix=NOFOO %s </dev/null 2>&1 \
// RUN: | FileCheck -check-prefix=EMPTY-ERR %s
//
// RUN: %ProtectFileCheckOutput \
// RUN: not FileCheck -check-prefix=FOO -allow-empty %s </dev/null 2>&1 \
// RUN: | FileCheck -check-prefix=NO-EMPTY-ERR -check-prefix=NOT-FOUND %s
//
// RUN: %ProtectFileCheckOutput \
// RUN: FileCheck -check-prefix=NOFOO -allow-empty %s </dev/null 2>&1 \
// RUN: | FileCheck -allow-empty -check-prefix=NO-EMPTY-ERR %s
; FOO: foo
; NOFOO-NOT: foo
+4 -1
View File
@@ -15,7 +15,10 @@
## Check that option --implicit-not works case insensitively.
# RUN: sed '/^#/d' %s | FileCheck --implicit-check-not=sTrInG %s
# RUN: sed '/^#/d' %s | not FileCheck --ignore-case --implicit-check-not=sTrInG %s 2>&1 | FileCheck --check-prefix=ERROR %s
# RUN: sed '/^#/d' %s \
# RUN: | %ProtectFileCheckOutput \
# RUN: not FileCheck --ignore-case --implicit-check-not=sTrInG %s 2>&1 \
# RUN: | FileCheck --check-prefix=ERROR %s
this is the STRING to be matched
+2 -1
View File
@@ -1,4 +1,5 @@
; RUN: not FileCheck -input-file %s %s 2>&1 | FileCheck --check-prefix=ERROR %s
; RUN: %ProtectFileCheckOutput not FileCheck -input-file %s %s 2>&1 \
; RUN: | FileCheck --check-prefix=ERROR %s
bar
zed
+4 -1
View File
@@ -1,5 +1,8 @@
; RUN: FileCheck -input-file %s %s -check-prefix=CHECKOK
; RUN: not FileCheck -input-file %s %s -check-prefix=CHECKFAIL 2>&1 | FileCheck %s -check-prefix=CHECKERROR
;
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %s %s -check-prefix=CHECKFAIL 2>&1 \
; RUN: | FileCheck %s -check-prefix=CHECKERROR
label0:
a
@@ -1,6 +1,14 @@
; RUN: not FileCheck -input-file %s %s -check-prefix=FOO -check-prefix=BAR 2>&1 | FileCheck %s
; RUN: not FileCheck -input-file %s %s -check-prefixes=FOO,BAR 2>&1 | FileCheck %s
; RUN: not FileCheck -input-file %s %s -check-prefixes=BAR,FOO 2>&1 | FileCheck %s
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %s %s -check-prefix=FOO -check-prefix=BAR \
; RUN: 2>&1 | FileCheck %s
;
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %s %s -check-prefixes=FOO,BAR 2>&1 \
; RUN: | FileCheck %s
;
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %s %s -check-prefixes=BAR,FOO 2>&1 \
; RUN: | FileCheck %s
fog
bar
@@ -1,6 +1,14 @@
; RUN: not FileCheck -input-file %s %s -check-prefix=FOO -check-prefix=BAR 2>&1 | FileCheck %s
; RUN: not FileCheck -input-file %s %s -check-prefixes=FOO,BAR 2>&1 | FileCheck %s
; RUN: not FileCheck -input-file %s %s -check-prefixes=BAR,FOO 2>&1 | FileCheck %s
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %s %s -check-prefix=FOO -check-prefix=BAR \
; RUN: 2>&1 | FileCheck %s
;
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %s %s -check-prefixes=FOO,BAR 2>&1 \
; RUN: | FileCheck %s
;
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %s %s -check-prefixes=BAR,FOO 2>&1 \
; RUN: | FileCheck %s
BAR
bar
+1 -1
View File
@@ -1,4 +1,4 @@
; RUN: not FileCheck --input-file %s %s 2>&1 \
; RUN: %ProtectFileCheckOutput not FileCheck --input-file %s %s 2>&1 \
; RUN: | FileCheck --strict-whitespace --check-prefix DIAG %s
CHECK-NOT: test
+4 -1
View File
@@ -1,5 +1,8 @@
// RUN: FileCheck -check-prefix=ANOTHER-PREFIX -input-file %s %s
// RUN: not FileCheck -check-prefix=PREFIX -input-file %s %s 2>&1 | FileCheck -check-prefix=CHECK-NONEXISTENT-PREFIX %s
//
// RUN: %ProtectFileCheckOutput \
// RUN: not FileCheck -check-prefix=PREFIX -input-file %s %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-NONEXISTENT-PREFIX %s
foobar
; ANOTHER-PREFIX: foobar
@@ -15,6 +15,7 @@
; RUN: echo 'CHECK: hello' > %t.chk
; RUN: echo 'CHECK: universe' >> %t.chk
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
; RUN: | FileCheck -strict-whitespace -match-full-lines -check-prefix=ALIGN \
; RUN: -implicit-check-not='remark:' %s
@@ -51,12 +52,15 @@
; RUN: echo 'CHECK: hello' > %t.chk
; RUN: echo 'CHECK: world' >> %t.chk
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefix=CHK \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=CHK,CHK-V \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=CHK,CHK-V \
; RUN: -implicit-check-not='remark:'
@@ -88,12 +92,15 @@
; RUN: echo 'CHECK-COUNT-3: pete' > %t.chk
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=CNT,CNT-Q \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=CNT,CNT-V \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=CNT,CNT-V \
; RUN: -implicit-check-not='remark:'
@@ -125,12 +132,15 @@
; RUN: echo 'CHECK-NEXT: again' >> %t.chk
; RUN: echo 'CHECK-NEXT: world' >> %t.chk
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefix=NXT \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=NXT,NXT-V \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=NXT,NXT-V,NXT-VV \
; RUN: -implicit-check-not='remark:'
@@ -153,6 +163,7 @@
; RUN: echo 'yonder' >> %t.in
; RUN: echo 'world' >> %t.in
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefix=NXT2
@@ -178,12 +189,15 @@
; RUN: echo 'CHECK-SAME: world' >> %t.chk
; RUN: echo 'CHECK-SAME: again' >> %t.chk
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefix=SAM \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=SAM,SAM-V \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=SAM,SAM-V,SAM-VV \
; RUN: -implicit-check-not='remark:'
@@ -203,6 +217,7 @@
; RUN: echo 'again' >> %t.in
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=SAM2 \
; RUN: -implicit-check-not='remark:'
@@ -241,12 +256,15 @@
; RUN: echo 'CHECK-EMPTY:' >> %t.chk
; RUN: echo 'CHECK-LABEL: label' >> %t.chk
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefix=EMP \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=EMP,EMP-V \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=EMP,EMP-V,EMP-VV \
; RUN: -implicit-check-not='remark:'
@@ -275,12 +293,15 @@
; RUN: echo 'CHECK: hello' > %t.chk
; RUN: echo 'CHECK-EMPTY:' >> %t.chk
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefix=EMP2 \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=EMP2,EMP2-V \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=EMP2,EMP2-V,EMP2-VV \
; RUN: -implicit-check-not='remark:'
@@ -310,12 +331,15 @@
; RUN: echo 'CHECK-NOT: goodbye' > %t.chk
; RUN: echo 'CHECK-NOT: world' >> %t.chk
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefix=NOT \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=NOT,NOT-V \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=NOT,NOT-V,NOT-VV \
; RUN: -implicit-check-not='remark:'
@@ -340,12 +364,15 @@
; RUN: echo 'CHECK: ain' >> %t.chk
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefix=NOT2 \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=NOT2,NOT2-V \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=NOT2,NOT2-V,NOT2-VV \
; RUN: -implicit-check-not='remark:'
@@ -387,12 +414,15 @@
; DAG-VQ = -v and not -vv
; DAG-VV = -vv
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG,DAG-Q \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG,DAG-V,DAG-VQ \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG,DAG-V,DAG-VV \
; RUN: -implicit-check-not='remark:'
@@ -434,12 +464,15 @@
; RUN: echo 'CHECK: foo' >> %t.chk
; RUN: echo 'CHECK-LABEL: lab2' >> %t.chk
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=LAB \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=LAB,LAB-V \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=LAB,LAB-V,LAB-VV \
; RUN: -implicit-check-not='remark:'
+22 -5
View File
@@ -18,12 +18,13 @@
; Check -dump-input=<bad value>.
;--------------------------------------------------
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=foobar 2>&1 \
; RUN: | FileCheck %s -match-full-lines -check-prefix=BADVAL
; No positional arg.
; RUN: not FileCheck -dump-input=foobar 2>&1 \
; RUN: %ProtectFileCheckOutput not FileCheck -dump-input=foobar 2>&1 \
; RUN: | FileCheck %s -match-full-lines -check-prefix=BADVAL
BADVAL: {{F|f}}ile{{C|c}}heck{{.*}}: for the --dump-input option: Cannot find option named 'foobar'!
@@ -33,11 +34,13 @@ BADVAL: {{F|f}}ile{{C|c}}heck{{.*}}: for the --dump-input option: Cannot find op
;--------------------------------------------------
; Appended to normal command line.
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck -input-file %t.err -color %t.check -dump-input=help \
; RUN: | FileCheck %s -check-prefix=HELP
; No positional arg.
; RUN: FileCheck -dump-input=help | FileCheck %s -check-prefix=HELP
; RUN: %ProtectFileCheckOutput FileCheck -dump-input=help \
; RUN: | FileCheck %s -check-prefix=HELP
HELP-NOT: {{.}}
HELP: The following description was requested by -dump-input=help
@@ -50,19 +53,23 @@ HELP-NOT: {{.}}
; Include the case without -v, which isn't covered elsewhere.
;--------------------------------------------------
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=never 2>&1 \
; RUN: | FileCheck %s -match-full-lines -allow-empty \
; RUN: -check-prefixes=NOTRACE,NODUMP
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=never 2>&1 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,ERR,NODUMP
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=never -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=TRACE,NODUMP
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=never -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=TRACE,ERR,NODUMP
@@ -71,10 +78,12 @@ HELP-NOT: {{.}}
; Check no -dump-input, which defaults to never.
;--------------------------------------------------
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=TRACE,NODUMP
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=TRACE,ERR,NODUMP
@@ -85,20 +94,24 @@ HELP-NOT: {{.}}
; Include the case without -v, which isn't covered elsewhere.
;--------------------------------------------------
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=fail 2>&1 \
; RUN: | FileCheck %s -match-full-lines -allow-empty \
; RUN: -check-prefixes=NOTRACE,NODUMP
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=fail 2>&1 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,ERR,DUMP-ERR
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=fail -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines -allow-empty \
; RUN: -check-prefixes=NOTRACE,NODUMP
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=fail -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines \
@@ -108,23 +121,25 @@ HELP-NOT: {{.}}
; Check -dump-input-on-failure.
;--------------------------------------------------
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input-on-failure -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines -allow-empty \
; RUN: -check-prefixes=NOTRACE,NODUMP
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input-on-failure -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines \
; RUN: -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
; RUN: env FILECHECK_DUMP_INPUT_ON_FAILURE=1 \
; RUN: %ProtectFileCheckOutput FILECHECK_DUMP_INPUT_ON_FAILURE=1 \
; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines -allow-empty \
; RUN: -check-prefixes=NOTRACE,NODUMP
; RUN: -check-prefixes=NOTRACE,NODUMP
; RUN: env FILECHECK_DUMP_INPUT_ON_FAILURE=1 \
; RUN: %ProtectFileCheckOutput FILECHECK_DUMP_INPUT_ON_FAILURE=1 \
; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines \
@@ -134,10 +149,12 @@ HELP-NOT: {{.}}
; Check -dump-input=always.
;--------------------------------------------------
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=always -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,DUMP-OK
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
; RUN: -match-full-lines -dump-input=always -v 2>&1 \
; RUN: | FileCheck %s -match-full-lines \
+6 -2
View File
@@ -3,11 +3,15 @@
; CHECK: foo
; CHECK: bar
; RUN: env FILECHECK_OPTS= \
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck %s -input-file %t.in 2>&1 \
; RUN: | FileCheck -check-prefix QUIET %s
; RUN: env FILECHECK_OPTS=-v \
; RUN: %ProtectFileCheckOutput FILECHECK_OPTS= \
; RUN: not FileCheck %s -input-file %t.in 2>&1 \
; RUN: | FileCheck -check-prefix QUIET %s
; RUN: %ProtectFileCheckOutput FILECHECK_OPTS=-v \
; RUN: not FileCheck %s -input-file %t.in 2>&1 \
; RUN: | FileCheck -check-prefix VERB %s
+7 -7
View File
@@ -1,11 +1,11 @@
; RUN: sed 's#^;.*##' %s | FileCheck -check-prefix=CHECK-PASS -implicit-check-not=warning: %s
; RUN: sed 's#^;.*##' %s | not FileCheck -check-prefix=CHECK-FAIL1 -implicit-check-not=warning: %s 2>&1 | FileCheck %s -check-prefix CHECK-ERROR1
; RUN: sed 's#^;.*##' %s | not FileCheck -check-prefix=CHECK-FAIL2 -implicit-check-not=warning: %s 2>&1 | FileCheck %s -check-prefix CHECK-ERROR2
; RUN: sed 's#^;.*##' %s | not FileCheck -check-prefix=CHECK-FAIL3 -implicit-check-not=warning: %s 2>&1 | FileCheck %s -check-prefix CHECK-ERROR3
; RUN: sed 's#^;.*##' %s | not FileCheck -check-prefix=CHECK-FAIL1 -implicit-check-not='{{aaa|bbb|ccc}}' %s 2>&1 | FileCheck %s -check-prefix CHECK-ERROR4
; RUN: sed 's#^;.*##' %s | not FileCheck -check-prefix=CHECK-FAIL1 -implicit-check-not=aaa -implicit-check-not=bbb -implicit-check-not=ccc %s 2>&1 | FileCheck %s -check-prefix CHECK-ERROR5
; RUN: sed 's#^;.*##' %s | not FileCheck -check-prefix=CHECK-FAIL2 -implicit-check-not=aaa -implicit-check-not=bbb -implicit-check-not=ccc %s 2>&1 | FileCheck %s -check-prefix CHECK-ERROR6
; RUN: sed 's#^;.*##' %s | not FileCheck -check-prefix=CHECK-FAIL3 -implicit-check-not=aaa -implicit-check-not=bbb -implicit-check-not=ccc %s 2>&1 | FileCheck %s -check-prefix CHECK-ERROR7
; RUN: sed 's#^;.*##' %s | %ProtectFileCheckOutput not FileCheck -check-prefix=CHECK-FAIL1 -implicit-check-not=warning: %s 2>&1 | FileCheck %s -check-prefix CHECK-ERROR1
; RUN: sed 's#^;.*##' %s | %ProtectFileCheckOutput not FileCheck -check-prefix=CHECK-FAIL2 -implicit-check-not=warning: %s 2>&1 | FileCheck %s -check-prefix CHECK-ERROR2
; RUN: sed 's#^;.*##' %s | %ProtectFileCheckOutput not FileCheck -check-prefix=CHECK-FAIL3 -implicit-check-not=warning: %s 2>&1 | FileCheck %s -check-prefix CHECK-ERROR3
; RUN: sed 's#^;.*##' %s | %ProtectFileCheckOutput not FileCheck -check-prefix=CHECK-FAIL1 -implicit-check-not='{{aaa|bbb|ccc}}' %s 2>&1 | FileCheck %s -check-prefix CHECK-ERROR4
; RUN: sed 's#^;.*##' %s | %ProtectFileCheckOutput not FileCheck -check-prefix=CHECK-FAIL1 -implicit-check-not=aaa -implicit-check-not=bbb -implicit-check-not=ccc %s 2>&1 | FileCheck %s -check-prefix CHECK-ERROR5
; RUN: sed 's#^;.*##' %s | %ProtectFileCheckOutput not FileCheck -check-prefix=CHECK-FAIL2 -implicit-check-not=aaa -implicit-check-not=bbb -implicit-check-not=ccc %s 2>&1 | FileCheck %s -check-prefix CHECK-ERROR6
; RUN: sed 's#^;.*##' %s | %ProtectFileCheckOutput not FileCheck -check-prefix=CHECK-FAIL3 -implicit-check-not=aaa -implicit-check-not=bbb -implicit-check-not=ccc %s 2>&1 | FileCheck %s -check-prefix CHECK-ERROR7
warning: aaa
; CHECK-PASS: warning: aaa
+25 -24
View File
@@ -1,15 +1,15 @@
; RUN: FileCheck -input-file %s %s
; RUN: not FileCheck -check-prefix BAD1 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR1 %s
; RUN: not FileCheck -check-prefix BAD2 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR2 %s
; RUN: not FileCheck -check-prefix BAD3 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR3 %s
; RUN: not FileCheck -check-prefix BAD4 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR4 %s
; RUN: not FileCheck -check-prefix BAD5 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR5 %s
; RUN: not FileCheck -check-prefix BAD6 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR6 %s
; RUN: not FileCheck -check-prefix BAD7 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR7 %s
; RUN: not FileCheck -check-prefix BAD8 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR8 %s
; RUN: not FileCheck -check-prefix BAD9 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR9 %s
; RUN: not FileCheck -check-prefix BAD10 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR10 %s
; RUN: not FileCheck -check-prefix BAD11 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR11 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD1 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR1 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD2 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR2 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD3 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR3 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD4 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR4 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD5 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR5 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD6 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR6 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD7 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR7 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD8 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR8 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD9 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR9 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD10 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR10 %s
; RUN: %ProtectFileCheckOutput not FileCheck -check-prefix BAD11 -input-file %s %s 2>&1 | FileCheck -check-prefix ERR11 %s
13
14 aaa
15 bbb
@@ -55,18 +55,19 @@
55 BAD11: [[@LINE-1x]]
56 ERR11: line-count.txt:[[#@LINE-1]]:20: error: unexpected characters at end of expression 'x'
57
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -check-prefix BAD12 -input-file %s %s 2>&1 \
; RUN: | FileCheck -check-prefix ERR12 %s
60
61 BAD12: [[#@LINE-1]] NOT HERE
62 ERR12: note: with "@LINE-1" equal to "60"
63
64 CHECK: [[#@LINE]] CHECK
65 CHECK: [[# @LINE]] CHECK
66 CHECK: [[# @LINE ]] CHECK
67
68 CHECK: [[#@LINE-1]]
69 CHECK: [[# @LINE-1]] CHECK
70 CHECK: [[# @LINE -1]] CHECK
71 CHECK: [[# @LINE - 1]] CHECK
72 CHECK: [[# @LINE - 1 ]] CHECK
61
62 BAD12: [[#@LINE-1]] NOT HERE
63 ERR12: note: with "@LINE-1" equal to "61"
64
65 CHECK: [[#@LINE]] CHECK
66 CHECK: [[# @LINE]] CHECK
67 CHECK: [[# @LINE ]] CHECK
68
69 CHECK: [[#@LINE-1]]
70 CHECK: [[# @LINE-1]] CHECK
71 CHECK: [[# @LINE -1]] CHECK
72 CHECK: [[# @LINE - 1]] CHECK
73 CHECK: [[# @LINE - 1 ]] CHECK
+51 -13
View File
@@ -3,16 +3,54 @@ import lit
# Use lit's internal shell to help guarantee test portability.
config.test_format = lit.formats.ShTest(execute_external=False)
# Unset environment variables that the FileCheck tests
# expect not to be set.
file_check_expected_unset_vars = [
'FILECHECK_DUMP_INPUT_ON_FAILURE',
'FILECHECK_OPTS',
]
for env_var in file_check_expected_unset_vars:
if env_var in config.environment:
lit_config.note('Removing {} from environment for FileCheck tests'.format(
env_var)
)
config.environment.pop(env_var)
# %ProtectFileCheckOutput should precede a FileCheck call if and only if the
# call's textual output affects test results. It's usually easy to tell: just
# look for redirection or piping of the FileCheck call's stdout or stderr.
#
# Examples:
#
# ; Test another program, using FileCheck to verify its textual output.
# ; Only FileCheck's exit status affects test results, so a bare FileCheck
# ; call is sufficient and more convenient for debugging.
# ;
# ; RUN: %t | FileCheck %s
# ; CHECK: {{[0-9]+\.0}}
#
# ; Test FileCheck itself, but only examine its exit status, so a bare
# ; FileCheck call is still sufficient and more convenient for debugging.
# ;
# ; RUN: FileCheck -input-file %s %s
# ; CHECK: {{[0-9]+\.0}}
# ; 5.0
#
# ; Check that the FileCheck trace is off by default. The first FileCheck
# ; call's textual output affects test results, so it requires
# ; %ProtectFileCheckOutput to be safe.
# ;
# ; RUN: %ProtectFileCheckOutput FileCheck -input-file %s %s 2>&1 \
# ; RUN: | FileCheck -allow-empty -check-prefix QUIET %s
# ;
# ; CHECK: {{[0-9]+\.0}}
# ; 5.0
# ; QUIET-NOT: expected string found in input
#
# ; Check that the FileCheck trace is on when FILECHECK_OPTS=-v.
# ; FILECHECK_OPTS must be set after %ProtectFileCheckOutput, which clears
# ; FILECHECK_OPTS beforehand.
# ;
# ; RUN: %ProtectFileCheckOutput FILECHECK_OPTS=-v \
# ; RUN: FileCheck -input-file %s %s 2>&1 \
# ; RUN: | FileCheck -check-prefix TRACE %s
# ;
# ; CHECK: {{[0-9]+\.0}}
# ; 5.0
# ; TRACE: expected string found in input
#
# %ProtectFileCheckOutput's purpose is to ensure correct test results when
# developers set FileCheck environment variables (e.g.,
# FILECHECK_OPTS=-dump-input=fail) to tweak the output of FileCheck while
# debugging tests. If a developer sets values that affect FileCheck's exit
# status (e.g., FILECHECK_OPTS=-strict-whitespace), he shouldn't be surprised
# that test results throughout all test suites are affected.
config.substitutions.append(('%ProtectFileCheckOutput',
'env -u FILECHECK_OPTS -u FILECHECK_DUMP_INPUT_ON_FAILURE'))
+5 -2
View File
@@ -1,7 +1,10 @@
// RUN: %ProtectFileCheckOutput \
// RUN: not FileCheck -match-full-lines -input-file %s %s 2>&1 \
// RUN: | FileCheck --check-prefix=ERROR --implicit-check-not=error: %s
// RUN: not FileCheck -match-full-lines -strict-whitespace -input-file %s %s 2>&1 \
// RUN: | FileCheck --check-prefix=ERROR-STRICT --check-prefix=ERROR --implicit-check-not=error: %s
// RUN: %ProtectFileCheckOutput \
// RUN: not FileCheck -match-full-lines -strict-whitespace -input-file %s %s \
// RUN: 2>&1 | FileCheck --check-prefix=ERROR-STRICT --check-prefix=ERROR \
// RUN: --implicit-check-not=error: %s
Label 1
a line
@@ -1,6 +1,6 @@
// RUN: FileCheck -check-prefix=ANOTHER-PREFIX -input-file %s %s
// RUN: not FileCheck -check-prefix=PREFIX1 -check-prefix=PREFIX2 -input-file %s %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK-NONEXISTENT-PREFIX -check-prefix=ALSO-NONEXISTENT %s
// RUN: not FileCheck -check-prefixes=PREFIX1,PREFIX2 -input-file %s %s 2>&1 | FileCheck -strict-whitespace -check-prefixes=CHECK-NONEXISTENT-PREFIX,ALSO-NONEXISTENT %s
// RUN: %ProtectFileCheckOutput not FileCheck -check-prefix=PREFIX1 -check-prefix=PREFIX2 -input-file %s %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK-NONEXISTENT-PREFIX -check-prefix=ALSO-NONEXISTENT %s
// RUN: %ProtectFileCheckOutput not FileCheck -check-prefixes=PREFIX1,PREFIX2 -input-file %s %s 2>&1 | FileCheck -strict-whitespace -check-prefixes=CHECK-NONEXISTENT-PREFIX,ALSO-NONEXISTENT %s
foobar
; ANOTHER-PREFIX: foobar
+1 -1
View File
@@ -1,3 +1,3 @@
; RUN: not FileCheck 2>&1 | FileCheck %s
; RUN: %ProtectFileCheckOutput not FileCheck 2>&1 | FileCheck %s
CHECK: <check-file> not specified

Some files were not shown because too many files have changed in this diff Show More