1 ;--------------------------------------------------
2 ; Use -strict-whitespace to check marker and note alignment here.
3 ; (Also check multiline marker where start/end columns vary across lines.)
5 ; In the remaining checks, don't use -strict-whitespace and thus check just the
6 ; presence, order, and lengths of markers. That way, if we ever change padding
7 ; within line labels, we don't have to adjust so many tests.
8 ;--------------------------------------------------
10 ; RUN: echo 'hello world' > %t.in
11 ; RUN: echo 'goodbye' >> %t.in
12 ; RUN: echo 'world' >> %t.in
13 ; RUN: echo 'unicorn' >> %t.in
15 ; RUN: echo 'CHECK: hello' > %t.chk
16 ; RUN: echo 'CHECK: universe' >> %t.chk
18 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
19 ; RUN: | FileCheck -strict-whitespace -match-full-lines -check-prefix=ALIGN \
20 ; RUN: -implicit-check-not='remark:' %s
22 ; Verbose diagnostics are suppressed but not errors.
23 ; ALIGN:{{.*}}error:{{.*}}
24 ; ALIGN:{{.*}}possible intended match here{{.*}}
26 ; ALIGN:Full input was:
28 ; ALIGN-NEXT: 1: hello world
29 ; ALIGN-NEXT:check:1 ^~~~~
30 ; ALIGN-NEXT:check:2'0 X~~~~
31 ; ALIGN-NEXT: 2: goodbye
32 ; ALIGN-NEXT:check:2'0 ~~~~~~~
33 ; ALIGN-NEXT: 3: world
34 ; ALIGN-NEXT:check:2'0 ~~~~~
35 ; ALIGN-NEXT: 4: unicorn
36 ; ALIGN-NEXT:check:2'0 ~~~~~~~ error: no match found
37 ; ALIGN-NEXT:check:2'1 ? possible intended match
41 ;--------------------------------------------------
42 ; CHECK (also: multi-line search range, fuzzy match)
43 ;--------------------------------------------------
45 ; Good match and no match.
47 ; RUN: echo 'hello' > %t.in
48 ; RUN: echo 'again' >> %t.in
49 ; RUN: echo 'whirled' >> %t.in
51 ; RUN: echo 'CHECK: hello' > %t.chk
52 ; RUN: echo 'CHECK: world' >> %t.chk
54 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
55 ; RUN: | FileCheck -match-full-lines %s -check-prefix=CHK \
56 ; RUN: -implicit-check-not='remark:'
57 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
58 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=CHK,CHK-V \
59 ; RUN: -implicit-check-not='remark:'
60 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
61 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=CHK,CHK-V \
62 ; RUN: -implicit-check-not='remark:'
64 ; Verbose diagnostics are suppressed but not errors.
65 ; CHK: {{.*}}error:{{.*}}
66 ; CHK: {{.*}}possible intended match here{{.*}}
70 ; CHK-V-NEXT: check:1 ^~~~~
72 ; CHK-NEXT: check:2'0 X~~~~
73 ; CHK-NEXT: 3: whirled
74 ; CHK-NEXT: check:2'0 ~~~~~~~ error: no match found
75 ; CHK-NEXT: check:2'1 ? possible intended match
79 ;--------------------------------------------------
81 ;--------------------------------------------------
83 ; Good match and no match.
85 ; RUN: echo 'pete' > %t.in
86 ; RUN: echo 'repete' >> %t.in
87 ; RUN: echo 'repeat' >> %t.in
89 ; RUN: echo 'CHECK-COUNT-3: pete' > %t.chk
91 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
92 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=CNT,CNT-Q \
93 ; RUN: -implicit-check-not='remark:'
94 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
95 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=CNT,CNT-V \
96 ; RUN: -implicit-check-not='remark:'
97 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
98 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=CNT,CNT-V \
99 ; RUN: -implicit-check-not='remark:'
101 ; Verbose diagnostics are suppressed but not errors.
102 ; CNT: {{.*}}error:{{.*}}
106 ; CNT-V-NEXT: count:1'0 ^~~~
107 ; CNT-NEXT: 2: repete
108 ; CNT-V-NEXT: count:1'1 ^~~~
109 ; CNT-NEXT: 3: repeat
110 ; CNT-Q-NEXT: count:1 X~~~~~ error: no match found
111 ; CNT-V-NEXT: count:1'2 X~~~~~ error: no match found
115 ;--------------------------------------------------
116 ; CHECK-NEXT (also: EOF search-range, wrong-line match)
117 ;--------------------------------------------------
119 ; Good match and no match.
121 ; RUN: echo 'hello' > %t.in
122 ; RUN: echo 'again' >> %t.in
124 ; RUN: echo 'CHECK: hello' > %t.chk
125 ; RUN: echo 'CHECK-NEXT: again' >> %t.chk
126 ; RUN: echo 'CHECK-NEXT: world' >> %t.chk
128 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
129 ; RUN: | FileCheck -match-full-lines %s -check-prefix=NXT \
130 ; RUN: -implicit-check-not='remark:'
131 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
132 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=NXT,NXT-V \
133 ; RUN: -implicit-check-not='remark:'
134 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
135 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=NXT,NXT-V,NXT-VV \
136 ; RUN: -implicit-check-not='remark:'
138 ; Verbose diagnostics are suppressed but not errors.
139 ; NXT: {{.*}}error:{{.*}}
143 ; NXT-V-NEXT: check:1 ^~~~~
145 ; NXT-V-NEXT: next:2 ^~~~~
147 ; NXT-NEXT: next:3 X error: no match found
153 ; RUN: echo 'yonder' >> %t.in
154 ; RUN: echo 'world' >> %t.in
156 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
157 ; RUN: | FileCheck -match-full-lines %s -check-prefix=NXT2
160 ; NXT2-NEXT: 1: hello
161 ; NXT2-NEXT: 2: again
162 ; NXT2-NEXT: 3: yonder
163 ; NXT2-NEXT: 4: world
164 ; NXT2-NEXT: next:3 !~~~~ error: match on wrong line
168 ;--------------------------------------------------
169 ; CHECK-SAME (also: multiple annotations per line, single-char search range,
171 ;--------------------------------------------------
173 ; Good match and no match.
175 ; RUN: echo 'hello world!' > %t.in
177 ; RUN: echo 'CHECK: hello' > %t.chk
178 ; RUN: echo 'CHECK-SAME: world' >> %t.chk
179 ; RUN: echo 'CHECK-SAME: again' >> %t.chk
181 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
182 ; RUN: | FileCheck -match-full-lines %s -check-prefix=SAM \
183 ; RUN: -implicit-check-not='remark:'
184 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
185 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=SAM,SAM-V \
186 ; RUN: -implicit-check-not='remark:'
187 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
188 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=SAM,SAM-V,SAM-VV \
189 ; RUN: -implicit-check-not='remark:'
191 ; Verbose diagnostics are suppressed but not errors.
192 ; SAM: {{.*}}error:{{.*}}
195 ; SAM-NEXT: 1: hello world!
196 ; SAM-V-NEXT: check:1 ^~~~~
197 ; SAM-V-NEXT: same:2 ^~~~~
198 ; SAM-NEXT: same:3 X error: no match found
204 ; RUN: echo 'again' >> %t.in
206 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
207 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=SAM2 \
208 ; RUN: -implicit-check-not='remark:'
210 ; Verbose diagnostics are suppressed but not errors.
211 ; SAM2: {{.*}}error:{{.*}}
214 ; SAM2-NEXT: 1: hello world!
215 ; SAM2-NEXT: check:1 ^~~~~
216 ; SAM2-NEXT: same:2 ^~~~~
217 ; SAM2-NEXT: 2: again
218 ; SAM2-NEXT: same:3 !~~~~ error: match on wrong line
222 ;--------------------------------------------------
223 ; CHECK-EMPTY (also: search range ends at label, single-char match, wrong-line
225 ;--------------------------------------------------
227 ; Good match and no match.
229 ; CHECK-EMPTY always seems to match an empty line at EOF (illegally when it's
230 ; not the next line) unless either (1) the last line is non-empty and has no
231 ; newline or (2) there's a CHECK-LABEL to end the search range before EOF. We
232 ; choose scenario 2 to check the case of no match.
234 ; RUN: echo 'hello' > %t.in
235 ; RUN: echo '' >> %t.in
236 ; RUN: echo 'world' >> %t.in
237 ; RUN: echo 'label' >> %t.in
239 ; RUN: echo 'CHECK: hello' > %t.chk
240 ; RUN: echo 'CHECK-EMPTY:' >> %t.chk
241 ; RUN: echo 'CHECK-EMPTY:' >> %t.chk
242 ; RUN: echo 'CHECK-LABEL: label' >> %t.chk
244 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
245 ; RUN: | FileCheck -match-full-lines %s -check-prefix=EMP \
246 ; RUN: -implicit-check-not='remark:'
247 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
248 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=EMP,EMP-V \
249 ; RUN: -implicit-check-not='remark:'
250 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
251 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=EMP,EMP-V,EMP-VV \
252 ; RUN: -implicit-check-not='remark:'
254 ; Verbose diagnostics are suppressed but not errors.
255 ; EMP: {{.*}}error:{{.*}}
259 ; EMP-V-NEXT: check:1 ^~~~~
261 ; EMP-V-NEXT: empty:2 ^
263 ; EMP-NEXT: empty:3 X~~~~
265 ; EMP-NEXT: empty:3 ~~~~~ error: no match found
266 ; EMP-V-NEXT: label:4 ^~~~~
272 ; RUN: echo 'hello' > %t.in
273 ; RUN: echo 'world' >> %t.in
275 ; RUN: echo 'CHECK: hello' > %t.chk
276 ; RUN: echo 'CHECK-EMPTY:' >> %t.chk
278 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
279 ; RUN: | FileCheck -match-full-lines %s -check-prefix=EMP2 \
280 ; RUN: -implicit-check-not='remark:'
281 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
282 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=EMP2,EMP2-V \
283 ; RUN: -implicit-check-not='remark:'
284 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
285 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=EMP2,EMP2-V,EMP2-VV \
286 ; RUN: -implicit-check-not='remark:'
288 ; Verbose diagnostics are suppressed but not errors.
289 ; EMP2: {{.*}}error:{{.*}}
292 ; EMP2-NEXT: 1: hello
293 ; EMP2-V-NEXT: check:1 ^~~~~
294 ; EMP2-NEXT: 2: world
296 ; EMP2-NEXT: empty:2 ! error: match on wrong line
300 ;--------------------------------------------------
301 ; CHECK-NOT (also: EOF pattern, and multiline range that ends before EOL)
302 ;--------------------------------------------------
304 ; No match (success) and unexpected match (error).
306 ; RUN: echo 'hello' > %t.in
307 ; RUN: echo 'world' >> %t.in
308 ; RUN: echo 'again' >> %t.in
310 ; RUN: echo 'CHECK-NOT: goodbye' > %t.chk
311 ; RUN: echo 'CHECK-NOT: world' >> %t.chk
313 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
314 ; RUN: | FileCheck -match-full-lines %s -check-prefix=NOT \
315 ; RUN: -implicit-check-not='remark:'
316 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
317 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=NOT,NOT-V \
318 ; RUN: -implicit-check-not='remark:'
319 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
320 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=NOT,NOT-V,NOT-VV \
321 ; RUN: -implicit-check-not='remark:'
323 ; Verbose diagnostics are suppressed but not errors.
324 ; NOT: {{.*}}error:{{.*}}
328 ; NOT-VV-NEXT: not:1 X~~~~
330 ; NOT-VV-NEXT: not:1 ~~~~~
331 ; NOT-NEXT: not:2 !~~~~ error: no match expected
333 ; NOT-VV-NEXT: not:1 ~~~~~
335 ; NOT-VV-NEXT: eof:2 ^
339 ; Again, but with a CHECK instead of EOF as search range end.
341 ; RUN: echo 'CHECK: ain' >> %t.chk
343 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
344 ; RUN: | FileCheck -match-full-lines %s -check-prefix=NOT2 \
345 ; RUN: -implicit-check-not='remark:'
346 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
347 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=NOT2,NOT2-V \
348 ; RUN: -implicit-check-not='remark:'
349 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
350 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=NOT2,NOT2-V,NOT2-VV \
351 ; RUN: -implicit-check-not='remark:'
353 ; Verbose diagnostics are suppressed but not errors.
354 ; NOT2: {{.*}}error:{{.*}}
357 ; NOT2-NEXT: 1: hello
358 ; NOT2-VV-NEXT: not:1 X~~~~
359 ; NOT2-NEXT: 2: world
360 ; NOT2-VV-NEXT: not:1 ~~~~~
361 ; NOT2-NEXT: not:2 !~~~~ error: no match expected
362 ; NOT2-NEXT: 3: again
363 ; NOT2-VV-NEXT: not:1 ~~
364 ; NOT2-V-NEXT: check:3 ^~~
368 ;--------------------------------------------------
369 ; CHECK-DAG (also: matches in different order than directives, discarded match)
370 ;--------------------------------------------------
372 ; Good match, discarded match plus good match, and no match.
374 ; RUN: echo 'abc' > %t.in
375 ; RUN: echo 'def' >> %t.in
376 ; RUN: echo 'abc' >> %t.in
378 ; RUN: echo 'CHECK-DAG: def' > %t.chk
379 ; RUN: echo 'CHECK-DAG: abc' >> %t.chk
380 ; RUN: echo 'CHECK-DAG: abc' >> %t.chk
381 ; RUN: echo 'CHECK-DAG: def' >> %t.chk
383 ; Prefixes used here:
384 ; DAG = quiet, -v, or -vv
386 ; DAG-V = -v or -vv (-vv implies -v)
387 ; DAG-VQ = -v and not -vv
390 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
391 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG,DAG-Q \
392 ; RUN: -implicit-check-not='remark:'
393 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
394 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG,DAG-V,DAG-VQ \
395 ; RUN: -implicit-check-not='remark:'
396 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
397 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG,DAG-V,DAG-VV \
398 ; RUN: -implicit-check-not='remark:'
400 ; Verbose diagnostics are suppressed but not errors.
401 ; DAG: {{.*}}error:{{.*}}
405 ; DAG-V-NEXT: dag:2 ^~~
406 ; DAG-VV-NEXT: dag:3'0 !~~ discard: overlaps earlier match
408 ; DAG-V-NEXT: dag:1 ^~~
409 ; DAG-VV-NEXT: dag:4'0 !~~ discard: overlaps earlier match
411 ; DAG-VQ-NEXT: dag:3 ^~~
412 ; DAG-VV-NEXT: dag:3'1 ^~~
413 ; DAG-Q-NEXT: dag:4 X~~ error: no match found
414 ; DAG-VQ-NEXT: dag:4 X~~ error: no match found
415 ; DAG-VV-NEXT: dag:4'1 X~~ error: no match found
419 ;--------------------------------------------------
422 ; FIXME: Labels sometimes produce redundant diagnostics for good matches.
423 ; That bug is independent of but affects -dump-input.
424 ;--------------------------------------------------
426 ; Good match and no match.
428 ; RUN: echo 'lab0' > %t.in
429 ; RUN: echo 'foo' >> %t.in
430 ; RUN: echo 'lab1' >> %t.in
431 ; RUN: echo 'bar' >> %t.in
433 ; RUN: echo 'CHECK-LABEL: lab0' > %t.chk
434 ; RUN: echo 'CHECK: foo' >> %t.chk
435 ; RUN: echo 'CHECK-LABEL: lab2' >> %t.chk
437 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \
438 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=LAB \
439 ; RUN: -implicit-check-not='remark:'
440 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \
441 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=LAB,LAB-V \
442 ; RUN: -implicit-check-not='remark:'
443 ; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \
444 ; RUN: | FileCheck -match-full-lines %s -check-prefixes=LAB,LAB-V,LAB-VV \
445 ; RUN: -implicit-check-not='remark:'
447 ; Verbose diagnostics are suppressed but not errors.
448 ; LAB: {{.*}}error:{{.*}}
449 ; LAB: {{.*}}possible intended match{{.*}}
453 ; LAB-V-NEXT: label:1'0 ^~~~
454 ; LAB-V-NEXT: label:1'1 ^~~~
456 ; LAB-NEXT: label:3'0 X~~
458 ; LAB-NEXT: label:3'0 ~~~~
459 ; LAB-NEXT: label:3'1 ? possible intended match
461 ; LAB-NEXT: label:3'0 ~~~ error: no match found