296 lines · plain
1;--------------------------------------------------2; Input file, check file, and directives for checking the size of the context.3;4; These are designed to be used with -dump-input=fail -vv.5;6; In the resulting input dump, there are three potential ellipses:7;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.11;12; They are all present at -dump-input-context=4. One becomes useless each time13; -dump-input-context is incremented beyond that because then that ellipsis14; becomes equal to or larger than the input lines it elides.15;--------------------------------------------------16 17; RUN: echo foo8 > %t.in18; RUN: echo foo7 >> %t.in19; RUN: echo foo6 >> %t.in20; RUN: echo foo5 >> %t.in21; RUN: echo foo4 >> %t.in22; RUN: echo foo3 >> %t.in23; RUN: echo foo2 >> %t.in24; RUN: echo foo1 >> %t.in25; RUN: echo lab1 hello >> %t.in26; RUN: echo foo1 >> %t.in27; RUN: echo foo2 >> %t.in28; RUN: echo foo3 >> %t.in29; RUN: echo foo4 >> %t.in30; RUN: echo foo5 >> %t.in31; RUN: echo foo6 >> %t.in32; RUN: echo foo7 >> %t.in33; RUN: echo foo7 >> %t.in34; RUN: echo foo6 >> %t.in35; RUN: echo foo5 >> %t.in36; RUN: echo foo4 >> %t.in37; RUN: echo foo3 >> %t.in38; RUN: echo foo2 >> %t.in39; RUN: echo foo1 >> %t.in40; RUN: echo lab2 world >> %t.in41; RUN: echo foo1 >> %t.in42; RUN: echo foo2 >> %t.in43; RUN: echo foo3 >> %t.in44; RUN: echo foo4 >> %t.in45; RUN: echo foo5 >> %t.in46; RUN: echo foo6 >> %t.in47; RUN: echo foo7 >> %t.in48; RUN: echo foo8 >> %t.in49; RUN: echo foo9 >> %t.in50; RUN: echo foo0 >> %t.in51 52; RUN: echo 'CHECK-LABEL: lab1' > %t.chk53; RUN: echo ' CHECK-NEXT: hello' >> %t.chk54; RUN: echo 'CHECK-LABEL: lab2' >> %t.chk55; RUN: echo ' CHECK-NEXT: world' >> %t.chk56 57; C0: <<<<<<58; CS-NEXT: .59; CS-NEXT: .60; CS-NEXT: .61; C5-NEXT: 1: foo8 62; C5-NEXT: 2: foo7 63; C5-NEXT: 3: foo6 64; C5-NEXT: 4: foo5 65; C4-NEXT: 5: foo4 66; C3-NEXT: 6: foo3 67; C2-NEXT: 7: foo2 68; C1-NEXT: 8: foo1 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 line73; C1-NEXT: 10: foo1 74; C2-NEXT: 11: foo2 75; C3-NEXT: 12: foo3 76; C4-NEXT: 13: foo4 77; C5-NEXT: 14: foo5 78; C6-NEXT: 15: foo6 79; C6-NEXT: 16: foo7 80; CM-NEXT: .81; CM-NEXT: .82; CM-NEXT: .83; C6-NEXT: 17: foo7 84; C6-NEXT: 18: foo6 85; C5-NEXT: 19: foo5 86; C4-NEXT: 20: foo4 87; C3-NEXT: 21: foo3 88; C2-NEXT: 22: foo2 89; C1-NEXT: 23: foo1 90; C0-NEXT: 24: lab2 world 91; C0-NEXT: label:3 ^~~~92; C0-NEXT: next:4 !~~~~ error: match on wrong line93; C1-NEXT: 25: foo1 94; C2-NEXT: 26: foo2 95; C3-NEXT: 27: foo3 96; C4-NEXT: 28: foo4 97; C5-NEXT: 29: foo5 98; C6-NEXT: 30: foo6 99; C7-NEXT: 31: foo7 100; C7-NEXT: 32: foo8 101; C7-NEXT: 33: foo9 102; C7-NEXT: 34: foo0 103; CE-NEXT: .104; CE-NEXT: .105; CE-NEXT: .106; C0-NEXT: >>>>>>107 108; Now build an alternate set of checks where input lines that might be elided by109; ellipses have annotations.110 111; RUN: cp %t.in %t.wide.in112; RUN: echo 'CHECK-LABEL: lab1' > %t.wide.chk113; RUN: echo ' CHECK: hello' >> %t.wide.chk114; RUN: echo ' CHECK: goodbye' >> %t.wide.chk115; RUN: echo 'CHECK-LABEL: lab2' >> %t.wide.chk116; RUN: echo ' CHECK-NEXT: world' >> %t.wide.chk117 118; W5: <<<<<<119; W5: 9: lab1 hello 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 found124; W5-NEXT: 10: foo1 125; W5-NEXT: check:3'0 ~~~~~126; W5-NEXT: check:3'1 ? possible intended match127; W5-NEXT: 11: foo2 128; W5-NEXT: check:3'0 ~~~~~129; W5-NEXT: 12: foo3 130; W5-NEXT: check:3'0 ~~~~~131; W5-NEXT: 13: foo4 132; W5-NEXT: check:3'0 ~~~~~133; W5-NEXT: 14: foo5 134; W5-NEXT: check:3'0 ~~~~~135; W5-NEXT: 15: foo6 136; W5-NEXT: check:3'0 ~~~~~137; W6-NEXT: 16: foo7 138; W6-NEXT: check:3'0 ~~~~~139; WM-NEXT: .140; WM-NEXT: .141; WM-NEXT: .142; W6-NEXT: 17: foo7 143; W6-NEXT: check:3'0 ~~~~~144; W6-NEXT: 18: foo6 145; W6-NEXT: check:3'0 ~~~~~146; W5-NEXT: 19: foo5 147; W5-NEXT: check:3'0 ~~~~~148; W5-NEXT: 20: foo4 149; W5-NEXT: check:3'0 ~~~~~150; W5-NEXT: 21: foo3 151; W5-NEXT: check:3'0 ~~~~~152; W5-NEXT: 22: foo2 153; W5-NEXT: check:3'0 ~~~~~154; W5-NEXT: 23: foo1 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 line160 161;--------------------------------------------------162; Check -dump-input-context=<bad value>.163;--------------------------------------------------164 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=-1169 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=foobar174 175BADVAL: {{F|f}}ile{{C|c}}heck{{.*}}: for the --dump-input-context option: '[[VAL]]' value invalid for uint argument!176 177;--------------------------------------------------178; Check -dump-input-context explicit values.179;--------------------------------------------------180 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,CE186 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,CE192 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,CE198 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,CE204 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,CE210 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,C7216 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,C7222 223;--------------------------------------------------224; Check that -dump-input-context default is 5.225;--------------------------------------------------226 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,CE230 231;--------------------------------------------------232; Check multiple -dump-input-context options.233;234; This might occur when a test author specifies -dump-input-context on a235; specific FileCheck call while a test runner specifies -dump-input-context in236; FILECHECK_OPTS, but check the behavior generally.237;238; The largest value wins because it provides the most information.239;--------------------------------------------------240 241;- - - - - - - - - - - - - - - - - - - - - - - - -242; Check duplicate.243;- - - - - - - - - - - - - - - - - - - - - - - - -244 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,CE249 250;- - - - - - - - - - - - - - - - - - - - - - - - -251; Check precedence.252;- - - - - - - - - - - - - - - - - - - - - - - - -253 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,CE258 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,CE263 264;- - - - - - - - - - - - - - - - - - - - - - - - -265; Check that FILECHECK_OPTS isn't handled differently.266;- - - - - - - - - - - - - - - - - - - - - - - - -267 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,CE272 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,CE277 278;--------------------------------------------------279; Check how annotations on input lines that might be elided by ellipses affect280; whether they are actually elided.281;--------------------------------------------------282 283; At -dump-input-context=5, the ellipsis is useful but only when annotations on284; 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,WM289 290; At -dump-input-context=6, the ellipsis is not useful even when annotations on291; 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,W6296