1 ;--------------------------------------------------
2 ; Input file, check file, and directives for checking the size of the context.
4 ; These are designed to be used with -dump-input=fail -vv.
6 ; In the resulting input dump, there are three potential ellipses:
8 ; - S: At the start of the input.
9 ; - M: Between two input lines included by the filter.
10 ; - E: At the end of the input.
12 ; They are all present at -dump-input-context=4. One becomes useless each time
13 ; -dump-input-context is incremented beyond that because then that ellipsis
14 ; becomes equal to or larger than the input lines it elides.
15 ;--------------------------------------------------
17 ; RUN: echo foo8 > %t.in
18 ; RUN: echo foo7 >> %t.in
19 ; RUN: echo foo6 >> %t.in
20 ; RUN: echo foo5 >> %t.in
21 ; RUN: echo foo4 >> %t.in
22 ; RUN: echo foo3 >> %t.in
23 ; RUN: echo foo2 >> %t.in
24 ; RUN: echo foo1 >> %t.in
25 ; RUN: echo lab1 hello >> %t.in
26 ; RUN: echo foo1 >> %t.in
27 ; RUN: echo foo2 >> %t.in
28 ; RUN: echo foo3 >> %t.in
29 ; RUN: echo foo4 >> %t.in
30 ; RUN: echo foo5 >> %t.in
31 ; RUN: echo foo6 >> %t.in
32 ; RUN: echo foo7 >> %t.in
33 ; RUN: echo foo7 >> %t.in
34 ; RUN: echo foo6 >> %t.in
35 ; RUN: echo foo5 >> %t.in
36 ; RUN: echo foo4 >> %t.in
37 ; RUN: echo foo3 >> %t.in
38 ; RUN: echo foo2 >> %t.in
39 ; RUN: echo foo1 >> %t.in
40 ; RUN: echo lab2 world >> %t.in
41 ; RUN: echo foo1 >> %t.in
42 ; RUN: echo foo2 >> %t.in
43 ; RUN: echo foo3 >> %t.in
44 ; RUN: echo foo4 >> %t.in
45 ; RUN: echo foo5 >> %t.in
46 ; RUN: echo foo6 >> %t.in
47 ; RUN: echo foo7 >> %t.in
48 ; RUN: echo foo8 >> %t.in
49 ; RUN: echo foo9 >> %t.in
50 ; RUN: echo foo0 >> %t.in
52 ; RUN: echo 'CHECK-LABEL: lab1' > %t.chk
53 ; RUN: echo ' CHECK-NEXT: hello' >> %t.chk
54 ; RUN: echo 'CHECK-LABEL: lab2' >> %t.chk
55 ; RUN: echo ' CHECK-NEXT: world' >> %t.chk
69 ; C0-NEXT: 9: lab1 hello
70 ; C0-NEXT: label:1'0 ^~~~
71 ; C0-NEXT: label:1'1 ^~~~
72 ; C0-NEXT: next:2 !~~~~ error: match on wrong line
90 ; C0-NEXT: 24: lab2 world
91 ; C0-NEXT: label:3 ^~~~
92 ; C0-NEXT: next:4 !~~~~ error: match on wrong line
108 ; Now build an alternate set of checks where input lines that might be elided by
109 ; ellipses have annotations.
111 ; RUN: cp %t.in %t.wide.in
112 ; RUN: echo 'CHECK-LABEL: lab1' > %t.wide.chk
113 ; RUN: echo ' CHECK: hello' >> %t.wide.chk
114 ; RUN: echo ' CHECK: goodbye' >> %t.wide.chk
115 ; RUN: echo 'CHECK-LABEL: lab2' >> %t.wide.chk
116 ; RUN: echo ' CHECK-NEXT: world' >> %t.wide.chk
120 ; W5-NEXT: label:1'0 ^~~~
121 ; W5-NEXT: label:1'1 ^~~~
122 ; W5-NEXT: check:2 ^~~~~
123 ; W5-NEXT: check:3'0 X error: no match found
125 ; W5-NEXT: check:3'0 ~~~~~
126 ; W5-NEXT: check:3'1 ? possible intended match
128 ; W5-NEXT: check:3'0 ~~~~~
130 ; W5-NEXT: check:3'0 ~~~~~
132 ; W5-NEXT: check:3'0 ~~~~~
134 ; W5-NEXT: check:3'0 ~~~~~
136 ; W5-NEXT: check:3'0 ~~~~~
138 ; W6-NEXT: check:3'0 ~~~~~
143 ; W6-NEXT: check:3'0 ~~~~~
145 ; W6-NEXT: check:3'0 ~~~~~
147 ; W5-NEXT: check:3'0 ~~~~~
149 ; W5-NEXT: check:3'0 ~~~~~
151 ; W5-NEXT: check:3'0 ~~~~~
153 ; W5-NEXT: check:3'0 ~~~~~
155 ; W5-NEXT: check:3'0 ~~~~~
156 ; W5-NEXT: 24: lab2 world
157 ; W5-NEXT: label:4 ^~~~
158 ; W5-NEXT: check:3'0 ~~~~
159 ; W5-NEXT: next:5 !~~~~ error: match on wrong line
161 ;--------------------------------------------------
162 ; Check -dump-input-context=<bad value>.
163 ;--------------------------------------------------
165 ; RUN: %ProtectFileCheckOutput \
166 ; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
167 ; RUN: -dump-input-context=-1 \
168 ; RUN: | FileCheck %s -match-full-lines -check-prefix=BADVAL -DVAL=-1
170 ; RUN: %ProtectFileCheckOutput \
171 ; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
172 ; RUN: -dump-input-context=foobar \
173 ; RUN: | FileCheck %s -match-full-lines -check-prefix=BADVAL -DVAL=foobar
175 BADVAL: {{F|f}}ile{{C|c}}heck{{.*}}: for the --dump-input-context option: '[[VAL]]' value invalid for uint argument!
177 ;--------------------------------------------------
178 ; Check -dump-input-context explicit values.
179 ;--------------------------------------------------
181 ; 0 is an important boundary case.
182 ; RUN: %ProtectFileCheckOutput \
183 ; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
184 ; RUN: -dump-input-context=0 \
185 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,CS,CM,CE
187 ; 1 is an important boundary case.
188 ; RUN: %ProtectFileCheckOutput \
189 ; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
190 ; RUN: -dump-input-context=1 \
191 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,CS,CM,CE
193 ; 4 is the boundary case at which all ellipses are present in our test.
194 ; RUN: %ProtectFileCheckOutput \
195 ; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
196 ; RUN: -dump-input-context=4 \
197 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,C2,C3,C4,CS,CM,CE
199 ; 5 is the boundary case at which the start ellipsis is useless.
200 ; RUN: %ProtectFileCheckOutput \
201 ; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
202 ; RUN: -dump-input-context=5 \
203 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,C2,C3,C4,C5,CM,CE
205 ; 6 is the boundary case at which the middle ellipsis is useless.
206 ; RUN: %ProtectFileCheckOutput \
207 ; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
208 ; RUN: -dump-input-context=6 \
209 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,C2,C3,C4,C5,C6,CE
211 ; 7 is the boundary case at which the end ellipsis is useless.
212 ; RUN: %ProtectFileCheckOutput \
213 ; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
214 ; RUN: -dump-input-context=7 \
215 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,C2,C3,C4,C5,C6,C7
217 ; Make sure all is fine when -dump-input-context is far larger than the input.
218 ; RUN: %ProtectFileCheckOutput \
219 ; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
220 ; RUN: -dump-input-context=200 \
221 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,C2,C3,C4,C5,C6,C7
223 ;--------------------------------------------------
224 ; Check that -dump-input-context default is 5.
225 ;--------------------------------------------------
227 ; RUN: %ProtectFileCheckOutput \
228 ; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
229 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,C2,C3,C4,C5,CM,CE
231 ;--------------------------------------------------
232 ; Check multiple -dump-input-context options.
234 ; This might occur when a test author specifies -dump-input-context on a
235 ; specific FileCheck call while a test runner specifies -dump-input-context in
236 ; FILECHECK_OPTS, but check the behavior generally.
238 ; The largest value wins because it provides the most information.
239 ;--------------------------------------------------
241 ;- - - - - - - - - - - - - - - - - - - - - - - - -
243 ;- - - - - - - - - - - - - - - - - - - - - - - - -
245 ; RUN: %ProtectFileCheckOutput \
246 ; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
247 ; RUN: -dump-input-context=1 -dump-input-context=1 \
248 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,CS,CM,CE
250 ;- - - - - - - - - - - - - - - - - - - - - - - - -
252 ;- - - - - - - - - - - - - - - - - - - - - - - - -
254 ; RUN: %ProtectFileCheckOutput \
255 ; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
256 ; RUN: -dump-input-context=0 -dump-input-context=1 \
257 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,CS,CM,CE
259 ; RUN: %ProtectFileCheckOutput \
260 ; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
261 ; RUN: -dump-input-context=1 -dump-input-context=0 \
262 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,CS,CM,CE
264 ;- - - - - - - - - - - - - - - - - - - - - - - - -
265 ; Check that FILECHECK_OPTS isn't handled differently.
266 ;- - - - - - - - - - - - - - - - - - - - - - - - -
268 ; RUN: %ProtectFileCheckOutput FILECHECK_OPTS=-dump-input-context=0 \
269 ; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
270 ; RUN: -dump-input-context=1 \
271 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,CS,CM,CE
273 ; RUN: %ProtectFileCheckOutput FILECHECK_OPTS=-dump-input-context=1 \
274 ; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
275 ; RUN: -dump-input-context=0 \
276 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,CS,CM,CE
278 ;--------------------------------------------------
279 ; Check how annotations on input lines that might be elided by ellipses affect
280 ; whether they are actually elided.
281 ;--------------------------------------------------
283 ; At -dump-input-context=5, the ellipsis is useful but only when annotations on
284 ; elided input lines are considered.
285 ; RUN: %ProtectFileCheckOutput \
286 ; RUN: not FileCheck -dump-input=fail -vv %t.wide.chk < %t.wide.in 2>&1 \
287 ; RUN: -dump-input-context=5 \
288 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=W5,WM
290 ; At -dump-input-context=6, the ellipsis is not useful even when annotations on
291 ; elided input lines are considered.
292 ; RUN: %ProtectFileCheckOutput \
293 ; RUN: not FileCheck -dump-input=fail -vv %t.wide.chk < %t.wide.in 2>&1 \
294 ; RUN: -dump-input-context=6 \
295 ; RUN: | FileCheck %s -match-full-lines -check-prefixes=W5,W6