dump-input-annotations.txt
30.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
;--------------------------------------------------
; Use -strict-whitespace to check marker and note alignment here.
; (Also check multiline marker where start/end columns vary across lines.)
;
; In the remaining checks, don't use -strict-whitespace and thus check just the
; presence, order, and lengths of markers. That way, if we ever change padding
; within line labels, we don't have to adjust so many tests.
;--------------------------------------------------
; RUN: echo 'hello world' > %t.in
; RUN: echo 'goodbye' >> %t.in
; RUN: echo 'world' >> %t.in
; RUN: echo 'unicorn' >> %t.in
; 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
; Verbose diagnostics are suppressed but not errors.
; ALIGN:{{.*}}error:{{.*}}
; ALIGN:{{.*}}possible intended match here{{.*}}
; ALIGN:Input was:
; ALIGN-NEXT:<<<<<<
; ALIGN-NEXT: 1: hello world
; ALIGN-NEXT:check:1 ^~~~~
; ALIGN-NEXT:check:2'0 X~~~~ error: no match found
; ALIGN-NEXT: 2: goodbye
; ALIGN-NEXT:check:2'0 ~~~~~~~
; ALIGN-NEXT: 3: world
; ALIGN-NEXT:check:2'0 ~~~~~
; ALIGN-NEXT: 4: unicorn
; ALIGN-NEXT:check:2'0 ~~~~~~~
; ALIGN-NEXT:check:2'1 ? possible intended match
; ALIGN-NEXT:>>>>>>
; ALIGN-NOT:{{.}}
;--------------------------------------------------
; CHECK (also: multi-line search range, fuzzy match)
;--------------------------------------------------
; Good match and no match.
; RUN: echo 'hello' > %t.in
; RUN: echo 'again' >> %t.in
; RUN: echo 'whirled' >> %t.in
; 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:'
; Verbose diagnostics are suppressed but not errors.
; CHK: {{.*}}error:{{.*}}
; CHK: {{.*}}possible intended match here{{.*}}
; CHK: <<<<<<
; CHK-NEXT: 1: hello
; CHK-V-NEXT: check:1 ^~~~~
; CHK-NEXT: 2: again
; CHK-NEXT: check:2'0 X~~~~ error: no match found
; CHK-NEXT: 3: whirled
; CHK-NEXT: check:2'0 ~~~~~~~
; CHK-NEXT: check:2'1 ? possible intended match
; CHK-NEXT: >>>>>>
; CHK-NOT: {{.}}
;--------------------------------------------------
; CHECK-COUNT-<num>
;--------------------------------------------------
; Good match and no match.
; RUN: echo 'pete' > %t.in
; RUN: echo 'repete' >> %t.in
; RUN: echo 'repeat' >> %t.in
; 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:'
; Verbose diagnostics are suppressed but not errors.
; CNT: {{.*}}error:{{.*}}
; CNT: <<<<<<
; CNT-NEXT: 1: pete
; CNT-V-NEXT: count:1'0 ^~~~
; CNT-NEXT: 2: repete
; CNT-V-NEXT: count:1'1 ^~~~
; CNT-NEXT: 3: repeat
; CNT-Q-NEXT: count:1 X~~~~~ error: no match found
; CNT-V-NEXT: count:1'2 X~~~~~ error: no match found
; CNT-NEXT: >>>>>>
; CNT-NOT: {{.}}
;--------------------------------------------------
; CHECK-NEXT (also: EOF search-range, wrong-line match)
;--------------------------------------------------
; Good match and no match.
; RUN: echo 'hello' > %t.in
; RUN: echo 'again' >> %t.in
; RUN: echo 'CHECK: hello' > %t.chk
; 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:'
; Verbose diagnostics are suppressed but not errors.
; NXT: {{.*}}error:{{.*}}
; NXT: <<<<<<
; NXT-NEXT: 1: hello
; NXT-V-NEXT: check:1 ^~~~~
; NXT-NEXT: 2: again
; NXT-V-NEXT: next:2 ^~~~~
; NXT-NEXT: 3:
; NXT-NEXT: next:3 X error: no match found
; NXT-NEXT: >>>>>>
; NXT-NOT: {{.}}
; Wrong-line match.
; 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
; NXT2: <<<<<<
; NXT2-NEXT: 1: hello
; NXT2-NEXT: 2: again
; NXT2-NEXT: 3: yonder
; NXT2-NEXT: 4: world
; NXT2-NEXT: next:3 !~~~~ error: match on wrong line
; NXT2-NEXT: >>>>>>
; NXT2-NOT: {{.}}
;--------------------------------------------------
; CHECK-SAME (also: multiple annotations per line, single-char search range,
; wrong-line match)
;--------------------------------------------------
; Good match and no match.
; RUN: echo 'hello world!' > %t.in
; RUN: echo 'CHECK: hello' > %t.chk
; 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:'
; Verbose diagnostics are suppressed but not errors.
; SAM: {{.*}}error:{{.*}}
; SAM: <<<<<<
; SAM-NEXT: 1: hello world!
; SAM-V-NEXT: check:1 ^~~~~
; SAM-V-NEXT: same:2 ^~~~~
; SAM-NEXT: same:3 X error: no match found
; SAM-NEXT: >>>>>>
; SAM-NOT: {{.}}
; Wrong-line match.
; 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:'
; Verbose diagnostics are suppressed but not errors.
; SAM2: {{.*}}error:{{.*}}
; SAM2: <<<<<<
; SAM2-NEXT: 1: hello world!
; SAM2-NEXT: check:1 ^~~~~
; SAM2-NEXT: same:2 ^~~~~
; SAM2-NEXT: 2: again
; SAM2-NEXT: same:3 !~~~~ error: match on wrong line
; SAM2-NEXT: >>>>>>
; SAM2-NOT: {{.}}
;--------------------------------------------------
; CHECK-EMPTY (also: search range ends at label, single-char match, wrong-line
; match)
;--------------------------------------------------
; Good match and no match.
;
; CHECK-EMPTY always seems to match an empty line at EOF (illegally when it's
; not the next line) unless either (1) the last line is non-empty and has no
; newline or (2) there's a CHECK-LABEL to end the search range before EOF. We
; choose scenario 2 to check the case of no match.
; RUN: echo 'hello' > %t.in
; RUN: echo '' >> %t.in
; RUN: echo 'world' >> %t.in
; RUN: echo 'label' >> %t.in
; RUN: echo 'CHECK: hello' > %t.chk
; RUN: echo 'CHECK-EMPTY:' >> %t.chk
; 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:'
; Verbose diagnostics are suppressed but not errors.
; EMP: {{.*}}error:{{.*}}
; EMP: <<<<<<
; EMP-NEXT: 1: hello
; EMP-V-NEXT: check:1 ^~~~~
; EMP-NEXT: 2:
; EMP-V-NEXT: empty:2 ^
; EMP-NEXT: 3: world
; EMP-NEXT: empty:3 X~~~~ error: no match found
; EMP-NEXT: 4: label
; EMP-V-NEXT: label:4 ^~~~~
; EMP-NEXT: empty:3 ~~~~~
; EMP-NEXT: >>>>>>
; EMP-NOT: {{.}}
; Wrong-line match.
; RUN: echo 'hello' > %t.in
; RUN: echo 'world' >> %t.in
; 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:'
; Verbose diagnostics are suppressed but not errors.
; EMP2: {{.*}}error:{{.*}}
; EMP2: <<<<<<
; EMP2-NEXT: 1: hello
; EMP2-V-NEXT: check:1 ^~~~~
; EMP2-NEXT: 2: world
; EMP2-NEXT: 3:
; EMP2-NEXT: empty:2 ! error: match on wrong line
; EMP2-NEXT: >>>>>>
; EMP2-NOT: {{.}}
;--------------------------------------------------
; CHECK-NOT (also: EOF pattern, and multiline range that ends before EOL)
;--------------------------------------------------
; No match (success) and unexpected match (error).
; RUN: echo 'hello' > %t.in
; RUN: echo 'world' >> %t.in
; RUN: echo 'again' >> %t.in
; 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:'
; Verbose diagnostics are suppressed but not errors.
; NOT: {{.*}}error:{{.*}}
; NOT: <<<<<<
; NOT-NEXT: 1: hello
; NOT-VV-NEXT: not:1 X~~~~
; NOT-NEXT: 2: world
; NOT-VV-NEXT: not:1 ~~~~~
; NOT-NEXT: not:2 !~~~~ error: no match expected
; NOT-NEXT: 3: again
; NOT-VV-NEXT: not:1 ~~~~~
; NOT-VV-NEXT: 4:
; NOT-VV-NEXT: eof:2 ^
; NOT-NEXT: >>>>>>
; NOT-NOT: {{.}}
; Again, but with a CHECK instead of EOF as search range end.
; 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:'
; Verbose diagnostics are suppressed but not errors.
; NOT2: {{.*}}error:{{.*}}
; NOT2: <<<<<<
; NOT2-NEXT: 1: hello
; NOT2-VV-NEXT: not:1 X~~~~
; NOT2-NEXT: 2: world
; NOT2-VV-NEXT: not:1 ~~~~~
; NOT2-NEXT: not:2 !~~~~ error: no match expected
; NOT2-NEXT: 3: again
; NOT2-V-NEXT: check:3 ^~~
; NOT2-VV-NEXT: not:1 ~~
; NOT2-NEXT: >>>>>>
; NOT2-NOT: {{.}}
;--------------------------------------------------
; CHECK-DAG (also: matches in different order than directives, discarded match)
;--------------------------------------------------
; Good match, discarded match plus good match, and no match.
; RUN: echo 'abc' > %t.in
; RUN: echo 'def' >> %t.in
; RUN: echo 'abc' >> %t.in
; RUN: echo 'CHECK-DAG: def' > %t.chk
; RUN: echo 'CHECK-DAG: abc' >> %t.chk
; RUN: echo 'CHECK-DAG: abc' >> %t.chk
; RUN: echo 'CHECK-DAG: def' >> %t.chk
; Prefixes used here:
; DAG = quiet, -v, or -vv
; DAG-Q = quiet
; DAG-V = -v or -vv (-vv implies -v)
; 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:'
; Verbose diagnostics are suppressed but not errors.
; DAG: {{.*}}error:{{.*}}
; DAG: <<<<<<
; DAG-NEXT: 1: abc
; DAG-V-NEXT: dag:2 ^~~
; DAG-VV-NEXT: dag:3'0 !~~ discard: overlaps earlier match
; DAG-NEXT: 2: def
; DAG-V-NEXT: dag:1 ^~~
; DAG-VV-NEXT: dag:4'0 !~~ discard: overlaps earlier match
; DAG-NEXT: 3: abc
; DAG-VQ-NEXT: dag:3 ^~~
; DAG-VV-NEXT: dag:3'1 ^~~
; DAG-Q-NEXT: dag:4 X~~ error: no match found
; DAG-VQ-NEXT: dag:4 X~~ error: no match found
; DAG-VV-NEXT: dag:4'1 X~~ error: no match found
; DAG-NEXT: >>>>>>
; DAG-NOT: {{.}}
; Check sorting of annotations when the order of diagnostics across an input
; line is different than the order of the associated directives in the check
; file. Try cases when diagnostics' input ranges overlap but are not
; identical to check how that affects sorting.
; RUN: echo 'abc def abc def' > %t.in
; RUN: echo 'CHECK-DAG: def' > %t.chk
; RUN: echo 'CHECK-DAG: bc' >> %t.chk
; RUN: echo 'CHECK-DAG: abc' >> %t.chk
; RUN: echo 'CHECK-DAG: de' >> %t.chk
; RUN: echo 'CHECK-DAG: def' >> %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=DAG1L,DAG1L-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=DAG1L,DAG1L-V,DAG1L-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=DAG1L,DAG1L-V,DAG1L-VV \
; RUN: -implicit-check-not='remark:'
; Verbose diagnostics are suppressed but not errors.
; DAG1L:{{.*}}error:{{.*}}
; DAG1L:<<<<<<
; DAG1L-NEXT: 1: abc def abc def
; DAG1L-V-NEXT:dag:1 ^~~
; DAG1L-V-NEXT:dag:2 ^~
; DAG1L-VV-NEXT:dag:3'0 !~~ discard: overlaps earlier match
; DAG1L-VQ-NEXT:dag:3 ^~~
; DAG1L-VV-NEXT:dag:3'1 ^~~
; DAG1L-VV-NEXT:dag:4'0 !~ discard: overlaps earlier match
; DAG1L-VQ-NEXT:dag:4 ^~
; DAG1L-VV-NEXT:dag:4'1 ^~
; DAG1L-VV-NEXT:dag:5'0 !~~ discard: overlaps earlier match
; DAG1L-VV-NEXT:dag:5'1 !~~ discard: overlaps earlier match
; DAG1L-Q-NEXT:dag:5 X error: no match found
; DAG1L-VQ-NEXT:dag:5 X error: no match found
; DAG1L-VV-NEXT:dag:5'2 X error: no match found
; DAG1L-NEXT:>>>>>>
; DAG1L-NOT:{{.}}
;--------------------------------------------------
; CHECK-LABEL
;
; FIXME: Labels sometimes produce redundant diagnostics for good matches.
; That bug is independent of but affects -dump-input.
;--------------------------------------------------
; Good match and no match.
; RUN: echo 'lab0' > %t.in
; RUN: echo 'foo' >> %t.in
; RUN: echo 'lab1' >> %t.in
; RUN: echo 'bar' >> %t.in
; RUN: echo 'CHECK-LABEL: lab0' > %t.chk
; 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:'
; Verbose diagnostics are suppressed but not errors.
; LAB: {{.*}}error:{{.*}}
; LAB: {{.*}}possible intended match{{.*}}
; LAB: <<<<<<
; LAB-NEXT: 1: lab0
; LAB-V-NEXT: label:1'0 ^~~~
; LAB-V-NEXT: label:1'1 ^~~~
; LAB-NEXT: 2: foo
; LAB-NEXT: label:3'0 X~~ error: no match found
; LAB-NEXT: 3: lab1
; LAB-NEXT: label:3'0 ~~~~
; LAB-NEXT: label:3'1 ? possible intended match
; LAB-NEXT: 4: bar
; LAB-NEXT: label:3'0 ~~~
; LAB-NEXT: >>>>>>
; LAB-NOT: {{.}}
;--------------------------------------------------
; --implicit-check-not
;
; The first two --implicit-check-not patterns have no match (success). The
; third has an unexpected match (error). To check per-input-line annotation
; sorting, all of those plus the CHECK directives have annotations on the same
; input line.
;--------------------------------------------------
; RUN: echo 'hello world again!' > %t.in
; RUN: echo 'CHECK: hel' > %t.chk
; RUN: echo 'CHECK: wor' >> %t.chk
; RUN: echo 'CHECK: !' >> %t.chk
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file=%t.in %t.chk 2>&1 \
; RUN: --implicit-check-not='goodbye' \
; RUN: --implicit-check-not='world' \
; RUN: --implicit-check-not='again' \
; RUN: | FileCheck -match-full-lines %s -check-prefix=IMPNOT \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file=%t.in %t.chk -v 2>&1 \
; RUN: --implicit-check-not='goodbye' \
; RUN: --implicit-check-not='world' \
; RUN: --implicit-check-not='again' \
; RUN: | FileCheck -match-full-lines %s -check-prefixes=IMPNOT,IMPNOT-V \
; RUN: -implicit-check-not='remark:'
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -input-file=%t.in %t.chk -vv 2>&1 \
; RUN: --implicit-check-not='goodbye' \
; RUN: --implicit-check-not='world' \
; RUN: --implicit-check-not='again' \
; RUN: | FileCheck -match-full-lines %s \
; RUN: -check-prefixes=IMPNOT,IMPNOT-V,IMPNOT-VV \
; RUN: -implicit-check-not='remark:'
; Verbose diagnostics are suppressed but not errors.
; IMPNOT:{{.*}}error:{{.*}}
; IMPNOT:<<<<<<
; IMPNOT-NEXT: 1: hello world again!
; IMPNOT-V-NEXT:check:1 ^~~
; IMPNOT-VV-NEXT:not:imp1 X
; IMPNOT-VV-NEXT:not:imp2 X
; IMPNOT-VV-NEXT:not:imp3 X
; IMPNOT-V-NEXT:check:2 ^~~
; IMPNOT-VV-NEXT:not:imp1 X~~
; IMPNOT-VV-NEXT:not:imp2 X~~
; IMPNOT-VV-NEXT:not:imp3 X~~
; IMPNOT-V-NEXT:check:3 ^
; IMPNOT-VV-NEXT:not:imp1 X~~~~~~~
; IMPNOT-VV-NEXT:not:imp2 X~~~~~~~
; IMPNOT-NEXT:not:imp3 !~~~~ error: no match expected
; IMPNOT-NEXT:>>>>>>
; IMPNOT-NOT:{{.}}
;--------------------------------------------------
; Substitutions: successful and failed positive directives.
;--------------------------------------------------
; RUN: echo 'def-match1 def-match2' > %t.in
; RUN: echo 'def-match1 def-nomatch' >> %t.in
; RUN: echo 'CHECK: [[DEF_MATCH1]] [[DEF_MATCH2]]' > %t.chk
; RUN: echo 'CHECK: [[DEF_MATCH1]] [[UNDEF]] [[DEF_NOMATCH]]' >> %t.chk
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \
; RUN: -DDEF_MATCH1=def-match1 -DDEF_MATCH2=def-match2 \
; RUN: -DDEF_NOMATCH=foobar \
; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST-POS
; SUBST-POS:<<<<<<
; SUBST-POS-NEXT: 1: def-match1 def-match2
; SUBST-POS-NEXT:check:1'0 ^~~~~~~~~~~~~~~~~~~~~
; SUBST-POS-NEXT:check:1'1 with "DEF_MATCH1" equal to "def-match1"
; SUBST-POS-NEXT:check:1'2 with "DEF_MATCH2" equal to "def-match2"
; SUBST-POS-NEXT: 2: def-match1 def-nomatch
; SUBST-POS-NEXT:check:2'0 X~~~~~~~~~~~~~~~~~~~~~ error: no match found
; SUBST-POS-NEXT:check:2'1 with "DEF_MATCH1" equal to "def-match1"
; SUBST-POS-NEXT:check:2'2 uses undefined variable(s): "UNDEF"
; SUBST-POS-NEXT:check:2'3 with "DEF_NOMATCH" equal to "foobar"
; SUBST-POS-NEXT:check:2'4 ? possible intended match
; SUBST-POS-NEXT:>>>>>>
;--------------------------------------------------
; Substitutions: successful and failed negative directives.
;
; FIXME: The first CHECK-NOT directive below uses an undefined variable.
; Because it therefore cannot match regardless of the input, the directive
; succeeds. However, it should fail in this case. Update the example below
; once that's fixed.
;--------------------------------------------------
; RUN: echo 'def-match1 def-nomatch' > %t.in
; RUN: echo 'def-match1 def-match2' >> %t.in
; RUN: echo 'END' >> %t.in
; RUN: echo 'CHECK-NOT: [[DEF_MATCH1]] [[UNDEF]] [[DEF_NOMATCH]]' > %t.chk
; RUN: echo 'CHECK-NOT: [[DEF_MATCH1]] [[DEF_MATCH2]]' >> %t.chk
; RUN: echo 'CHECK: END' >> %t.chk
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \
; RUN: -DDEF_MATCH1=def-match1 -DDEF_MATCH2=def-match2 \
; RUN: -DDEF_NOMATCH=foobar \
; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST-NEG
; SUBST-NEG:<<<<<<
; SUBST-NEG-NEXT: 1: def-match1 def-nomatch
; SUBST-NEG-NEXT:not:1'0 X~~~~~~~~~~~~~~~~~~~~~
; SUBST-NEG-NEXT:not:1'1 with "DEF_MATCH1" equal to "def-match1"
; SUBST-NEG-NEXT:not:1'2 uses undefined variable(s): "UNDEF"
; SUBST-NEG-NEXT:not:1'3 with "DEF_NOMATCH" equal to "foobar"
; SUBST-NEG-NEXT: 2: def-match1 def-match2
; SUBST-NEG-NEXT:not:1'0 ~~~~~~~~~~~~~~~~~~~~~
; SUBST-NEG-NEXT:not:2'0 !~~~~~~~~~~~~~~~~~~~~ error: no match expected
; SUBST-NEG-NEXT:not:2'1 with "DEF_MATCH1" equal to "def-match1"
; SUBST-NEG-NEXT:not:2'2 with "DEF_MATCH2" equal to "def-match2"
; SUBST-NEG-NEXT: 3: END
; SUBST-NEG-NEXT:check:3 ^~~
; SUBST-NEG-NEXT:>>>>>>
;--------------------------------------------------
; Captured variables
;--------------------------------------------------
; RUN: echo 'strvar: foo' > %t.in
; RUN: echo 'numvar no expr: 51' >> %t.in
; RUN: echo 'numvar expr: -49' >> %t.in
; RUN: echo 'many: foo 100 8 bar' >> %t.in
; RUN: echo 'var in neg match: foo' >> %t.in
; RUN: echo 'END' >> %t.in
; RUN: echo 'CHECK: strvar: [[STRVAR:[a-z]+]]' > %t.chk
; RUN: echo 'CHECK: numvar no expr: [[#NUMVAR_NO_EXPR:]]' >> %t.chk
; RUN: echo 'CHECK: numvar expr: [[#%d,NUMVAR_EXPR:2-NUMVAR_NO_EXPR]]' >> %t.chk
; Capture many variables of different kinds in a different order than their
; names sort alphabetically to ensure they're sorted in capture order.
; RUN: echo 'CHECK: many: [[VAR1:foo]] [[#%d,VAR3:]] [[#VAR2:]] [[VAR4:bar]]' \
; RUN: >> %t.chk
; RUN: echo 'CHECK-NOT: var in neg match: [[VAR:foo]]' >> %t.chk
; RUN: echo 'CHECK: END' >> %t.chk
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \
; RUN: | FileCheck -strict-whitespace -match-full-lines %s -check-prefix=CAPTURE-NEG
; CAPTURE-NEG:<<<<<<
; CAPTURE-NEG-NEXT: 1: strvar: foo
; CAPTURE-NEG-NEXT:check:1'0 ^~~~~~~~~~~
; CAPTURE-NEG-NEXT:check:1'1 ^~~ captured var "STRVAR"
; CAPTURE-NEG-NEXT: 2: numvar no expr: 51
; CAPTURE-NEG-NEXT:check:2'0 ^~~~~~~~~~~~~~~~~~
; CAPTURE-NEG-NEXT:check:2'1 ^~ captured var "NUMVAR_NO_EXPR"
; CAPTURE-NEG-NEXT: 3: numvar expr: -49
; CAPTURE-NEG-NEXT:check:3'0 ^~~~~~~~~~~~~~~~
; CAPTURE-NEG-NEXT:check:3'1 with "%d,NUMVAR_EXPR:2-NUMVAR_NO_EXPR" equal to "-49"
; CAPTURE-NEG-NEXT:check:3'2 ^~~ captured var "NUMVAR_EXPR"
; CAPTURE-NEG-NEXT: 4: many: foo 100 8 bar
; CAPTURE-NEG-NEXT:check:4'0 ^~~~~~~~~~~~~~~~~~~
; CAPTURE-NEG-NEXT:check:4'1 ^~~ captured var "VAR1"
; CAPTURE-NEG-NEXT:check:4'2 ^~~ captured var "VAR3"
; CAPTURE-NEG-NEXT:check:4'3 ^ captured var "VAR2"
; CAPTURE-NEG-NEXT:check:4'4 ^~~ captured var "VAR4"
; CAPTURE-NEG-NEXT: 5: var in neg match: foo
; CAPTURE-NEG-NEXT:not:5'0 !~~~~~~~~~~~~~~~~~~~~ error: no match expected
; CAPTURE-NEG-NEXT:not:5'1 !~~ captured var "VAR"
; CAPTURE-NEG-NEXT: 6: END
; CAPTURE-NEG-NEXT:check:6 ^~~
; CAPTURE-NEG-NEXT:>>>>>>
;--------------------------------------------------
; CHECK-NEXT, CHECK-SAME, CHECK-DAG note fixups.
;
; When CHECK-NEXT or CHECK-SAME fails for the wrong line, or when a CHECK-DAG
; match is discarded, the associated diagnostic type must be converted from
; successful to failed or discarded. However, any note annotation must be
; traversed to find that diagnostic. We check this behavior here only for
; substitutions, but it's the same mechanism for all note annotations.
;--------------------------------------------------
;- - - - - - - - - - - - - - - - - - - - - - - - -
; CHECK-NEXT.
;- - - - - - - - - - - - - - - - - - - - - - - - -
; RUN: echo 'pre var' > %t.in
; RUN: echo 'CHECK: pre' > %t.chk
; RUN: echo 'CHECK-NEXT: [[VAR]]' >> %t.chk
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \
; RUN: -DVAR=var \
; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST_NEXT
; SUBST_NEXT:<<<<<<
; SUBST_NEXT-NEXT: 1: pre var
; SUBST_NEXT-NEXT:check:1 ^~~
; SUBST_NEXT-NEXT:next:2'0 !~~ error: match on wrong line
; SUBST_NEXT-NEXT:next:2'1 with "VAR" equal to "var"
; SUBST_NEXT-NEXT:>>>>>>
;- - - - - - - - - - - - - - - - - - - - - - - - -
; CHECK-SAME.
;- - - - - - - - - - - - - - - - - - - - - - - - -
; RUN: echo 'pre' > %t.in
; RUN: echo 'var' >> %t.in
; RUN: echo 'CHECK: pre' > %t.chk
; RUN: echo 'CHECK-SAME: [[VAR]]' >> %t.chk
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \
; RUN: -DVAR=var \
; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST_SAME
; SUBST_SAME:<<<<<<
; SUBST_SAME-NEXT: 1: pre
; SUBST_SAME-NEXT:check:1 ^~~
; SUBST_SAME-NEXT: 2: var
; SUBST_SAME-NEXT:same:2'0 !~~ error: match on wrong line
; SUBST_SAME-NEXT:same:2'1 with "VAR" equal to "var"
; SUBST_SAME-NEXT:>>>>>>
;- - - - - - - - - - - - - - - - - - - - - - - - -
; CHECK-DAG.
;- - - - - - - - - - - - - - - - - - - - - - - - -
; RUN: echo 'var' > %t.in
; RUN: echo 'var' >> %t.in
; RUN: echo 'END' >> %t.in
; RUN: echo 'CHECK-DAG: var' > %t.chk
; RUN: echo 'CHECK-DAG: [[VAR]]' >> %t.chk
; RUN: echo 'CHECK: END' >> %t.chk
; RUN: %ProtectFileCheckOutput \
; RUN: FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \
; RUN: -DVAR=var \
; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST_DAG
; SUBST_DAG:<<<<<<
; SUBST_DAG-NEXT: 1: var
; SUBST_DAG-NEXT:dag:1 ^~~
; SUBST_DAG-NEXT:dag:2'0 !~~ discard: overlaps earlier match
; SUBST_DAG-NEXT:dag:2'1 with "VAR" equal to "var"
; SUBST_DAG-NEXT: 2: var
; SUBST_DAG-NEXT:dag:2'2 ^~~
; SUBST_DAG-NEXT:dag:2'3 with "VAR" equal to "var"
; SUBST_DAG-NEXT: 3: END
; SUBST_DAG-NEXT:check:3 ^~~
; SUBST_DAG-NEXT:>>>>>>