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
|
;--------------------------------------------------
; Input file, check file, and directives for checking the size of the context.
;
; These are designed to be used with -dump-input=fail -vv.
;
; In the resulting input dump, there are three potential ellipses:
;
; - S: At the start of the input.
; - M: Between two input lines included by the filter.
; - E: At the end of the input.
;
; They are all present at -dump-input-context=4. One becomes useless each time
; -dump-input-context is incremented beyond that because then that ellipsis
; becomes equal to or larger than the input lines it elides.
;--------------------------------------------------
; RUN: echo foo8 > %t.in
; RUN: echo foo7 >> %t.in
; RUN: echo foo6 >> %t.in
; RUN: echo foo5 >> %t.in
; RUN: echo foo4 >> %t.in
; RUN: echo foo3 >> %t.in
; RUN: echo foo2 >> %t.in
; RUN: echo foo1 >> %t.in
; RUN: echo lab1 hello >> %t.in
; RUN: echo foo1 >> %t.in
; RUN: echo foo2 >> %t.in
; RUN: echo foo3 >> %t.in
; RUN: echo foo4 >> %t.in
; RUN: echo foo5 >> %t.in
; RUN: echo foo6 >> %t.in
; RUN: echo foo7 >> %t.in
; RUN: echo foo7 >> %t.in
; RUN: echo foo6 >> %t.in
; RUN: echo foo5 >> %t.in
; RUN: echo foo4 >> %t.in
; RUN: echo foo3 >> %t.in
; RUN: echo foo2 >> %t.in
; RUN: echo foo1 >> %t.in
; RUN: echo lab2 world >> %t.in
; RUN: echo foo1 >> %t.in
; RUN: echo foo2 >> %t.in
; RUN: echo foo3 >> %t.in
; RUN: echo foo4 >> %t.in
; RUN: echo foo5 >> %t.in
; RUN: echo foo6 >> %t.in
; RUN: echo foo7 >> %t.in
; RUN: echo foo8 >> %t.in
; RUN: echo foo9 >> %t.in
; RUN: echo foo0 >> %t.in
; RUN: echo 'CHECK-LABEL: lab1' > %t.chk
; RUN: echo ' CHECK-NEXT: hello' >> %t.chk
; RUN: echo 'CHECK-LABEL: lab2' >> %t.chk
; RUN: echo ' CHECK-NEXT: world' >> %t.chk
; C0: <<<<<<
; CS-NEXT: .
; CS-NEXT: .
; CS-NEXT: .
; C5-NEXT: 1: foo8
; C5-NEXT: 2: foo7
; C5-NEXT: 3: foo6
; C5-NEXT: 4: foo5
; C4-NEXT: 5: foo4
; C3-NEXT: 6: foo3
; C2-NEXT: 7: foo2
; C1-NEXT: 8: foo1
; C0-NEXT: 9: lab1 hello
; C0-NEXT: label:1'0 ^~~~
; C0-NEXT: label:1'1 ^~~~
; C0-NEXT: next:2 !~~~~ error: match on wrong line
; C1-NEXT: 10: foo1
; C2-NEXT: 11: foo2
; C3-NEXT: 12: foo3
; C4-NEXT: 13: foo4
; C5-NEXT: 14: foo5
; C6-NEXT: 15: foo6
; C6-NEXT: 16: foo7
; CM-NEXT: .
; CM-NEXT: .
; CM-NEXT: .
; C6-NEXT: 17: foo7
; C6-NEXT: 18: foo6
; C5-NEXT: 19: foo5
; C4-NEXT: 20: foo4
; C3-NEXT: 21: foo3
; C2-NEXT: 22: foo2
; C1-NEXT: 23: foo1
; C0-NEXT: 24: lab2 world
; C0-NEXT: label:3 ^~~~
; C0-NEXT: next:4 !~~~~ error: match on wrong line
; C1-NEXT: 25: foo1
; C2-NEXT: 26: foo2
; C3-NEXT: 27: foo3
; C4-NEXT: 28: foo4
; C5-NEXT: 29: foo5
; C6-NEXT: 30: foo6
; C7-NEXT: 31: foo7
; C7-NEXT: 32: foo8
; C7-NEXT: 33: foo9
; C7-NEXT: 34: foo0
; CE-NEXT: .
; CE-NEXT: .
; CE-NEXT: .
; C0-NEXT: >>>>>>
; Now build an alternate set of checks where input lines that might be elided by
; ellipses have annotations.
; RUN: cp %t.in %t.wide.in
; RUN: echo 'CHECK-LABEL: lab1' > %t.wide.chk
; RUN: echo ' CHECK: hello' >> %t.wide.chk
; RUN: echo ' CHECK: goodbye' >> %t.wide.chk
; RUN: echo 'CHECK-LABEL: lab2' >> %t.wide.chk
; RUN: echo ' CHECK-NEXT: world' >> %t.wide.chk
; W5: <<<<<<
; W5: 9: lab1 hello
; W5-NEXT: label:1'0 ^~~~
; W5-NEXT: label:1'1 ^~~~
; W5-NEXT: check:2 ^~~~~
; W5-NEXT: check:3'0 X error: no match found
; W5-NEXT: 10: foo1
; W5-NEXT: check:3'0 ~~~~~
; W5-NEXT: check:3'1 ? possible intended match
; W5-NEXT: 11: foo2
; W5-NEXT: check:3'0 ~~~~~
; W5-NEXT: 12: foo3
; W5-NEXT: check:3'0 ~~~~~
; W5-NEXT: 13: foo4
; W5-NEXT: check:3'0 ~~~~~
; W5-NEXT: 14: foo5
; W5-NEXT: check:3'0 ~~~~~
; W5-NEXT: 15: foo6
; W5-NEXT: check:3'0 ~~~~~
; W6-NEXT: 16: foo7
; W6-NEXT: check:3'0 ~~~~~
; WM-NEXT: .
; WM-NEXT: .
; WM-NEXT: .
; W6-NEXT: 17: foo7
; W6-NEXT: check:3'0 ~~~~~
; W6-NEXT: 18: foo6
; W6-NEXT: check:3'0 ~~~~~
; W5-NEXT: 19: foo5
; W5-NEXT: check:3'0 ~~~~~
; W5-NEXT: 20: foo4
; W5-NEXT: check:3'0 ~~~~~
; W5-NEXT: 21: foo3
; W5-NEXT: check:3'0 ~~~~~
; W5-NEXT: 22: foo2
; W5-NEXT: check:3'0 ~~~~~
; W5-NEXT: 23: foo1
; W5-NEXT: check:3'0 ~~~~~
; W5-NEXT: 24: lab2 world
; W5-NEXT: label:4 ^~~~
; W5-NEXT: check:3'0 ~~~~
; W5-NEXT: next:5 !~~~~ error: match on wrong line
;--------------------------------------------------
; Check -dump-input-context=<bad value>.
;--------------------------------------------------
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
; RUN: -dump-input-context=-1 \
; RUN: | FileCheck %s -match-full-lines -check-prefix=BADVAL -DVAL=-1
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
; RUN: -dump-input-context=foobar \
; RUN: | FileCheck %s -match-full-lines -check-prefix=BADVAL -DVAL=foobar
BADVAL: {{F|f}}ile{{C|c}}heck{{.*}}: for the --dump-input-context option: '[[VAL]]' value invalid for uint argument!
;--------------------------------------------------
; Check -dump-input-context explicit values.
;--------------------------------------------------
; 0 is an important boundary case.
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
; RUN: -dump-input-context=0 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,CS,CM,CE
; 1 is an important boundary case.
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
; RUN: -dump-input-context=1 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,CS,CM,CE
; 4 is the boundary case at which all ellipses are present in our test.
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
; RUN: -dump-input-context=4 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,C2,C3,C4,CS,CM,CE
; 5 is the boundary case at which the start ellipsis is useless.
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
; RUN: -dump-input-context=5 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,C2,C3,C4,C5,CM,CE
; 6 is the boundary case at which the middle ellipsis is useless.
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
; RUN: -dump-input-context=6 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,C2,C3,C4,C5,C6,CE
; 7 is the boundary case at which the end ellipsis is useless.
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
; RUN: -dump-input-context=7 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,C2,C3,C4,C5,C6,C7
; Make sure all is fine when -dump-input-context is far larger than the input.
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
; RUN: -dump-input-context=200 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,C2,C3,C4,C5,C6,C7
;--------------------------------------------------
; Check that -dump-input-context default is 5.
;--------------------------------------------------
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,C2,C3,C4,C5,CM,CE
;--------------------------------------------------
; Check multiple -dump-input-context options.
;
; This might occur when a test author specifies -dump-input-context on a
; specific FileCheck call while a test runner specifies -dump-input-context in
; FILECHECK_OPTS, but check the behavior generally.
;
; The largest value wins because it provides the most information.
;--------------------------------------------------
;- - - - - - - - - - - - - - - - - - - - - - - - -
; Check duplicate.
;- - - - - - - - - - - - - - - - - - - - - - - - -
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
; RUN: -dump-input-context=1 -dump-input-context=1 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,CS,CM,CE
;- - - - - - - - - - - - - - - - - - - - - - - - -
; Check precedence.
;- - - - - - - - - - - - - - - - - - - - - - - - -
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
; RUN: -dump-input-context=0 -dump-input-context=1 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,CS,CM,CE
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
; RUN: -dump-input-context=1 -dump-input-context=0 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,CS,CM,CE
;- - - - - - - - - - - - - - - - - - - - - - - - -
; Check that FILECHECK_OPTS isn't handled differently.
;- - - - - - - - - - - - - - - - - - - - - - - - -
; RUN: %ProtectFileCheckOutput FILECHECK_OPTS=-dump-input-context=0 \
; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
; RUN: -dump-input-context=1 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,CS,CM,CE
; RUN: %ProtectFileCheckOutput FILECHECK_OPTS=-dump-input-context=1 \
; RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
; RUN: -dump-input-context=0 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=C0,C1,CS,CM,CE
;--------------------------------------------------
; Check how annotations on input lines that might be elided by ellipses affect
; whether they are actually elided.
;--------------------------------------------------
; At -dump-input-context=5, the ellipsis is useful but only when annotations on
; elided input lines are considered.
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=fail -vv %t.wide.chk < %t.wide.in 2>&1 \
; RUN: -dump-input-context=5 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=W5,WM
; At -dump-input-context=6, the ellipsis is not useful even when annotations on
; elided input lines are considered.
; RUN: %ProtectFileCheckOutput \
; RUN: not FileCheck -dump-input=fail -vv %t.wide.chk < %t.wide.in 2>&1 \
; RUN: -dump-input-context=6 \
; RUN: | FileCheck %s -match-full-lines -check-prefixes=W5,W6
|