1 ; To keep this test maintainable, avoid depending on -dump-input-context's
2 ; default value, which is checked in dump-input-context.txt instead.
4 ;--------------------------------------------------
5 ; Create the input file and the check file.
6 ;--------------------------------------------------
9 ; RUN: echo start > %t.in
10 ; RUN: echo foo0 >> %t.in
11 ; RUN: echo foo1 >> %t.in
12 ; RUN: echo foo2 >> %t.in
13 ; RUN: echo foo3 >> %t.in
14 ; RUN: echo foo4 >> %t.in
15 ; RUN: echo foo5 >> %t.in
16 ; RUN: echo foo6 >> %t.in
17 ; RUN: echo foo7 >> %t.in
18 ; RUN: echo foo8 >> %t.in
19 ; RUN: echo foo9 >> %t.in
21 ; RUN: echo hello >> %t.in
22 ; RUN: echo foo0 >> %t.in
23 ; RUN: echo foo1 >> %t.in
24 ; RUN: echo foo2 >> %t.in
25 ; RUN: echo foo3 >> %t.in
26 ; RUN: echo foo4 >> %t.in
27 ; RUN: echo foo5 >> %t.in
28 ; RUN: echo foo6 >> %t.in
29 ; RUN: echo foo7 >> %t.in
30 ; RUN: echo foo8 >> %t.in
31 ; RUN: echo foo9 >> %t.in
33 ; RUN: echo word >> %t.in
34 ; RUN: echo foo0 >> %t.in
35 ; RUN: echo foo1 >> %t.in
36 ; RUN: echo foo2 >> %t.in
37 ; RUN: echo foo3 >> %t.in
38 ; RUN: echo foo4 >> %t.in
39 ; RUN: echo foo5 >> %t.in
40 ; RUN: echo foo6 >> %t.in
41 ; RUN: echo foo7 >> %t.in
42 ; RUN: echo foo8 >> %t.in
43 ; RUN: echo foo9 >> %t.in
45 ; RUN: echo end >> %t.in
47 ; RUN: echo 'CHECK: start' > %t.chk
48 ; RUN: echo 'CHECK: hello' >> %t.chk
49 ; RUN: echo 'CHECK: world' >> %t.chk
50 ; RUN: echo 'CHECK: end' >> %t.chk
52 ;--------------------------------------------------
53 ; Directives for checking the dump.
54 ;--------------------------------------------------
58 ; ALL-NEXT: check:1 ^~~~~
70 ; ALL-NEXT: check:2 ^~~~~
71 ; ALL-NEXT: check:3'0 X error: no match found
73 ; ALL-NEXT: check:3'0 ~~~~~
75 ; ALL-NEXT: check:3'0 ~~~~~
77 ; ALL-NEXT: check:3'0 ~~~~~
79 ; ALL-NEXT: check:3'0 ~~~~~
81 ; ALL-NEXT: check:3'0 ~~~~~
83 ; ALL-NEXT: check:3'0 ~~~~~
85 ; ALL-NEXT: check:3'0 ~~~~~
87 ; ALL-NEXT: check:3'0 ~~~~~
89 ; ALL-NEXT: check:3'0 ~~~~~
91 ; ALL-NEXT: check:3'0 ~~~~~
93 ; ALL-NEXT: check:3'0 ~~~~~
94 ; ALL-NEXT: check:3'1 ? possible intended match
96 ; ALL-NEXT: check:3'0 ~~~~~
98 ; ALL-NEXT: check:3'0 ~~~~~
100 ; ALL-NEXT: check:3'0 ~~~~~
102 ; ALL-NEXT: check:3'0 ~~~~~
104 ; ALL-NEXT: check:3'0 ~~~~~
106 ; ALL-NEXT: check:3'0 ~~~~~
108 ; ALL-NEXT: check:3'0 ~~~~~
110 ; ALL-NEXT: check:3'0 ~~~~~
112 ; ALL-NEXT: check:3'0 ~~~~~
114 ; ALL-NEXT: check:3'0 ~~~~~
116 ; ALL-NEXT: check:3'0 ~~~~
119 ; ANNOTATION-FULL: <<<<<<
120 ; ANNOTATION-FULL-NEXT: 1: start
121 ; ANNOTATION-FULL-NEXT: check:1 ^~~~~
122 ; ANNOTATION-FULL-NEXT: 2: foo0
123 ; ANNOTATION-FULL-NEXT: 3: foo1
124 ; ANNOTATION-FULL-NEXT: .
125 ; ANNOTATION-FULL-NEXT: .
126 ; ANNOTATION-FULL-NEXT: .
127 ; ANNOTATION-FULL-NEXT: 10: foo8
128 ; ANNOTATION-FULL-NEXT: 11: foo9
129 ; ANNOTATION-FULL-NEXT: 12: hello
130 ; ANNOTATION-FULL-NEXT: check:2 ^~~~~
131 ; ANNOTATION-FULL-NEXT: check:3'0 X error: no match found
132 ; ANNOTATION-FULL-NEXT: 13: foo0
133 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
134 ; ANNOTATION-FULL-NEXT: 14: foo1
135 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
136 ; ANNOTATION-FULL-NEXT: 15: foo2
137 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
138 ; ANNOTATION-FULL-NEXT: 16: foo3
139 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
140 ; ANNOTATION-FULL-NEXT: 17: foo4
141 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
142 ; ANNOTATION-FULL-NEXT: 18: foo5
143 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
144 ; ANNOTATION-FULL-NEXT: 19: foo6
145 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
146 ; ANNOTATION-FULL-NEXT: 20: foo7
147 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
148 ; ANNOTATION-FULL-NEXT: 21: foo8
149 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
150 ; ANNOTATION-FULL-NEXT: 22: foo9
151 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
152 ; ANNOTATION-FULL-NEXT: 23: word
153 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
154 ; ANNOTATION-FULL-NEXT: check:3'1 ? possible intended match
155 ; ANNOTATION-FULL-NEXT: 24: foo0
156 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
157 ; ANNOTATION-FULL-NEXT: 25: foo1
158 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
159 ; ANNOTATION-FULL-NEXT: 26: foo2
160 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
161 ; ANNOTATION-FULL-NEXT: 27: foo3
162 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
163 ; ANNOTATION-FULL-NEXT: 28: foo4
164 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
165 ; ANNOTATION-FULL-NEXT: 29: foo5
166 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
167 ; ANNOTATION-FULL-NEXT: 30: foo6
168 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
169 ; ANNOTATION-FULL-NEXT: 31: foo7
170 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
171 ; ANNOTATION-FULL-NEXT: 32: foo8
172 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
173 ; ANNOTATION-FULL-NEXT: 33: foo9
174 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~~
175 ; ANNOTATION-FULL-NEXT: 34: end
176 ; ANNOTATION-FULL-NEXT: check:3'0 ~~~~
177 ; ANNOTATION-FULL-NEXT: >>>>>>
180 ; ANNOTATION-NEXT: 1: start
181 ; ANNOTATION-NEXT: check:1 ^~~~~
182 ; ANNOTATION-NEXT: 2: foo0
183 ; ANNOTATION-NEXT: 3: foo1
187 ; ANNOTATION-NEXT: 10: foo8
188 ; ANNOTATION-NEXT: 11: foo9
189 ; ANNOTATION-NEXT: 12: hello
190 ; ANNOTATION-NEXT: check:2 ^~~~~
191 ; ANNOTATION-NEXT: check:3'0 X error: no match found
192 ; ANNOTATION-NEXT: 13: foo0
193 ; ANNOTATION-NEXT: check:3'0 ~~~~~
194 ; ANNOTATION-NEXT: 14: foo1
195 ; ANNOTATION-NEXT: check:3'0 ~~~~~
199 ; ANNOTATION-NEXT: 21: foo8
200 ; ANNOTATION-NEXT: check:3'0 ~~~~~
201 ; ANNOTATION-NEXT: 22: foo9
202 ; ANNOTATION-NEXT: check:3'0 ~~~~~
203 ; ANNOTATION-NEXT: 23: word
204 ; ANNOTATION-NEXT: check:3'0 ~~~~~
205 ; ANNOTATION-NEXT: check:3'1 ? possible intended match
206 ; ANNOTATION-NEXT: 24: foo0
207 ; ANNOTATION-NEXT: check:3'0 ~~~~~
208 ; ANNOTATION-NEXT: 25: foo1
209 ; ANNOTATION-NEXT: check:3'0 ~~~~~
213 ; ANNOTATION-NEXT: >>>>>>
219 ; ERROR-NEXT: 10: foo8
220 ; ERROR-NEXT: 11: foo9
221 ; ERROR-NEXT: 12: hello
222 ; ERROR-NEXT: check:2 ^~~~~
223 ; ERROR-NEXT: check:3'0 X error: no match found
224 ; ERROR-NEXT: 13: foo0
225 ; ERROR-NEXT: check:3'0 ~~~~~
226 ; ERROR-NEXT: 14: foo1
227 ; ERROR-NEXT: check:3'0 ~~~~~
231 ; ERROR-NEXT: 21: foo8
232 ; ERROR-NEXT: check:3'0 ~~~~~
233 ; ERROR-NEXT: 22: foo9
234 ; ERROR-NEXT: check:3'0 ~~~~~
235 ; ERROR-NEXT: 23: word
236 ; ERROR-NEXT: check:3'0 ~~~~~
237 ; ERROR-NEXT: check:3'1 ? possible intended match
238 ; ERROR-NEXT: 24: foo0
239 ; ERROR-NEXT: check:3'0 ~~~~~
240 ; ERROR-NEXT: 25: foo1
241 ; ERROR-NEXT: check:3'0 ~~~~~
247 ;--------------------------------------------------
248 ; Check -dump-input-filter=<bad value>.
249 ;--------------------------------------------------
251 ; RUN: %ProtectFileCheckOutput \
252 ; RUN: not FileCheck -dump-input-context=2 -vv %t.chk < %t.in 2>&1 \
253 ; RUN: -dump-input-filter=foobar \
254 ; RUN: | FileCheck %s -match-full-lines -check-prefix=BADVAL
256 BADVAL: {{F|f}}ile{{C|c}}heck{{.*}}: for the --dump-input-filter option: Cannot find option named 'foobar'!
258 ;--------------------------------------------------
259 ; Check -dump-input-filter explicit values.
260 ;--------------------------------------------------
262 ; RUN: %ProtectFileCheckOutput \
263 ; RUN: not FileCheck -dump-input-context=2 -vv %t.chk < %t.in 2>&1 \
264 ; RUN: -dump-input-filter=all \
265 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=ALL
267 ; RUN: %ProtectFileCheckOutput \
268 ; RUN: not FileCheck -dump-input-context=2 -vv %t.chk < %t.in 2>&1 \
269 ; RUN: -dump-input-filter=annotation-full \
270 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=ANNOTATION-FULL
272 ; RUN: %ProtectFileCheckOutput \
273 ; RUN: not FileCheck -dump-input-context=2 -vv %t.chk < %t.in 2>&1 \
274 ; RUN: -dump-input-filter=annotation \
275 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=ANNOTATION
277 ; RUN: %ProtectFileCheckOutput \
278 ; RUN: not FileCheck -dump-input-context=2 -vv %t.chk < %t.in 2>&1 \
279 ; RUN: -dump-input-filter=error \
280 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=ERROR
282 ;--------------------------------------------------
283 ; Check -dump-input-filter defaults.
284 ;--------------------------------------------------
286 ; no -dump-input => -dump-input-filter=error
287 ; RUN: %ProtectFileCheckOutput \
288 ; RUN: not FileCheck -dump-input-context=2 -vv %t.chk < %t.in 2>&1 \
289 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=ERROR
291 ; -dump-input=fail => -dump-input-filter=error
292 ; RUN: %ProtectFileCheckOutput \
293 ; RUN: not FileCheck -dump-input-context=2 -vv %t.chk < %t.in 2>&1 \
294 ; RUN: -dump-input=fail \
295 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=ERROR
297 ; -dump-input=always => -dump-input-filter=all
298 ; RUN: %ProtectFileCheckOutput \
299 ; RUN: not FileCheck -dump-input-context=2 -vv %t.chk < %t.in 2>&1 \
300 ; RUN: -dump-input=always \
301 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=ALL
303 ;--------------------------------------------------
304 ; Check multiple -dump-input-filter options.
306 ; This might occur when a test author specifies -dump-input-filter on a specific
307 ; FileCheck call while a test runner specifies -dump-input-filter in
308 ; FILECHECK_OPTS, but check the behavior generally.
310 ; The value providing the most information wins.
311 ;--------------------------------------------------
313 ;- - - - - - - - - - - - - - - - - - - - - - - - -
315 ;- - - - - - - - - - - - - - - - - - - - - - - - -
318 ; RUN: %ProtectFileCheckOutput \
319 ; RUN: not FileCheck -dump-input-context=2 -vv %t.chk < %t.in 2>&1 \
320 ; RUN: -dump-input-filter=all -dump-input-filter=all \
321 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=ALL
323 ;- - - - - - - - - - - - - - - - - - - - - - - - -
325 ;- - - - - - - - - - - - - - - - - - - - - - - - -
327 ; all, annotation-full => all
328 ; RUN: %ProtectFileCheckOutput \
329 ; RUN: not FileCheck -dump-input-context=2 -vv %t.chk < %t.in 2>&1 \
330 ; RUN: -dump-input-filter=all -dump-input-filter=annotation-full \
331 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=ALL
333 ; annotation-full, annotation => annotation-full
334 ; RUN: %ProtectFileCheckOutput \
335 ; RUN: not FileCheck -dump-input-context=2 -vv %t.chk < %t.in 2>&1 \
336 ; RUN: -dump-input-filter=annotation-full \
337 ; RUN: -dump-input-filter=annotation \
338 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=ANNOTATION-FULL
340 ; annotation, error => annotation
341 ; RUN: %ProtectFileCheckOutput \
342 ; RUN: not FileCheck -dump-input-context=2 -vv %t.chk < %t.in 2>&1 \
343 ; RUN: -dump-input-filter=annotation -dump-input-filter=error \
344 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=ANNOTATION
346 ;- - - - - - - - - - - - - - - - - - - - - - - - -
347 ; Check that order doesn't matter.
348 ;- - - - - - - - - - - - - - - - - - - - - - - - -
350 ; error, annotation => annotation
351 ; RUN: %ProtectFileCheckOutput \
352 ; RUN: not FileCheck -dump-input-context=2 -vv %t.chk < %t.in 2>&1 \
353 ; RUN: -dump-input-filter=error -dump-input-filter=annotation \
354 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=ANNOTATION
356 ;- - - - - - - - - - - - - - - - - - - - - - - - -
357 ; Check that FILECHECK_OPTS isn't handled differently.
358 ;- - - - - - - - - - - - - - - - - - - - - - - - -
360 ; annotation, error => annotation
361 ; RUN: %ProtectFileCheckOutput FILECHECK_OPTS=-dump-input-filter=annotation \
362 ; RUN: not FileCheck -dump-input-context=2 -vv %t.chk < %t.in 2>&1 \
363 ; RUN: -dump-input-filter=error \
364 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=ANNOTATION
366 ; error, annotation => annotation
367 ; RUN: %ProtectFileCheckOutput FILECHECK_OPTS=-dump-input-filter=error \
368 ; RUN: not FileCheck -dump-input-context=2 -vv %t.chk < %t.in 2>&1 \
369 ; RUN: -dump-input-filter=annotation \
370 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=ANNOTATION
372 ;--------------------------------------------------
373 ; Check the case where all input lines are filtered out.
374 ;--------------------------------------------------
376 ; RUN: echo 'CHECK: hello' > %t.good.chk
378 ; RUN: %ProtectFileCheckOutput \
379 ; RUN: FileCheck -dump-input=always -dump-input-filter=error -vv %t.good.chk \
380 ; RUN: < %t.in 2>&1 \
381 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=EMPTY
389 ;--------------------------------------------------
390 ; Check that other kinds of errors are included by -dump-input-filter=error.
392 ; "error: no match found" and "possible intended match" are checked above.
393 ;--------------------------------------------------
395 ;- - - - - - - - - - - - - - - - - - - - - - - - -
396 ; error: no match expected.
397 ;- - - - - - - - - - - - - - - - - - - - - - - - -
399 ; RUN: echo 'foo' > %t.not-err.in
400 ; RUN: echo 'CHECK-NOT: foo' > %t.not-err.chk
402 ; RUN: %ProtectFileCheckOutput \
403 ; RUN: not FileCheck -dump-input-context=0 -dump-input-filter=error \
404 ; RUN: %t.not-err.chk < %t.not-err.in 2>&1 \
405 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOT-ERR
408 ; NOT-ERR-NEXT: not:1 !~~ error: no match expected
410 ;- - - - - - - - - - - - - - - - - - - - - - - - -
411 ; error: match on wrong line.
412 ;- - - - - - - - - - - - - - - - - - - - - - - - -
414 ; RUN: echo 'foo' > %t.next-err.in
415 ; RUN: echo 'foo' >> %t.next-err.in
416 ; RUN: echo 'bar' >> %t.next-err.in
417 ; RUN: echo 'CHECK: foo' > %t.next-err.chk
418 ; RUN: echo 'CHECK-NEXT: bar' >> %t.next-err.chk
420 ; RUN: %ProtectFileCheckOutput \
421 ; RUN: not FileCheck -dump-input-context=0 -dump-input-filter=error \
422 ; RUN: %t.next-err.chk < %t.next-err.in 2>&1 \
423 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=NEXT-ERR
426 ; NEXT-ERR-NEXT: next:2 !~~ error: match on wrong line