1 ; Check handling of diagnostics for problematic matches (e.g., variable capture
2 ; overflow) in the case of excluded patterns (e.g., CHECK-NOT).
4 ; At one time, FileCheck's exit status for the following example was zero even
5 ; though the excluded pattern does match (it's just capturing that fails).
6 ; Moreover, it printed the error diagnostic only if -vv was specified and input
7 ; dumps were disabled. Test every combination as the logic is hard to get
10 ; TODO: Capturing from an excluded pattern probably shouldn't be permitted
11 ; because it seems useless: it's captured only if the pattern matches, but then
12 ; FileCheck fails. The helpfulness of reporting overflow from that capture is
13 ; perhaps questionable then, but it doesn't seem harmful either. Anyway, the
14 ; goal of this test is simply to exercise the error propagation mechanism for a
15 ; matched excluded pattern. In the future, if we have a more interesting error
16 ; to exercise in that case, we should instead use it in this test, and then we
17 ; might want to think more about where that error should be presented in the
18 ; list of diagnostics.
20 RUN: echo > %t.chk 'CHECK-NOT: [[#122+1]] [[STR:abc]] [[#NUM:]]'
21 RUN: echo > %t.in '123 abc 1000000000000000000000000000000000000000000000000000'
24 ERR-VV:{{.*}}: remark: implicit EOF: expected string found in input
25 ERR-VV-NEXT:CHECK-NOT: {{.*}}
27 ERR-VV-NEXT:{{.*}}: note: found here
31 ERR:{{.*}}: error: CHECK-NOT: excluded string found in input
32 ERR-NEXT:CHECK-NOT: {{.*}}
34 ERR-NEXT:<stdin>:1:1: note: found here
35 ERR-NEXT:123 abc 10{{0*}}
36 ERR-NEXT:^~~~~~~~~{{~*}}
37 ERR-NEXT:<stdin>:1:1: note: with "122+1" equal to "123"
38 ERR-NEXT:123 abc 10{{0*}}
40 ERR-NEXT:<stdin>:1:5: note: captured var "STR"
41 ERR-NEXT:123 abc 10{{0*}}
43 ERR-NEXT:<stdin>:1:9: error: unable to represent numeric value
44 ERR-NEXT:123 abc 10{{0*}}
46 ERR-NOT:{{error|note|remark}}:
49 DUMP-NEXT: 1: 123 abc 10{{0*}}
50 DUMP-NEXT:not:1'0 !~~~~~~~~~{{~*}} error: no match expected
51 DUMP-NEXT:not:1'1 with "122+1" equal to "123"
52 DUMP-NEXT:not:1'2 !~~ captured var "STR"
53 DUMP-NEXT:not:1'3 !~{{~*}} error: unable to represent numeric value
58 ;--------------------------------------------------
59 ; Check -dump-input=never cases.
60 ;--------------------------------------------------
62 RUN: %ProtectFileCheckOutput \
63 RUN: not FileCheck -dump-input=never %t.chk < %t.in 2>&1 \
64 RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR
66 RUN: %ProtectFileCheckOutput \
67 RUN: not FileCheck -dump-input=never -v %t.chk < %t.in 2>&1 \
68 RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR
70 RUN: %ProtectFileCheckOutput \
71 RUN: not FileCheck -dump-input=never -vv %t.chk < %t.in 2>&1 \
72 RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR,ERR-VV
74 ;--------------------------------------------------
75 ; Check -dump-input=fail cases.
76 ;--------------------------------------------------
78 RUN: %ProtectFileCheckOutput \
79 RUN: not FileCheck -dump-input=fail %t.chk < %t.in 2>&1 \
80 RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR,DUMP
82 RUN: %ProtectFileCheckOutput \
83 RUN: not FileCheck -dump-input=fail -v %t.chk < %t.in 2>&1 \
84 RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR,DUMP
86 RUN: %ProtectFileCheckOutput \
87 RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
88 RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR,DUMP,DUMP-VV