| ;-------------------------------------------------- | |
| ; 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 | |
| ; 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'0 { search range start (exclusive) | |
| ; C0-NEXT:next:2'1 !~~~~ 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:2'2 } search range end (exclusive) | |
| ; 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-DAG: hello{{([foo0-9[:space:]])*}}' >> %t.wide.chk | |
| ; RUN: echo ' CHECK-DAG: 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:dag:2 ^~~~~~ | |
| ; W5-NEXT:dag:3'0 { search range start (exclusive) | |
| ; W5-NEXT:dag:3'1 error: no match found in search range | |
| ; W5-NEXT: 10: foo1 | |
| ; W5-NEXT:dag:2 ~~~~~ | |
| ; W5-NEXT:dag:3'2 ? possible intended match | |
| ; W5-NEXT: 11: foo2 | |
| ; W5-NEXT:dag:2 ~~~~~ | |
| ; W5-NEXT: 12: foo3 | |
| ; W5-NEXT:dag:2 ~~~~~ | |
| ; W5-NEXT: 13: foo4 | |
| ; W5-NEXT:dag:2 ~~~~~ | |
| ; W5-NEXT: 14: foo5 | |
| ; W5-NEXT:dag:2 ~~~~~ | |
| ; W5-NEXT: 15: foo6 | |
| ; W5-NEXT:dag:2 ~~~~~ | |
| ; W6-NEXT: 16: foo7 | |
| ; W6-NEXT:dag:2 ~~~~~ | |
| ; WM-NEXT: . | |
| ; WM-NEXT: . | |
| ; WM-NEXT: . | |
| ; W6-NEXT: 17: foo7 | |
| ; W6-NEXT:dag:2 ~~~~~ | |
| ; W6-NEXT: 18: foo6 | |
| ; W6-NEXT:dag:2 ~~~~~ | |
| ; W5-NEXT: 19: foo5 | |
| ; W5-NEXT:dag:2 ~~~~~ | |
| ; W5-NEXT: 20: foo4 | |
| ; W5-NEXT:dag:2 ~~~~~ | |
| ; W5-NEXT: 21: foo3 | |
| ; W5-NEXT:dag:2 ~~~~~ | |
| ; W5-NEXT: 22: foo2 | |
| ; W5-NEXT:dag:2 ~~~~~ | |
| ; W5-NEXT: 23: foo1 | |
| ; W5-NEXT:dag:2 ~~~~~ | |
| ; W5-NEXT: 24: lab2 world | |
| ; W5-NEXT:label:4 ^~~~ | |
| ; W5-NEXT:dag:3'3 } search range end (exclusive) | |
| ; W5-NEXT:next:5'0 { search range start (exclusive) | |
| ; W5-NEXT:next:5'1 !~~~~ 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 |