File: matched-excluded-pattern.txt

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (88 lines) | stat: -rw-r--r-- 3,716 bytes parent folder | download | duplicates (11)
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
; Check handling of diagnostics for problematic matches (e.g., variable capture
; overflow) in the case of excluded patterns (e.g., CHECK-NOT).
;
; At one time, FileCheck's exit status for the following example was zero even
; though the excluded pattern does match (it's just capturing that fails).
; Moreover, it printed the error diagnostic only if -vv was specified and input
; dumps were disabled.  Test every combination as the logic is hard to get
; right. 
;
; TODO: Capturing from an excluded pattern probably shouldn't be permitted
; because it seems useless: it's captured only if the pattern matches, but then
; FileCheck fails.  The helpfulness of reporting overflow from that capture is
; perhaps questionable then, but it doesn't seem harmful either.  Anyway, the
; goal of this test is simply to exercise the error propagation mechanism for a
; matched excluded pattern.  In the future, if we have a more interesting error
; to exercise in that case, we should instead use it in this test, and then we
; might want to think more about where that error should be presented in the
; list of diagnostics.

RUN: echo > %t.chk 'CHECK-NOT: [[#122+1]] [[STR:abc]] [[#NUM:]]'
RUN: echo > %t.in '123 abc 1000000000000000000000000000000000000000000000000000'

     ERR-NOT:{{.}}
      ERR-VV:{{.*}}: remark: implicit EOF: expected string found in input
 ERR-VV-NEXT:CHECK-NOT: {{.*}}
 ERR-VV-NEXT:{{ *}}^
 ERR-VV-NEXT:{{.*}}: note: found here
ERR-VV-EMPTY:
 ERR-VV-NEXT:^
     ERR-NOT:{{.}}
         ERR:{{.*}}: error: CHECK-NOT: excluded string found in input
    ERR-NEXT:CHECK-NOT: {{.*}}
    ERR-NEXT:{{ *}}^
    ERR-NEXT:<stdin>:1:1: note: found here
    ERR-NEXT:123 abc 10{{0*}}
    ERR-NEXT:^~~~~~~~~{{~*}}
    ERR-NEXT:<stdin>:1:1: note: with "122+1" equal to "123"
    ERR-NEXT:123 abc 10{{0*}}
    ERR-NEXT:^
    ERR-NEXT:<stdin>:1:5: note: captured var "STR"
    ERR-NEXT:123 abc 10{{0*}}
    ERR-NEXT:    ^~~
    ERR-NEXT:<stdin>:1:9: error: unable to represent numeric value
    ERR-NEXT:123 abc 10{{0*}}
    ERR-NEXT:        ^
     ERR-NOT:{{error|note|remark}}:

        DUMP:<<<<<<
   DUMP-NEXT:         1: 123 abc 10{{0*}} 
   DUMP-NEXT:not:1'0     !~~~~~~~~~{{~*}}  error: no match expected
   DUMP-NEXT:not:1'1                       with "122+1" equal to "123"
   DUMP-NEXT:not:1'2         !~~           captured var "STR"
   DUMP-NEXT:not:1'3             !~{{~*}}  error: unable to represent numeric value
DUMP-VV-NEXT:         2: 
DUMP-VV-NEXT:eof:1       ^
   DUMP-NEXT:>>>>>>

;--------------------------------------------------
; Check -dump-input=never cases.
;--------------------------------------------------

RUN: %ProtectFileCheckOutput \
RUN: not FileCheck -dump-input=never %t.chk < %t.in 2>&1 \
RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR

RUN: %ProtectFileCheckOutput \
RUN: not FileCheck -dump-input=never -v %t.chk < %t.in 2>&1 \
RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR

RUN: %ProtectFileCheckOutput \
RUN: not FileCheck -dump-input=never -vv %t.chk < %t.in 2>&1 \
RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR,ERR-VV

;--------------------------------------------------
; Check -dump-input=fail cases.
;--------------------------------------------------

RUN: %ProtectFileCheckOutput \
RUN: not FileCheck -dump-input=fail %t.chk < %t.in 2>&1 \
RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR,DUMP

RUN: %ProtectFileCheckOutput \
RUN: not FileCheck -dump-input=fail -v %t.chk < %t.in 2>&1 \
RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR,DUMP

RUN: %ProtectFileCheckOutput \
RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR,DUMP,DUMP-VV