1 ;--------------------------------------------------
2 ; Create the check file, good input, and bad input.
4 ; For both good and bad input, make sure the -v trace has at least one remark
5 ; so we can check how trace suppression is affected by -dump-input.
6 ;--------------------------------------------------
8 ; RUN: echo hello > %t.good
9 ; RUN: echo world >> %t.good
11 ; RUN: echo hello > %t.err
12 ; RUN: echo whirled >> %t.err
14 ; RUN: echo 'CHECK: hello' > %t.check
15 ; RUN: echo 'CHECK-NEXT: world' >> %t.check
17 ;--------------------------------------------------
18 ; Check -dump-input=<bad value>.
19 ;--------------------------------------------------
21 ; RUN: not FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
22 ; RUN: -match-full-lines -dump-input=foobar 2>&1 \
23 ; RUN: | FileCheck %s -match-full-lines -check-prefix=BADVAL
26 ; RUN: not FileCheck -dump-input=foobar 2>&1 \
27 ; RUN: | FileCheck %s -match-full-lines -check-prefix=BADVAL
29 BADVAL: {{F|f}}ile{{C|c}}heck{{.*}}: for the --dump-input option: Cannot find option named 'foobar'!
31 ;--------------------------------------------------
32 ; Check -dump-input=help.
33 ;--------------------------------------------------
35 ; Appended to normal command line.
36 ; RUN: FileCheck -input-file %t.err -color %t.check -dump-input=help \
37 ; RUN: | FileCheck %s -check-prefix=HELP
40 ; RUN: FileCheck -dump-input=help | FileCheck %s -check-prefix=HELP
43 HELP: The following description was requested by -dump-input=help
47 ;--------------------------------------------------
48 ; Check -dump-input=never.
50 ; Include the case without -v, which isn't covered elsewhere.
51 ;--------------------------------------------------
53 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
54 ; RUN: -match-full-lines -dump-input=never 2>&1 \
55 ; RUN: | FileCheck %s -match-full-lines -allow-empty \
56 ; RUN: -check-prefixes=NOTRACE,NODUMP
58 ; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
59 ; RUN: -match-full-lines -dump-input=never 2>&1 \
60 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,ERR,NODUMP
62 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
63 ; RUN: -match-full-lines -dump-input=never -v 2>&1 \
64 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=TRACE,NODUMP
66 ; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
67 ; RUN: -match-full-lines -dump-input=never -v 2>&1 \
68 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=TRACE,ERR,NODUMP
70 ;--------------------------------------------------
71 ; Check no -dump-input, which defaults to never.
72 ;--------------------------------------------------
74 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
75 ; RUN: -match-full-lines -v 2>&1 \
76 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=TRACE,NODUMP
78 ; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
79 ; RUN: -match-full-lines -v 2>&1 \
80 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=TRACE,ERR,NODUMP
82 ;--------------------------------------------------
83 ; Check -dump-input=fail.
85 ; Include the case without -v, which isn't covered elsewhere.
86 ;--------------------------------------------------
88 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
89 ; RUN: -match-full-lines -dump-input=fail 2>&1 \
90 ; RUN: | FileCheck %s -match-full-lines -allow-empty \
91 ; RUN: -check-prefixes=NOTRACE,NODUMP
93 ; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
94 ; RUN: -match-full-lines -dump-input=fail 2>&1 \
95 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,ERR,DUMP-ERR
97 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
98 ; RUN: -match-full-lines -dump-input=fail -v 2>&1 \
99 ; RUN: | FileCheck %s -match-full-lines -allow-empty \
100 ; RUN: -check-prefixes=NOTRACE,NODUMP
102 ; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
103 ; RUN: -match-full-lines -dump-input=fail -v 2>&1 \
104 ; RUN: | FileCheck %s -match-full-lines \
105 ; RUN: -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
107 ;--------------------------------------------------
108 ; Check -dump-input-on-failure.
109 ;--------------------------------------------------
111 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
112 ; RUN: -match-full-lines -dump-input-on-failure -v 2>&1 \
113 ; RUN: | FileCheck %s -match-full-lines -allow-empty \
114 ; RUN: -check-prefixes=NOTRACE,NODUMP
116 ; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
117 ; RUN: -match-full-lines -dump-input-on-failure -v 2>&1 \
118 ; RUN: | FileCheck %s -match-full-lines \
119 ; RUN: -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
121 ; RUN: env FILECHECK_DUMP_INPUT_ON_FAILURE=1 \
122 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
123 ; RUN: -match-full-lines -v 2>&1 \
124 ; RUN: | FileCheck %s -match-full-lines -allow-empty \
125 ; RUN: -check-prefixes=NOTRACE,NODUMP
127 ; RUN: env FILECHECK_DUMP_INPUT_ON_FAILURE=1 \
128 ; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
129 ; RUN: -match-full-lines -v 2>&1 \
130 ; RUN: | FileCheck %s -match-full-lines \
131 ; RUN: -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
133 ;--------------------------------------------------
134 ; Check -dump-input=always.
135 ;--------------------------------------------------
137 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
138 ; RUN: -match-full-lines -dump-input=always -v 2>&1 \
139 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,DUMP-OK
141 ; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
142 ; RUN: -match-full-lines -dump-input=always -v 2>&1 \
143 ; RUN: | FileCheck %s -match-full-lines \
144 ; RUN: -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
148 ;--------------------------------------------------
149 ; Check the output for all cases that actually process directives.
150 ;--------------------------------------------------
152 ; Trace is sometimes suppressed.
153 ; TRACE: {{.*}}remark:{{.*}}
154 ; NOTRACE-NOT: remark:
156 ; Error diagnostics are never suppressed.
157 ; ERR: {{.*}}error:{{.*}}
161 ; DUMP-OK: Full input was:
162 ; DUMP-OK-NEXT: <<<<<<
163 ; DUMP-OK-NEXT: 1: hello
164 ; DUMP-OK-NEXT: check:1 ^~~~~
165 ; DUMP-OK-NEXT: 2: world
166 ; DUMP-OK-NEXT: next:2 ^~~~~
167 ; DUMP-OK-NEXT: >>>>>>
169 ; DUMP-ERR: Full input was:
170 ; DUMP-ERR-NEXT: <<<<<<
171 ; DUMP-ERR-NEXT: 1: hello
172 ; DUMP-ERR-V-NEXT: check:1 ^~~~~
173 ; DUMP-ERR-NEXT: 2: whirled
174 ; DUMP-ERR-NEXT: next:2 X~~~~~~ error: no match found
175 ; DUMP-ERR-NEXT: >>>>>>