1 ;--------------------------------------------------
2 ; Create the check file, good input, and bad input.
4 ; For both good and bad input, make sure the -v trace has at least one remark
5 ; so we can check how trace suppression is affected by -dump-input.
6 ;--------------------------------------------------
8 ; RUN: echo hello > %t.good
9 ; RUN: echo world >> %t.good
11 ; RUN: echo hello > %t.err
12 ; RUN: echo whirled >> %t.err
14 ; RUN: echo 'CHECK: hello' > %t.check
15 ; RUN: echo 'CHECK-NEXT: world' >> %t.check
17 ;--------------------------------------------------
18 ; Check -dump-input=<bad value>.
19 ;--------------------------------------------------
21 ; RUN: %ProtectFileCheckOutput \
22 ; RUN: not FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
23 ; RUN: -match-full-lines -dump-input=foobar 2>&1 \
24 ; RUN: | FileCheck %s -match-full-lines -check-prefix=BADVAL
27 ; RUN: %ProtectFileCheckOutput not FileCheck -dump-input=foobar 2>&1 \
28 ; RUN: | FileCheck %s -match-full-lines -check-prefix=BADVAL
30 BADVAL: {{F|f}}ile{{C|c}}heck{{.*}}: for the --dump-input option: Cannot find option named 'foobar'!
32 ;--------------------------------------------------
33 ; Check -dump-input=help.
34 ;--------------------------------------------------
36 ; Appended to normal command line.
37 ; RUN: %ProtectFileCheckOutput \
38 ; RUN: FileCheck -input-file %t.err -color %t.check -dump-input=help \
39 ; RUN: | FileCheck %s -check-prefix=HELP
42 ; RUN: %ProtectFileCheckOutput FileCheck -dump-input=help \
43 ; RUN: | FileCheck %s -check-prefix=HELP
45 ;--------------------------------------------------
46 ; Check -dump-input=never.
48 ; Include the case without -v, which isn't covered elsewhere.
49 ;--------------------------------------------------
51 ; FileCheck success, no -v => no dump, no trace.
52 ; RUN: %ProtectFileCheckOutput \
53 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
54 ; RUN: -match-full-lines -dump-input=never 2>&1 \
55 ; RUN: | FileCheck %s -match-full-lines -allow-empty \
56 ; RUN: -check-prefixes=NOTRACE,NODUMP
58 ; FileCheck fail, no -v => no dump, no trace.
59 ; RUN: %ProtectFileCheckOutput \
60 ; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
61 ; RUN: -match-full-lines -dump-input=never 2>&1 \
62 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,ERR,NODUMP
64 ; FileCheck success, -v => no dump, trace.
65 ; RUN: %ProtectFileCheckOutput \
66 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
67 ; RUN: -match-full-lines -dump-input=never -v 2>&1 \
68 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=TRACE,NODUMP
70 ; FileCheck fail, -v => no dump, trace.
71 ; RUN: %ProtectFileCheckOutput \
72 ; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
73 ; RUN: -match-full-lines -dump-input=never -v 2>&1 \
74 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=TRACE,ERR,NODUMP
76 ;--------------------------------------------------
77 ; Check no -dump-input, which defaults to fail.
78 ;--------------------------------------------------
80 ; FileCheck success, -v => no dump, no trace.
81 ; RUN: %ProtectFileCheckOutput \
82 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
83 ; RUN: -match-full-lines -v 2>&1 \
84 ; RUN: | FileCheck %s -match-full-lines -allow-empty \
85 ; RUN: -check-prefixes=NOTRACE,NODUMP
87 ; FileCheck fail, -v => dump, no trace.
88 ; RUN: %ProtectFileCheckOutput \
89 ; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
90 ; RUN: -match-full-lines -v 2>&1 \
91 ; RUN: | FileCheck %s -match-full-lines \
92 ; RUN: -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
94 ;--------------------------------------------------
95 ; Check -dump-input=fail.
97 ; Include the case without -v, which isn't covered elsewhere.
98 ;--------------------------------------------------
100 ; FileCheck success, no -v => no dump, no trace.
101 ; RUN: %ProtectFileCheckOutput \
102 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
103 ; RUN: -match-full-lines -dump-input=fail 2>&1 \
104 ; RUN: | FileCheck %s -match-full-lines -allow-empty \
105 ; RUN: -check-prefixes=NOTRACE,NODUMP
107 ; FileCheck fail, no -v => dump, no trace.
108 ; RUN: %ProtectFileCheckOutput \
109 ; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
110 ; RUN: -match-full-lines -dump-input=fail 2>&1 \
111 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,ERR,DUMP-ERR
113 ; FileCheck success, -v => no dump, no trace.
114 ; RUN: %ProtectFileCheckOutput \
115 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
116 ; RUN: -match-full-lines -dump-input=fail -v 2>&1 \
117 ; RUN: | FileCheck %s -match-full-lines -allow-empty \
118 ; RUN: -check-prefixes=NOTRACE,NODUMP
120 ; FileCheck fail, -v => dump, no trace.
121 ; RUN: %ProtectFileCheckOutput \
122 ; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
123 ; RUN: -match-full-lines -dump-input=fail -v 2>&1 \
124 ; RUN: | FileCheck %s -match-full-lines \
125 ; RUN: -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
127 ;--------------------------------------------------
128 ; Check -dump-input=always.
129 ;--------------------------------------------------
131 ; FileCheck success, -v => dump, no trace.
132 ; RUN: %ProtectFileCheckOutput \
133 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
134 ; RUN: -match-full-lines -dump-input=always -v 2>&1 \
135 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,DUMP-OK
137 ; FileCheck fail, -v => dump, no trace.
138 ; RUN: %ProtectFileCheckOutput \
139 ; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
140 ; RUN: -match-full-lines -dump-input=always -v 2>&1 \
141 ; RUN: | FileCheck %s -match-full-lines \
142 ; RUN: -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
144 ;--------------------------------------------------
145 ; Check multiple -dump-input options.
147 ; This occurs most commonly when a test author specifies -dump-input on a
148 ; specific FileCheck call while a test runner specifies -dump-input in
149 ; FILECHECK_OPTS, but check the behavior generally.
151 ; "help" has precedence, and then the most verbose value wins. The most
152 ; common combinations involve "fail" and "always", so test those the most.
153 ;--------------------------------------------------
155 ;- - - - - - - - - - - - - - - - - - - - - - - - -
157 ;- - - - - - - - - - - - - - - - - - - - - - - - -
159 ; fail, fail => fail (FileCheck fail => dump)
160 ; RUN: %ProtectFileCheckOutput \
161 ; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
162 ; RUN: -match-full-lines -dump-input=fail -dump-input=fail -v \
164 ; RUN: | FileCheck %s -match-full-lines \
165 ; RUN: -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
167 ;- - - - - - - - - - - - - - - - - - - - - - - - -
169 ;- - - - - - - - - - - - - - - - - - - - - - - - -
171 ; help, always => help
172 ; RUN: %ProtectFileCheckOutput \
173 ; RUN: FileCheck -input-file %t.err -color %t.check \
174 ; RUN: -dump-input=help -dump-input=always \
175 ; RUN: | FileCheck %s -check-prefix=HELP
177 ; always, fail => always (FileCheck success => dump)
178 ; RUN: %ProtectFileCheckOutput \
179 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
180 ; RUN: -match-full-lines -dump-input=always -dump-input=fail \
182 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,DUMP-OK
184 ; fail, never => fail (FileCheck fail => dump)
185 ; RUN: %ProtectFileCheckOutput \
186 ; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
187 ; RUN: -match-full-lines -dump-input=fail -dump-input=never -v \
189 ; RUN: | FileCheck %s -match-full-lines \
190 ; RUN: -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
192 ;- - - - - - - - - - - - - - - - - - - - - - - - -
193 ; Check that order doesn't matter.
194 ;- - - - - - - - - - - - - - - - - - - - - - - - -
196 ; fail, always => always (FileCheck success => dump)
197 ; RUN: %ProtectFileCheckOutput \
198 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
199 ; RUN: -match-full-lines -dump-input=fail -dump-input=always \
201 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,DUMP-OK
203 ;- - - - - - - - - - - - - - - - - - - - - - - - -
204 ; Check that FILECHECK_OPTS isn't handled differently.
205 ;- - - - - - - - - - - - - - - - - - - - - - - - -
207 ; always, fail => always (FileCheck success => dump)
208 ; RUN: %ProtectFileCheckOutput FILECHECK_OPTS=-dump-input=always \
209 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
210 ; RUN: -match-full-lines -dump-input=fail -v 2>&1 \
211 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,DUMP-OK
213 ; fail, always => always (FileCheck success => dump)
214 ; RUN: %ProtectFileCheckOutput FILECHECK_OPTS=-dump-input=fail \
215 ; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
216 ; RUN: -match-full-lines -dump-input=always -v 2>&1 \
217 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,DUMP-OK
221 ;--------------------------------------------------
223 ;--------------------------------------------------
226 ; HELP: The following description was requested by -dump-input=help
227 ; HELP: - colors {{.*}}
230 ; Trace is sometimes suppressed.
231 ; TRACE: {{.*}}remark:{{.*}}
232 ; NOTRACE-NOT: remark:
234 ; Error diagnostics are never suppressed.
235 ; ERR: {{.*}}error:{{.*}}
239 ; DUMP-OK: Input was:
240 ; DUMP-OK-NEXT: <<<<<<
241 ; DUMP-OK-NEXT: 1: hello
242 ; DUMP-OK-NEXT: check:1 ^~~~~
243 ; DUMP-OK-NEXT: 2: world
244 ; DUMP-OK-NEXT: next:2 ^~~~~
245 ; DUMP-OK-NEXT: >>>>>>
247 ; DUMP-ERR: Input was:
248 ; DUMP-ERR-NEXT: <<<<<<
249 ; DUMP-ERR-NEXT: 1: hello
250 ; DUMP-ERR-V-NEXT: check:1 ^~~~~
251 ; DUMP-ERR-NEXT: next:2'0 X error: no match found
252 ; DUMP-ERR-NEXT: 2: whirled
253 ; DUMP-ERR-NEXT: next:2'0 ~~~~~~~~
254 ; DUMP-ERR-NEXT: next:2'1 ? possible intended match
255 ; DUMP-ERR-NEXT: >>>>>>