brintos

brintos / llvm-project-archived public Read only

0
0
Text · 33.8 KiB · 367ea33 Raw
870 lines · plain
1;--------------------------------------------------2; Use -strict-whitespace to check marker and note alignment here.3; (Also check multiline marker where start/end columns vary across lines.)4;5; In the remaining checks, don't use -strict-whitespace and thus check just the6; presence, order, and lengths of markers.  That way, if we ever change padding7; within line labels, we don't have to adjust so many tests.8;--------------------------------------------------9 10; RUN: echo 'hello world' > %t.in11; RUN: echo 'goodbye' >> %t.in12; RUN: echo 'world' >> %t.in13; RUN: echo 'unicorn' >> %t.in14 15; RUN: echo 'CHECK: hello' > %t.chk16; RUN: echo 'CHECK: universe' >> %t.chk17 18; RUN: %ProtectFileCheckOutput \19; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \20; RUN: | FileCheck -strict-whitespace -match-full-lines -check-prefix=ALIGN \21; RUN:             -implicit-check-not='remark:' %s22 23; Verbose diagnostics are suppressed but not errors.24; ALIGN:{{.*}}error:{{.*}}25; ALIGN:{{.*}}possible intended match here{{.*}}26 27; ALIGN:Input was:28; ALIGN-NEXT:<<<<<<29; ALIGN-NEXT:           1: hello world 30; ALIGN-NEXT:check:1       ^~~~~31; ALIGN-NEXT:check:2'0          X~~~~~~ error: no match found32; ALIGN-NEXT:           2: goodbye 33; ALIGN-NEXT:check:2'0     ~~~~~~~~34; ALIGN-NEXT:           3: world 35; ALIGN-NEXT:check:2'0     ~~~~~~36; ALIGN-NEXT:           4: unicorn 37; ALIGN-NEXT:check:2'0     ~~~~~~~~38; ALIGN-NEXT:check:2'1     ?        possible intended match39; ALIGN-NEXT:>>>>>>40; ALIGN-NOT:{{.}}41 42;--------------------------------------------------43; CHECK (also: multi-line search range, fuzzy match)44;--------------------------------------------------45 46; Good match and no match.47 48; RUN: echo 'hello'   > %t.in49; RUN: echo 'again'   >> %t.in50; RUN: echo 'whirled' >> %t.in51 52; RUN: echo 'CHECK: hello' > %t.chk53; RUN: echo 'CHECK: world' >> %t.chk54 55; RUN: %ProtectFileCheckOutput \56; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \57; RUN: | FileCheck -match-full-lines %s -check-prefix=CHK \58; RUN:             -implicit-check-not='remark:'59; RUN: %ProtectFileCheckOutput \60; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \61; RUN: | FileCheck -match-full-lines %s -check-prefixes=CHK,CHK-V \62; RUN:             -implicit-check-not='remark:'63; RUN: %ProtectFileCheckOutput \64; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \65; RUN: | FileCheck -match-full-lines %s -check-prefixes=CHK,CHK-V \66; RUN:             -implicit-check-not='remark:'67 68; Verbose diagnostics are suppressed but not errors.69; CHK: {{.*}}error:{{.*}}70; CHK: {{.*}}possible intended match here{{.*}}71 72; CHK:        <<<<<<73; CHK-NEXT:              1: hello 74; CHK-V-NEXT: check:1       ^~~~~75; CHK-NEXT:   check:2'0          X error: no match found76; CHK-NEXT:              2: again 77; CHK-NEXT:   check:2'0     ~~~~~~78; CHK-NEXT:              3: whirled 79; CHK-NEXT:   check:2'0     ~~~~~~~~80; CHK-NEXT:   check:2'1     ?        possible intended match81; CHK-NEXT:   >>>>>>82; CHK-NOT:    {{.}}83 84;--------------------------------------------------85; CHECK-COUNT-<num>86;--------------------------------------------------87 88; Good match and no match.89 90; RUN: echo 'pete'   > %t.in91; RUN: echo 'repete' >> %t.in92; RUN: echo 'repeat' >> %t.in93 94; RUN: echo 'CHECK-COUNT-3: pete' > %t.chk95 96; RUN: %ProtectFileCheckOutput \97; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \98; RUN: | FileCheck -match-full-lines %s -check-prefixes=CNT,CNT-Q \99; RUN:             -implicit-check-not='remark:'100; RUN: %ProtectFileCheckOutput \101; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \102; RUN: | FileCheck -match-full-lines %s -check-prefixes=CNT,CNT-V \103; RUN:             -implicit-check-not='remark:'104; RUN: %ProtectFileCheckOutput \105; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \106; RUN: | FileCheck -match-full-lines %s -check-prefixes=CNT,CNT-V \107; RUN:             -implicit-check-not='remark:'108 109; Verbose diagnostics are suppressed but not errors.110; CNT: {{.*}}error:{{.*}}111 112; CNT:          <<<<<<113; CNT-NEXT:                1: pete 114; CNT-V-NEXT:   count:1'0     ^~~~115; CNT-NEXT:                2: repete 116; CNT-V-NEXT:   count:1'1       ^~~~117; CNT-Q-NEXT:   count:1'0           X error: no match found118; CNT-V-NEXT:   count:1'2           X error: no match found119; CNT-NEXT:                3: repeat 120; CNT-Q-NEXT:   count:1'0     ~~~~~~~121; CNT-Q-NEXT:   count:1'1     ?       possible intended match122; CNT-V-NEXT:   count:1'2     ~~~~~~~123; CNT-V-NEXT:   count:1'3     ?       possible intended match124; CNT-NEXT:     >>>>>>125; CNT-NOT:      {{.}}126 127;--------------------------------------------------128; CHECK-NEXT (also: EOF search-range, wrong-line match)129;--------------------------------------------------130 131; Good match and no match.132 133; RUN: echo 'hello' > %t.in134; RUN: echo 'again' >> %t.in135 136; RUN: echo 'CHECK: hello' > %t.chk137; RUN: echo 'CHECK-NEXT: again' >> %t.chk138; RUN: echo 'CHECK-NEXT: world' >> %t.chk139 140; RUN: %ProtectFileCheckOutput \141; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \142; RUN: | FileCheck -match-full-lines %s -check-prefix=NXT \143; RUN:             -implicit-check-not='remark:'144; RUN: %ProtectFileCheckOutput \145; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \146; RUN: | FileCheck -match-full-lines %s -check-prefixes=NXT,NXT-V \147; RUN:             -implicit-check-not='remark:'148; RUN: %ProtectFileCheckOutput \149; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \150; RUN: | FileCheck -match-full-lines %s -check-prefixes=NXT,NXT-V,NXT-VV \151; RUN:             -implicit-check-not='remark:' -allow-unused-prefixes152 153; Verbose diagnostics are suppressed but not errors.154; NXT: {{.*}}error:{{.*}}155 156; NXT:        <<<<<<157; NXT-NEXT:            1: hello 158; NXT-V-NEXT: check:1     ^~~~~159; NXT-NEXT:            2: again 160; NXT-V-NEXT: next:2      ^~~~~161; NXT-NEXT:   next:3           X error: no match found162; NXT-NEXT:   >>>>>>163; NXT-NOT:    {{.}}164 165; Wrong-line match.166 167; RUN: echo 'yonder' >> %t.in168; RUN: echo 'world' >> %t.in169 170; RUN: %ProtectFileCheckOutput \171; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \172; RUN: | FileCheck -match-full-lines %s -check-prefix=NXT2173 174; NXT2:      <<<<<<175; NXT2-NEXT:         1: hello 176; NXT2-NEXT:         2: again 177; NXT2-NEXT:         3: yonder 178; NXT2-NEXT:         4: world 179; NXT2-NEXT: next:3     !~~~~  error: match on wrong line180; NXT2-NEXT: >>>>>>181; NXT2-NOT:  {{.}}182 183;--------------------------------------------------184; CHECK-SAME (also: multiple annotations per line, single-char search range,185; wrong-line match)186;--------------------------------------------------187 188; Good match and no match.189 190; RUN: echo 'hello world!' > %t.in191 192; RUN: echo 'CHECK: hello' > %t.chk193; RUN: echo 'CHECK-SAME: world' >> %t.chk194; RUN: echo 'CHECK-SAME: again' >> %t.chk195 196; RUN: %ProtectFileCheckOutput \197; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \198; RUN: | FileCheck -match-full-lines %s -check-prefix=SAM \199; RUN:             -implicit-check-not='remark:'200; RUN: %ProtectFileCheckOutput \201; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \202; RUN: | FileCheck -match-full-lines %s -check-prefixes=SAM,SAM-V \203; RUN:             -implicit-check-not='remark:'204; RUN: %ProtectFileCheckOutput \205; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \206; RUN: | FileCheck -match-full-lines %s -check-prefixes=SAM,SAM-V,SAM-VV \207; RUN:             -implicit-check-not='remark:' -allow-unused-prefixes208 209; Verbose diagnostics are suppressed but not errors.210; SAM: {{.*}}error:{{.*}}211 212; SAM:        <<<<<<213; SAM-NEXT:            1: hello world! 214; SAM-V-NEXT: check:1     ^~~~~215; SAM-V-NEXT: same:2            ^~~~~216; SAM-NEXT:   same:3                 X~ error: no match found217; SAM-NEXT:   >>>>>>218; SAM-NOT:    {{.}}219 220; Wrong-line match.221 222; RUN: echo 'again' >> %t.in223 224; RUN: %ProtectFileCheckOutput \225; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \226; RUN: | FileCheck -match-full-lines %s -check-prefixes=SAM2 \227; RUN:             -implicit-check-not='remark:'228 229; Verbose diagnostics are suppressed but not errors.230; SAM2: {{.*}}error:{{.*}}231 232; SAM2:      <<<<<<233; SAM2-NEXT:          1: hello world! 234; SAM2-NEXT: check:1     ^~~~~235; SAM2-NEXT: same:2            ^~~~~236; SAM2-NEXT:          2: again 237; SAM2-NEXT: same:3      !~~~~  error: match on wrong line238; SAM2-NEXT: >>>>>>239; SAM2-NOT:  {{.}}240 241;--------------------------------------------------242; CHECK-EMPTY (also: search range ends at label, single-char match, wrong-line243; match)244;--------------------------------------------------245 246; Good match and no match.247;248; CHECK-EMPTY always seems to match an empty line at EOF (illegally when it's249; not the next line) unless either (1) the last line is non-empty and has no250; newline or (2) there's a CHECK-LABEL to end the search range before EOF.  We251; choose scenario 2 to check the case of no match.252 253; RUN: echo 'hello' > %t.in254; RUN: echo '' >> %t.in255; RUN: echo 'world' >> %t.in256; RUN: echo 'label' >> %t.in257 258; RUN: echo 'CHECK: hello' > %t.chk259; RUN: echo 'CHECK-EMPTY:' >> %t.chk260; RUN: echo 'CHECK-EMPTY:' >> %t.chk261; RUN: echo 'CHECK-LABEL: label' >> %t.chk262 263; RUN: %ProtectFileCheckOutput \264; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \265; RUN: | FileCheck -match-full-lines %s -check-prefix=EMP \266; RUN:             -implicit-check-not='remark:'267; RUN: %ProtectFileCheckOutput \268; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \269; RUN: | FileCheck -match-full-lines %s -check-prefixes=EMP,EMP-V \270; RUN:             -implicit-check-not='remark:'271; RUN: %ProtectFileCheckOutput \272; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \273; RUN: | FileCheck -match-full-lines %s -check-prefixes=EMP,EMP-V,EMP-VV \274; RUN:             -implicit-check-not='remark:' -allow-unused-prefixes275 276; Verbose diagnostics are suppressed but not errors.277; EMP: {{.*}}error:{{.*}}278 279; EMP:        <<<<<<280; EMP-NEXT:            1: hello 281; EMP-V-NEXT: check:1     ^~~~~282; EMP-NEXT:            2:283; EMP-V-NEXT: empty:2     ^284; EMP-NEXT:   empty:3          X error: no match found285; EMP-NEXT:            3: world 286; EMP-NEXT:   empty:3     ~~~~~~287; EMP-NEXT:            4: label 288; EMP-V-NEXT: label:4     ^~~~~289; EMP-NEXT:   empty:3     ~~~~~290; EMP-NEXT:   >>>>>>291; EMP-NOT:    {{.}}292 293; Wrong-line match.294 295; RUN: echo 'hello' > %t.in296; RUN: echo 'world' >> %t.in297 298; RUN: echo 'CHECK: hello' > %t.chk299; RUN: echo 'CHECK-EMPTY:' >> %t.chk300 301; RUN: %ProtectFileCheckOutput \302; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \303; RUN: | FileCheck -match-full-lines %s -check-prefix=EMP2 \304; RUN:             -implicit-check-not='remark:'305; RUN: %ProtectFileCheckOutput \306; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \307; RUN: | FileCheck -match-full-lines %s -check-prefixes=EMP2,EMP2-V \308; RUN:             -implicit-check-not='remark:'309; RUN: %ProtectFileCheckOutput \310; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \311; RUN: | FileCheck -match-full-lines %s -check-prefixes=EMP2,EMP2-V,EMP2-VV \312; RUN:             -implicit-check-not='remark:' -allow-unused-prefixes313 314; Verbose diagnostics are suppressed but not errors.315; EMP2: {{.*}}error:{{.*}}316 317; EMP2:        <<<<<<318; EMP2-NEXT:            1: hello 319; EMP2-V-NEXT: check:1     ^~~~~320; EMP2-NEXT:            2: world 321; EMP2-NEXT:            3:322; EMP2-NEXT:   empty:2     !      error: match on wrong line323; EMP2-NEXT:   >>>>>>324; EMP2-NOT:    {{.}}325 326;--------------------------------------------------327; CHECK-NOT (also: EOF pattern, and multiline range that ends before EOL)328;--------------------------------------------------329 330; No match (success) and unexpected match (error).331 332; RUN: echo 'hello' > %t.in333; RUN: echo 'world' >> %t.in334; RUN: echo 'again' >> %t.in335 336; RUN: echo 'CHECK-NOT: goodbye' > %t.chk337; RUN: echo 'CHECK-NOT: world' >> %t.chk338 339; RUN: %ProtectFileCheckOutput \340; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \341; RUN: | FileCheck -match-full-lines %s -check-prefix=NOT \342; RUN:             -implicit-check-not='remark:'343; RUN: %ProtectFileCheckOutput \344; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \345; RUN: | FileCheck -match-full-lines %s -check-prefixes=NOT,NOT-V \346; RUN:             -implicit-check-not='remark:' -allow-unused-prefixes347; RUN: %ProtectFileCheckOutput \348; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \349; RUN: | FileCheck -match-full-lines %s -check-prefixes=NOT,NOT-V,NOT-VV \350; RUN:             -implicit-check-not='remark:' -allow-unused-prefixes351 352; Verbose diagnostics are suppressed but not errors.353; NOT: {{.*}}error:{{.*}}354 355; NOT:         <<<<<<356; NOT-NEXT:           1: hello 357; NOT-VV-NEXT: not:1     X~~~~~358; NOT-NEXT:           2: world 359; NOT-VV-NEXT: not:1     ~~~~~~360; NOT-NEXT:    not:2     !~~~~  error: no match expected361; NOT-NEXT:           3: again 362; NOT-VV-NEXT: not:1     ~~~~~~363; NOT-VV-NEXT:        4:364; NOT-VV-NEXT: eof:2     ^365; NOT-NEXT:    >>>>>>366; NOT-NOT:     {{.}}367 368; Again, but with a CHECK instead of EOF as search range end.369 370; RUN: echo 'CHECK: ain' >> %t.chk371 372; RUN: %ProtectFileCheckOutput \373; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \374; RUN: | FileCheck -match-full-lines %s -check-prefix=NOT2 \375; RUN:             -implicit-check-not='remark:'376; RUN: %ProtectFileCheckOutput \377; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \378; RUN: | FileCheck -match-full-lines %s -check-prefixes=NOT2,NOT2-V \379; RUN:             -implicit-check-not='remark:'380; RUN: %ProtectFileCheckOutput \381; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \382; RUN: | FileCheck -match-full-lines %s -check-prefixes=NOT2,NOT2-V,NOT2-VV \383; RUN:             -implicit-check-not='remark:'384 385; Verbose diagnostics are suppressed but not errors.386; NOT2: {{.*}}error:{{.*}}387 388; NOT2:         <<<<<<389; NOT2-NEXT:             1: hello 390; NOT2-VV-NEXT: not:1       X~~~~~391; NOT2-NEXT:             2: world 392; NOT2-VV-NEXT: not:1       ~~~~~~393; NOT2-NEXT:    not:2       !~~~~  error: no match expected394; NOT2-NEXT:             3: again 395; NOT2-V-NEXT:  check:3       ^~~396; NOT2-VV-NEXT: not:1       ~~397; NOT2-NEXT:    >>>>>>398; NOT2-NOT:     {{.}}399 400;--------------------------------------------------401; CHECK-DAG (also: matches in different order than directives, discarded match)402;--------------------------------------------------403 404; Good match, discarded match plus good match, and no match.405 406; RUN: echo 'abc' > %t.in407; RUN: echo 'def' >> %t.in408; RUN: echo 'abc' >> %t.in409 410; RUN: echo 'CHECK-DAG: def' > %t.chk411; RUN: echo 'CHECK-DAG: abc' >> %t.chk412; RUN: echo 'CHECK-DAG: abc' >> %t.chk413; RUN: echo 'CHECK-DAG: def' >> %t.chk414 415; Prefixes used here:416; DAG    = quiet, -v, or -vv417; DAG-Q  = quiet418; DAG-V  = -v or -vv (-vv implies -v)419; DAG-VQ = -v and not -vv420; DAG-VV = -vv421 422; RUN: %ProtectFileCheckOutput \423; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \424; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG,DAG-Q \425; RUN:             -implicit-check-not='remark:'426; RUN: %ProtectFileCheckOutput \427; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \428; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG,DAG-V,DAG-VQ \429; RUN:             -implicit-check-not='remark:'430; RUN: %ProtectFileCheckOutput \431; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \432; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG,DAG-V,DAG-VV \433; RUN:             -implicit-check-not='remark:'434 435; Verbose diagnostics are suppressed but not errors.436; DAG: {{.*}}error:{{.*}}437 438; DAG:         <<<<<<439; DAG-NEXT:             1: abc 440; DAG-V-NEXT:  dag:2       ^~~441; DAG-VV-NEXT: dag:3'0     !~~  discard: overlaps earlier match442; DAG-NEXT:             2: def 443; DAG-V-NEXT:  dag:1       ^~~444; DAG-VV-NEXT: dag:4'0     !~~  discard: overlaps earlier match445; DAG-Q-NEXT:  dag:4          X error: no match found446; DAG-VQ-NEXT: dag:4          X error: no match found447; DAG-VV-NEXT: dag:4'1        X error: no match found448; DAG-NEXT:             3: abc 449; DAG-VQ-NEXT: dag:3       ^~~450; DAG-VV-NEXT: dag:3'1     ^~~451; DAG-Q-NEXT:  dag:4       ~~~~452; DAG-VQ-NEXT: dag:4       ~~~~453; DAG-VV-NEXT: dag:4'1     ~~~~454; DAG-NEXT:    >>>>>>455; DAG-NOT:     {{.}}456 457; Check sorting of annotations when the order of diagnostics across an input458; line is different than the order of the associated directives in the check459; file.  Try cases when diagnostics' input ranges overlap but are not460; identical to check how that affects sorting.461 462; RUN: echo 'abc def abc def' > %t.in463 464; RUN: echo 'CHECK-DAG: def' > %t.chk465; RUN: echo 'CHECK-DAG: bc' >> %t.chk466; RUN: echo 'CHECK-DAG: abc' >> %t.chk467; RUN: echo 'CHECK-DAG: de' >> %t.chk468; RUN: echo 'CHECK-DAG: def' >> %t.chk469 470; RUN: %ProtectFileCheckOutput \471; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \472; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG1L,DAG1L-Q \473; RUN:             -implicit-check-not='remark:'474; RUN: %ProtectFileCheckOutput \475; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \476; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG1L,DAG1L-V,DAG1L-VQ \477; RUN:             -implicit-check-not='remark:'478; RUN: %ProtectFileCheckOutput \479; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \480; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG1L,DAG1L-V,DAG1L-VV \481; RUN:             -implicit-check-not='remark:'482 483; Verbose diagnostics are suppressed but not errors.484; DAG1L:{{.*}}error:{{.*}}485 486;         DAG1L:<<<<<<487;    DAG1L-NEXT:         1: abc def abc def 488;  DAG1L-V-NEXT:dag:1           ^~~489;  DAG1L-V-NEXT:dag:2        ^~490; DAG1L-VV-NEXT:dag:3'0     !~~              discard: overlaps earlier match491; DAG1L-VQ-NEXT:dag:3               ^~~492; DAG1L-VV-NEXT:dag:3'1             ^~~493; DAG1L-VV-NEXT:dag:4'0         !~           discard: overlaps earlier match494; DAG1L-VQ-NEXT:dag:4                   ^~495; DAG1L-VV-NEXT:dag:4'1                 ^~496; DAG1L-VV-NEXT:dag:5'0         !~~          discard: overlaps earlier match497; DAG1L-VV-NEXT:dag:5'1                 !~~  discard: overlaps earlier match498;  DAG1L-Q-NEXT:dag:5                     X~ error: no match found499; DAG1L-VQ-NEXT:dag:5                     X~ error: no match found500; DAG1L-VV-NEXT:dag:5'2                   X~ error: no match found501;    DAG1L-NEXT:>>>>>>502;     DAG1L-NOT:{{.}}503 504;--------------------------------------------------505; CHECK-LABEL506;507; Each CHECK-LABEL is processed twice: once before other patterns in the508; preceding section, and once afterward.509;510; As expected, the search range for a negative pattern preceding a CHECK-LABEL511; ends at the start of the CHECK-LABEL match.  not:7 and not:11 below512; demonstrate this behavior.513;514; The search range for a positive pattern preceding a CHECK-LABEL ends at the515; end of the CHECK-LABEL match.  check:3 and check:5 below demonstrate this516; behavior.  As in the case of check:5, an effect of this behavior is that the517; second CHECK-LABEL match might fail even though the first succeeded.518;519; FIXME: It seems like the search range for such a positive pattern should be520; the same as in the case of a negative pattern.  Note that -dump-input is521; correct here.  It's the matching behavior that's strange.522;--------------------------------------------------523 524; RUN: echo 'text'   >  %t.in525; RUN: echo 'labelA' >> %t.in526; RUN: echo 'textA'  >> %t.in527; RUN: echo 'labelB' >> %t.in528; RUN: echo 'textB'  >> %t.in529; RUN: echo 'labelC' >> %t.in530; RUN: echo 'textC'  >> %t.in531; RUN: echo 'labelD' >> %t.in532; RUN: echo 'textD'  >> %t.in533; RUN: echo 'labelE' >> %t.in534; RUN: echo 'textE'  >> %t.in535; RUN: echo 'labelF' >> %t.in536 537; RUN: echo 'CHECK: text'         >  %t.chk538; RUN: echo 'CHECK-LABEL: labelA' >> %t.chk539; RUN: echo 'CHECK: foobar'       >> %t.chk540; RUN: echo 'CHECK-LABEL: labelB' >> %t.chk541; RUN: echo 'CHECK: labelC'       >> %t.chk542; RUN: echo 'CHECK-LABEL: labelC' >> %t.chk543; RUN: echo 'CHECK-NOT: foobar'   >> %t.chk544; RUN: echo 'CHECK-LABEL: labelD' >> %t.chk545; RUN: echo 'CHECK-NOT: textD'    >> %t.chk546; RUN: echo 'CHECK-LABEL: labelE' >> %t.chk547; RUN: echo 'CHECK-NOT: labelF'   >> %t.chk548; RUN: echo 'CHECK-LABEL: labelF' >> %t.chk549 550; RUN: %ProtectFileCheckOutput \551; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \552; RUN: | FileCheck -match-full-lines %s -check-prefixes=LAB,LAB-Q \553; RUN:             -implicit-check-not='{{remark:|error:}}'554; RUN: %ProtectFileCheckOutput \555; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \556; RUN: | FileCheck -match-full-lines %s -check-prefixes=LAB,LAB-V \557; RUN:             -implicit-check-not='{{remark:|error:}}'558; RUN: %ProtectFileCheckOutput \559; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \560; RUN: | FileCheck -match-full-lines %s -check-prefixes=LAB,LAB-V,LAB-VV \561; RUN:             -implicit-check-not='{{remark:|error:}}'562 563; Verbose diagnostics are suppressed but not errors.564; LAB:{{.*}}.chk:3:8: error: CHECK: expected string not found in input565; LAB:{{.*}}.chk:6:14: error: CHECK-LABEL: expected string not found in input566; LAB:{{.*}}.chk:9:12: error: CHECK-NOT: excluded string found in input567 568;         LAB:<<<<<<569;    LAB-NEXT:            1: text 570;  LAB-V-NEXT:check:1        ^~~~571;    LAB-NEXT:            2: labelA 572;  LAB-V-NEXT:label:2'0      ^~~~~~573;  LAB-V-NEXT:label:2'1      ^~~~~~574;    LAB-NEXT:check:3              X error: no match found575;    LAB-NEXT:            3: textA 576;    LAB-NEXT:check:3        ~~~~~~577;    LAB-NEXT:            4: labelB 578;  LAB-V-NEXT:label:4        ^~~~~~579;    LAB-NEXT:check:3        ~~~~~~580;    LAB-NEXT:            5: textB 581;    LAB-NEXT:            6: labelC 582;  LAB-V-NEXT:label:6'0      ^~~~~~583;  LAB-V-NEXT:check:5        ^~~~~~584;  LAB-Q-NEXT:label:6              X error: no match found585;  LAB-V-NEXT:label:6'1            X error: no match found586; LAB-VV-NEXT:not:7                X587;    LAB-NEXT:            7: textC 588; LAB-VV-NEXT:not:7          ~~~~~~589;    LAB-NEXT:            8: labelD 590;  LAB-V-NEXT:label:8'0      ^~~~~~591;  LAB-V-NEXT:label:8'1      ^~~~~~592;    LAB-NEXT:            9: textD 593;    LAB-NEXT:not:9          !~~~~  error: no match expected594;    LAB-NEXT:           10: labelE 595;  LAB-V-NEXT:label:10'0     ^~~~~~596;  LAB-V-NEXT:label:10'1     ^~~~~~597; LAB-VV-NEXT:not:11               X598;    LAB-NEXT:           11: textE 599; LAB-VV-NEXT:not:11         ~~~~~~600;    LAB-NEXT:           12: labelF 601;  LAB-V-NEXT:label:12'0     ^~~~~~602;  LAB-V-NEXT:label:12'1     ^~~~~~603;    LAB-NEXT:>>>>>>604;     LAB-NOT:{{.}}605 606;--------------------------------------------------607; --implicit-check-not608;609; The first two --implicit-check-not patterns have no match (success).  The610; third has an unexpected match (error).  To check per-input-line annotation611; sorting, all of those plus the CHECK directives have annotations on the same612; input line.613;--------------------------------------------------614 615; RUN: echo 'hello world again!' > %t.in616 617; RUN: echo 'CHECK: hel' > %t.chk618; RUN: echo 'CHECK: wor' >> %t.chk619; RUN: echo 'CHECK: !' >> %t.chk620 621; Prefixes used here:622; IMPNOT    = quiet, -v, or -vv623; IMPNOT-Q  = quiet624; IMPNOT-V  = -v or -vv (-vv implies -v)625; IMPNOT-VQ = -v and not -vv626; IMPNOT-VV = -vv627 628; RUN: %ProtectFileCheckOutput \629; RUN: not FileCheck -dump-input=always -input-file=%t.in %t.chk 2>&1 \630; RUN:               --implicit-check-not='goodbye' \631; RUN:               --implicit-check-not='world' \632; RUN:               --implicit-check-not='again' \633; RUN: | FileCheck -match-full-lines %s -check-prefixes=IMPNOT,IMPNOT-Q \634; RUN:             -implicit-check-not='{{remark:|error:}}'635; RUN: %ProtectFileCheckOutput \636; RUN: not FileCheck -dump-input=always -input-file=%t.in %t.chk -v 2>&1 \637; RUN:               --implicit-check-not='goodbye' \638; RUN:               --implicit-check-not='world' \639; RUN:               --implicit-check-not='again' \640; RUN: | FileCheck -match-full-lines %s \641; RUN:             -check-prefixes=IMPNOT,IMPNOT-V,IMPNOT-VQ \642; RUN:             -implicit-check-not='{{remark:|error:}}'643; RUN: %ProtectFileCheckOutput \644; RUN: not FileCheck -dump-input=always -input-file=%t.in %t.chk -vv 2>&1 \645; RUN:               --implicit-check-not='goodbye' \646; RUN:               --implicit-check-not='world' \647; RUN:               --implicit-check-not='again' \648; RUN: | FileCheck -match-full-lines %s \649; RUN:             -check-prefixes=IMPNOT,IMPNOT-V,IMPNOT-VV \650; RUN:             -implicit-check-not='{{remark:|error:}}'651 652; Verbose diagnostics are suppressed but not errors.653; IMPNOT:{{.*}}command line:1:22: error: IMPLICIT-CHECK-NOT: excluded string found in input654 655;         IMPNOT:<<<<<<656;    IMPNOT-NEXT:            1: hello world again! 657;  IMPNOT-V-NEXT:check:1        ^~~658; IMPNOT-VV-NEXT:not:imp1'0     X659; IMPNOT-VV-NEXT:not:imp2'0     X660; IMPNOT-VV-NEXT:not:imp3'0     X661;  IMPNOT-V-NEXT:check:2              ^~~662; IMPNOT-VV-NEXT:not:imp1'1        X~~663; IMPNOT-VV-NEXT:not:imp2'1        X~~664; IMPNOT-VV-NEXT:not:imp3'1        X~~665;  IMPNOT-V-NEXT:check:3                         ^666; IMPNOT-VV-NEXT:not:imp1'2              X~~~~~~~667; IMPNOT-VV-NEXT:not:imp2'2              X~~~~~~~668;  IMPNOT-Q-NEXT:not:imp3                   !~~~~   error: no match expected669; IMPNOT-VQ-NEXT:not:imp3                   !~~~~   error: no match expected670; IMPNOT-VV-NEXT:not:imp3'2                 !~~~~   error: no match expected671;    IMPNOT-NEXT:>>>>>>672;     IMPNOT-NOT:{{.}}673 674;--------------------------------------------------675; Substitutions: successful and failed positive directives.676;--------------------------------------------------677 678; RUN: echo 'def-match1 def-match2'  >  %t.in679; RUN: echo 'def-match1 def-nomatch' >> %t.in680 681; RUN: echo 'CHECK: [[DEF_MATCH1]] [[DEF_MATCH2]]'            >  %t.chk682; RUN: echo 'CHECK: [[DEF_MATCH1]] [[UNDEF]] [[DEF_NOMATCH]]' >> %t.chk683 684; RUN: %ProtectFileCheckOutput \685; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \686; RUN:               -DDEF_MATCH1=def-match1 -DDEF_MATCH2=def-match2 \687; RUN:               -DDEF_NOMATCH=foobar \688; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST-POS689 690;      SUBST-POS:<<<<<<691; SUBST-POS-NEXT:           1: def-match1 def-match2 692; SUBST-POS-NEXT:check:1'0     ^~~~~~~~~~~~~~~~~~~~~693; SUBST-POS-NEXT:check:1'1                            with "DEF_MATCH1" equal to "def-match1"694; SUBST-POS-NEXT:check:1'2                            with "DEF_MATCH2" equal to "def-match2"695; SUBST-POS-NEXT:check:2'0     X error: match failed for invalid pattern696; SUBST-POS-NEXT:check:2'1                            undefined variable: UNDEF697; SUBST-POS-NEXT:check:2'2                            with "DEF_MATCH1" equal to "def-match1"698; SUBST-POS-NEXT:check:2'3                            with "DEF_NOMATCH" equal to "foobar"699; SUBST-POS-NEXT:           2: def-match1 def-nomatch700; SUBST-POS-NEXT:check:2'0     ~~~~~~~~~~~~~~~~~~~~~~~701; SUBST-POS-NEXT:check:2'4 ? possible intended match702; SUBST-POS-NEXT:>>>>>>703 704;--------------------------------------------------705; Substitutions: successful and failed negative directives.706;--------------------------------------------------707 708; RUN: echo 'def-match1 def-nomatch' >  %t.in709; RUN: echo 'def-match1 def-match2'  >> %t.in710; RUN: echo 'END'                    >> %t.in711 712; RUN: echo 'CHECK-NOT: [[DEF_MATCH1]] [[UNDEF]] [[DEF_NOMATCH]]' >  %t.chk713; RUN: echo 'CHECK-NOT: [[DEF_MATCH1]] [[DEF_MATCH2]]'            >> %t.chk714; RUN: echo 'CHECK: END'                                          >> %t.chk715 716; RUN: %ProtectFileCheckOutput \717; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \718; RUN:               -DDEF_MATCH1=def-match1 -DDEF_MATCH2=def-match2 \719; RUN:               -DDEF_NOMATCH=foobar \720; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST-NEG721 722;      SUBST-NEG:<<<<<<723; SUBST-NEG-NEXT:         1: def-match1 def-nomatch724; SUBST-NEG-NEXT:not:1'0     X~~~~~~~~~~~~~~~~~~~~~~ error: match failed for invalid pattern725; SUBST-NEG-NEXT:not:1'1                             undefined variable: UNDEF726; SUBST-NEG-NEXT:not:1'2                             with "DEF_MATCH1" equal to "def-match1"727; SUBST-NEG-NEXT:not:1'3                             with "DEF_NOMATCH" equal to "foobar"728; SUBST-NEG-NEXT:         2: def-match1 def-match2729; SUBST-NEG-NEXT:not:1'0     ~~~~~~~~~~~~~~~~~~~~~~730; SUBST-NEG-NEXT:not:2'0     !~~~~~~~~~~~~~~~~~~~~  error: no match expected731; SUBST-NEG-NEXT:not:2'1                            with "DEF_MATCH1" equal to "def-match1"732; SUBST-NEG-NEXT:not:2'2                            with "DEF_MATCH2" equal to "def-match2"733; SUBST-NEG-NEXT:         3: END734; SUBST-NEG-NEXT:check:3     ^~~735; SUBST-NEG-NEXT:>>>>>>736 737;--------------------------------------------------738; Captured variables739;--------------------------------------------------740 741; RUN: echo 'strvar: foo'           >  %t.in742; RUN: echo 'numvar no expr: 51'    >> %t.in743; RUN: echo 'numvar expr: -49'      >> %t.in744; RUN: echo 'many: foo 100 8 bar'   >> %t.in745; RUN: echo 'var in neg match: foo' >> %t.in746; RUN: echo 'END'                   >> %t.in747 748; RUN: echo 'CHECK: strvar: [[STRVAR:[a-z]+]]'                         >  %t.chk749; RUN: echo 'CHECK: numvar no expr: [[#NUMVAR_NO_EXPR:]]'              >> %t.chk750; RUN: echo 'CHECK: numvar expr: [[#%d,NUMVAR_EXPR:2-NUMVAR_NO_EXPR]]' >> %t.chk751 752; Capture many variables of different kinds in a different order than their753; names sort alphabetically to ensure they're sorted in capture order.754; RUN: echo 'CHECK: many: [[VAR1:foo]] [[#%d,VAR3:]] [[#VAR2:]] [[VAR4:bar]]' \755; RUN:      >> %t.chk756 757; RUN: echo 'CHECK-NOT: var in neg match: [[VAR:foo]]' >> %t.chk758; RUN: echo 'CHECK: END'                               >> %t.chk759 760; RUN: %ProtectFileCheckOutput \761; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \762; RUN: | FileCheck -strict-whitespace -match-full-lines %s -check-prefix=CAPTURE-NEG763 764;      CAPTURE-NEG:<<<<<<765; CAPTURE-NEG-NEXT:           1: strvar: foo 766; CAPTURE-NEG-NEXT:check:1'0     ^~~~~~~~~~~767; CAPTURE-NEG-NEXT:check:1'1             ^~~  captured var "STRVAR"768; CAPTURE-NEG-NEXT:           2: numvar no expr: 51 769; CAPTURE-NEG-NEXT:check:2'0     ^~~~~~~~~~~~~~~~~~770; CAPTURE-NEG-NEXT:check:2'1                     ^~  captured var "NUMVAR_NO_EXPR"771; CAPTURE-NEG-NEXT:           3: numvar expr: -49 772; CAPTURE-NEG-NEXT:check:3'0     ^~~~~~~~~~~~~~~~773; CAPTURE-NEG-NEXT:check:3'1                       with "%d,NUMVAR_EXPR:2-NUMVAR_NO_EXPR" equal to "-49"774; CAPTURE-NEG-NEXT:check:3'2                  ^~~  captured var "NUMVAR_EXPR"775; CAPTURE-NEG-NEXT:           4: many: foo 100 8 bar 776; CAPTURE-NEG-NEXT:check:4'0     ^~~~~~~~~~~~~~~~~~~777; CAPTURE-NEG-NEXT:check:4'1           ^~~            captured var "VAR1"778; CAPTURE-NEG-NEXT:check:4'2               ^~~        captured var "VAR3"779; CAPTURE-NEG-NEXT:check:4'3                   ^      captured var "VAR2"780; CAPTURE-NEG-NEXT:check:4'4                     ^~~  captured var "VAR4"781; CAPTURE-NEG-NEXT:           5: var in neg match: foo 782; CAPTURE-NEG-NEXT:not:5'0       !~~~~~~~~~~~~~~~~~~~~  error: no match expected783; CAPTURE-NEG-NEXT:not:5'1                         !~~  captured var "VAR"784; CAPTURE-NEG-NEXT:           6: END 785; CAPTURE-NEG-NEXT:check:6       ^~~786; CAPTURE-NEG-NEXT:>>>>>>787 788;--------------------------------------------------789; CHECK-NEXT, CHECK-SAME, CHECK-DAG note fixups.790;791; When CHECK-NEXT or CHECK-SAME fails for the wrong line, or when a CHECK-DAG792; match is discarded, the associated diagnostic type must be converted from793; successful to failed or discarded.  However, any note annotation must be794; traversed to find that diagnostic.  We check this behavior here only for795; substitutions, but it's the same mechanism for all note annotations.796;--------------------------------------------------797 798;- - - - - - - - - - - - - - - - - - - - - - - - -799; CHECK-NEXT.800;- - - - - - - - - - - - - - - - - - - - - - - - -801 802; RUN: echo 'pre var' > %t.in803 804; RUN: echo 'CHECK: pre'          >  %t.chk805; RUN: echo 'CHECK-NEXT: [[VAR]]' >> %t.chk806 807; RUN: %ProtectFileCheckOutput \808; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \809; RUN:               -DVAR=var \810; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST_NEXT811 812;      SUBST_NEXT:<<<<<<813; SUBST_NEXT-NEXT:          1: pre var 814; SUBST_NEXT-NEXT:check:1      ^~~815; SUBST_NEXT-NEXT:next:2'0         !~~  error: match on wrong line816; SUBST_NEXT-NEXT:next:2'1              with "VAR" equal to "var"817; SUBST_NEXT-NEXT:>>>>>>818 819;- - - - - - - - - - - - - - - - - - - - - - - - -820; CHECK-SAME.821;- - - - - - - - - - - - - - - - - - - - - - - - -822 823; RUN: echo 'pre' >  %t.in824; RUN: echo 'var' >> %t.in825 826; RUN: echo 'CHECK: pre'          >  %t.chk827; RUN: echo 'CHECK-SAME: [[VAR]]' >> %t.chk828 829; RUN: %ProtectFileCheckOutput \830; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \831; RUN:               -DVAR=var \832; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST_SAME833 834;      SUBST_SAME:<<<<<<835; SUBST_SAME-NEXT:          1: pre 836; SUBST_SAME-NEXT:check:1      ^~~837; SUBST_SAME-NEXT:          2: var 838; SUBST_SAME-NEXT:same:2'0     !~~  error: match on wrong line839; SUBST_SAME-NEXT:same:2'1          with "VAR" equal to "var"840; SUBST_SAME-NEXT:>>>>>>841 842;- - - - - - - - - - - - - - - - - - - - - - - - -843; CHECK-DAG.844;- - - - - - - - - - - - - - - - - - - - - - - - -845 846; RUN: echo 'var' >  %t.in847; RUN: echo 'var' >> %t.in848; RUN: echo 'END' >> %t.in849 850; RUN: echo 'CHECK-DAG: var'      >  %t.chk851; RUN: echo 'CHECK-DAG: [[VAR]]'  >> %t.chk852; RUN: echo 'CHECK: END'          >> %t.chk853 854; RUN: %ProtectFileCheckOutput \855; RUN: FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \856; RUN:           -DVAR=var \857; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST_DAG858 859;      SUBST_DAG:<<<<<<860; SUBST_DAG-NEXT:         1: var 861; SUBST_DAG-NEXT:dag:1       ^~~862; SUBST_DAG-NEXT:dag:2'0     !~~  discard: overlaps earlier match863; SUBST_DAG-NEXT:dag:2'1          with "VAR" equal to "var"864; SUBST_DAG-NEXT:         2: var 865; SUBST_DAG-NEXT:dag:2'2     ^~~866; SUBST_DAG-NEXT:dag:2'3          with "VAR" equal to "var"867; SUBST_DAG-NEXT:         3: END 868; SUBST_DAG-NEXT:check:3     ^~~869; SUBST_DAG-NEXT:>>>>>>870