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 the 6; presence, order, and lengths of markers. That way, if we ever change padding 7; within line labels, we don't have to adjust so many tests. 8;-------------------------------------------------- 9 10; RUN: echo 'hello world' > %t.in 11; RUN: echo 'goodbye' >> %t.in 12; RUN: echo 'world' >> %t.in 13; RUN: echo 'unicorn' >> %t.in 14 15; RUN: echo 'CHECK: hello' > %t.chk 16; RUN: echo 'CHECK: universe' >> %t.chk 17 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:' %s 22 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 found 32; 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 match 39; 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.in 49; RUN: echo 'again' >> %t.in 50; RUN: echo 'whirled' >> %t.in 51 52; RUN: echo 'CHECK: hello' > %t.chk 53; RUN: echo 'CHECK: world' >> %t.chk 54 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 found 76; 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 match 81; 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.in 91; RUN: echo 'repete' >> %t.in 92; RUN: echo 'repeat' >> %t.in 93 94; RUN: echo 'CHECK-COUNT-3: pete' > %t.chk 95 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 found 118; CNT-V-NEXT: count:1'2 X error: no match found 119; CNT-NEXT: 3: repeat 120; CNT-Q-NEXT: count:1'0 ~~~~~~~ 121; CNT-Q-NEXT: count:1'1 ? possible intended match 122; CNT-V-NEXT: count:1'2 ~~~~~~~ 123; CNT-V-NEXT: count:1'3 ? possible intended match 124; 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.in 134; RUN: echo 'again' >> %t.in 135 136; RUN: echo 'CHECK: hello' > %t.chk 137; RUN: echo 'CHECK-NEXT: again' >> %t.chk 138; RUN: echo 'CHECK-NEXT: world' >> %t.chk 139 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-prefixes 152 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 found 162; NXT-NEXT: >>>>>> 163; NXT-NOT: {{.}} 164 165; Wrong-line match. 166 167; RUN: echo 'yonder' >> %t.in 168; RUN: echo 'world' >> %t.in 169 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=NXT2 173 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 line 180; 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.in 191 192; RUN: echo 'CHECK: hello' > %t.chk 193; RUN: echo 'CHECK-SAME: world' >> %t.chk 194; RUN: echo 'CHECK-SAME: again' >> %t.chk 195 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-prefixes 208 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 found 217; SAM-NEXT: >>>>>> 218; SAM-NOT: {{.}} 219 220; Wrong-line match. 221 222; RUN: echo 'again' >> %t.in 223 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 line 238; SAM2-NEXT: >>>>>> 239; SAM2-NOT: {{.}} 240 241;-------------------------------------------------- 242; CHECK-EMPTY (also: search range ends at label, single-char match, wrong-line 243; 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's 249; not the next line) unless either (1) the last line is non-empty and has no 250; newline or (2) there's a CHECK-LABEL to end the search range before EOF. We 251; choose scenario 2 to check the case of no match. 252 253; RUN: echo 'hello' > %t.in 254; RUN: echo '' >> %t.in 255; RUN: echo 'world' >> %t.in 256; RUN: echo 'label' >> %t.in 257 258; RUN: echo 'CHECK: hello' > %t.chk 259; RUN: echo 'CHECK-EMPTY:' >> %t.chk 260; RUN: echo 'CHECK-EMPTY:' >> %t.chk 261; RUN: echo 'CHECK-LABEL: label' >> %t.chk 262 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-prefixes 275 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 found 285; 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.in 296; RUN: echo 'world' >> %t.in 297 298; RUN: echo 'CHECK: hello' > %t.chk 299; RUN: echo 'CHECK-EMPTY:' >> %t.chk 300 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-prefixes 313 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 line 323; 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.in 333; RUN: echo 'world' >> %t.in 334; RUN: echo 'again' >> %t.in 335 336; RUN: echo 'CHECK-NOT: goodbye' > %t.chk 337; RUN: echo 'CHECK-NOT: world' >> %t.chk 338 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-prefixes 347; 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-prefixes 351 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 expected 361; 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.chk 371 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 expected 394; 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.in 407; RUN: echo 'def' >> %t.in 408; RUN: echo 'abc' >> %t.in 409 410; RUN: echo 'CHECK-DAG: def' > %t.chk 411; RUN: echo 'CHECK-DAG: abc' >> %t.chk 412; RUN: echo 'CHECK-DAG: abc' >> %t.chk 413; RUN: echo 'CHECK-DAG: def' >> %t.chk 414 415; Prefixes used here: 416; DAG = quiet, -v, or -vv 417; DAG-Q = quiet 418; DAG-V = -v or -vv (-vv implies -v) 419; DAG-VQ = -v and not -vv 420; DAG-VV = -vv 421 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 match 442; DAG-NEXT: 2: def 443; DAG-V-NEXT: dag:1 ^~~ 444; DAG-VV-NEXT: dag:4'0 !~~ discard: overlaps earlier match 445; DAG-Q-NEXT: dag:4 X error: no match found 446; DAG-VQ-NEXT: dag:4 X error: no match found 447; DAG-VV-NEXT: dag:4'1 X error: no match found 448; 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 input 458; line is different than the order of the associated directives in the check 459; file. Try cases when diagnostics' input ranges overlap but are not 460; identical to check how that affects sorting. 461 462; RUN: echo 'abc def abc def' > %t.in 463 464; RUN: echo 'CHECK-DAG: def' > %t.chk 465; RUN: echo 'CHECK-DAG: bc' >> %t.chk 466; RUN: echo 'CHECK-DAG: abc' >> %t.chk 467; RUN: echo 'CHECK-DAG: de' >> %t.chk 468; RUN: echo 'CHECK-DAG: def' >> %t.chk 469 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 match 491; DAG1L-VQ-NEXT:dag:3 ^~~ 492; DAG1L-VV-NEXT:dag:3'1 ^~~ 493; DAG1L-VV-NEXT:dag:4'0 !~ discard: overlaps earlier match 494; DAG1L-VQ-NEXT:dag:4 ^~ 495; DAG1L-VV-NEXT:dag:4'1 ^~ 496; DAG1L-VV-NEXT:dag:5'0 !~~ discard: overlaps earlier match 497; DAG1L-VV-NEXT:dag:5'1 !~~ discard: overlaps earlier match 498; DAG1L-Q-NEXT:dag:5 X~ error: no match found 499; DAG1L-VQ-NEXT:dag:5 X~ error: no match found 500; DAG1L-VV-NEXT:dag:5'2 X~ error: no match found 501; DAG1L-NEXT:>>>>>> 502; DAG1L-NOT:{{.}} 503 504;-------------------------------------------------- 505; CHECK-LABEL 506; 507; FIXME: Labels sometimes produce redundant diagnostics for good matches. 508; That bug is independent of but affects -dump-input. 509;-------------------------------------------------- 510 511; Good match and no match. 512 513; RUN: echo 'lab0' > %t.in 514; RUN: echo 'foo' >> %t.in 515; RUN: echo 'lab1' >> %t.in 516; RUN: echo 'bar' >> %t.in 517 518; RUN: echo 'CHECK-LABEL: lab0' > %t.chk 519; RUN: echo 'CHECK: foo' >> %t.chk 520; RUN: echo 'CHECK-LABEL: lab2' >> %t.chk 521 522; RUN: %ProtectFileCheckOutput \ 523; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \ 524; RUN: | FileCheck -match-full-lines %s -check-prefixes=LAB \ 525; RUN: -implicit-check-not='remark:' 526; RUN: %ProtectFileCheckOutput \ 527; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \ 528; RUN: | FileCheck -match-full-lines %s -check-prefixes=LAB,LAB-V \ 529; RUN: -implicit-check-not='remark:' 530; RUN: %ProtectFileCheckOutput \ 531; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \ 532; RUN: | FileCheck -match-full-lines %s -check-prefixes=LAB,LAB-V,LAB-VV \ 533; RUN: -implicit-check-not='remark:' -allow-unused-prefixes 534 535; Verbose diagnostics are suppressed but not errors. 536; LAB: {{.*}}error:{{.*}} 537; LAB: {{.*}}possible intended match{{.*}} 538 539; LAB: <<<<<< 540; LAB-NEXT: 1: lab0 541; LAB-V-NEXT: label:1'0 ^~~~ 542; LAB-V-NEXT: label:1'1 ^~~~ 543; LAB-NEXT: label:3'0 X error: no match found 544; LAB-NEXT: 2: foo 545; LAB-NEXT: label:3'0 ~~~~ 546; LAB-NEXT: 3: lab1 547; LAB-NEXT: label:3'0 ~~~~~ 548; LAB-NEXT: label:3'1 ? possible intended match 549; LAB-NEXT: 4: bar 550; LAB-NEXT: label:3'0 ~~~~ 551; LAB-NEXT: >>>>>> 552; LAB-NOT: {{.}} 553 554;-------------------------------------------------- 555; --implicit-check-not 556; 557; The first two --implicit-check-not patterns have no match (success). The 558; third has an unexpected match (error). To check per-input-line annotation 559; sorting, all of those plus the CHECK directives have annotations on the same 560; input line. 561;-------------------------------------------------- 562 563; RUN: echo 'hello world again!' > %t.in 564 565; RUN: echo 'CHECK: hel' > %t.chk 566; RUN: echo 'CHECK: wor' >> %t.chk 567; RUN: echo 'CHECK: !' >> %t.chk 568 569; RUN: %ProtectFileCheckOutput \ 570; RUN: not FileCheck -dump-input=always -input-file=%t.in %t.chk 2>&1 \ 571; RUN: --implicit-check-not='goodbye' \ 572; RUN: --implicit-check-not='world' \ 573; RUN: --implicit-check-not='again' \ 574; RUN: | FileCheck -match-full-lines %s -check-prefix=IMPNOT \ 575; RUN: -implicit-check-not='remark:' 576; RUN: %ProtectFileCheckOutput \ 577; RUN: not FileCheck -dump-input=always -input-file=%t.in %t.chk -v 2>&1 \ 578; RUN: --implicit-check-not='goodbye' \ 579; RUN: --implicit-check-not='world' \ 580; RUN: --implicit-check-not='again' \ 581; RUN: | FileCheck -match-full-lines %s -check-prefixes=IMPNOT,IMPNOT-V \ 582; RUN: -implicit-check-not='remark:' 583; RUN: %ProtectFileCheckOutput \ 584; RUN: not FileCheck -dump-input=always -input-file=%t.in %t.chk -vv 2>&1 \ 585; RUN: --implicit-check-not='goodbye' \ 586; RUN: --implicit-check-not='world' \ 587; RUN: --implicit-check-not='again' \ 588; RUN: | FileCheck -match-full-lines %s \ 589; RUN: -check-prefixes=IMPNOT,IMPNOT-V,IMPNOT-VV \ 590; RUN: -implicit-check-not='remark:' 591 592; Verbose diagnostics are suppressed but not errors. 593; IMPNOT:{{.*}}error:{{.*}} 594 595; IMPNOT:<<<<<< 596; IMPNOT-NEXT: 1: hello world again! 597; IMPNOT-V-NEXT:check:1 ^~~ 598; IMPNOT-VV-NEXT:not:imp1 X 599; IMPNOT-VV-NEXT:not:imp2 X 600; IMPNOT-VV-NEXT:not:imp3 X 601; IMPNOT-V-NEXT:check:2 ^~~ 602; IMPNOT-VV-NEXT:not:imp1 X~~ 603; IMPNOT-VV-NEXT:not:imp2 X~~ 604; IMPNOT-VV-NEXT:not:imp3 X~~ 605; IMPNOT-V-NEXT:check:3 ^ 606; IMPNOT-VV-NEXT:not:imp1 X~~~~~~~ 607; IMPNOT-VV-NEXT:not:imp2 X~~~~~~~ 608; IMPNOT-NEXT:not:imp3 !~~~~ error: no match expected 609; IMPNOT-NEXT:>>>>>> 610; IMPNOT-NOT:{{.}} 611 612;-------------------------------------------------- 613; Substitutions: successful and failed positive directives. 614;-------------------------------------------------- 615 616; RUN: echo 'def-match1 def-match2' > %t.in 617; RUN: echo 'def-match1 def-nomatch' >> %t.in 618 619; RUN: echo 'CHECK: [[DEF_MATCH1]] [[DEF_MATCH2]]' > %t.chk 620; RUN: echo 'CHECK: [[DEF_MATCH1]] [[UNDEF]] [[DEF_NOMATCH]]' >> %t.chk 621 622; RUN: %ProtectFileCheckOutput \ 623; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \ 624; RUN: -DDEF_MATCH1=def-match1 -DDEF_MATCH2=def-match2 \ 625; RUN: -DDEF_NOMATCH=foobar \ 626; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST-POS 627 628; SUBST-POS:<<<<<< 629; SUBST-POS-NEXT: 1: def-match1 def-match2 630; SUBST-POS-NEXT:check:1'0 ^~~~~~~~~~~~~~~~~~~~~ 631; SUBST-POS-NEXT:check:1'1 with "DEF_MATCH1" equal to "def-match1" 632; SUBST-POS-NEXT:check:1'2 with "DEF_MATCH2" equal to "def-match2" 633; SUBST-POS-NEXT:check:2'0 X error: no match found 634; SUBST-POS-NEXT:check:2'1 with "DEF_MATCH1" equal to "def-match1" 635; SUBST-POS-NEXT:check:2'2 uses undefined variable(s): "UNDEF" 636; SUBST-POS-NEXT:check:2'3 with "DEF_NOMATCH" equal to "foobar" 637; SUBST-POS-NEXT: 2: def-match1 def-nomatch 638; SUBST-POS-NEXT:check:2'0 ~~~~~~~~~~~~~~~~~~~~~~~ 639; SUBST-POS-NEXT:check:2'4 ? possible intended match 640; SUBST-POS-NEXT:>>>>>> 641 642;-------------------------------------------------- 643; Substitutions: successful and failed negative directives. 644; 645; FIXME: The first CHECK-NOT directive below uses an undefined variable. 646; Because it therefore cannot match regardless of the input, the directive 647; succeeds. However, it should fail in this case. Update the example below 648; once that's fixed. 649;-------------------------------------------------- 650 651; RUN: echo 'def-match1 def-nomatch' > %t.in 652; RUN: echo 'def-match1 def-match2' >> %t.in 653; RUN: echo 'END' >> %t.in 654 655; RUN: echo 'CHECK-NOT: [[DEF_MATCH1]] [[UNDEF]] [[DEF_NOMATCH]]' > %t.chk 656; RUN: echo 'CHECK-NOT: [[DEF_MATCH1]] [[DEF_MATCH2]]' >> %t.chk 657; RUN: echo 'CHECK: END' >> %t.chk 658 659; RUN: %ProtectFileCheckOutput \ 660; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \ 661; RUN: -DDEF_MATCH1=def-match1 -DDEF_MATCH2=def-match2 \ 662; RUN: -DDEF_NOMATCH=foobar \ 663; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST-NEG 664 665; SUBST-NEG:<<<<<< 666; SUBST-NEG-NEXT: 1: def-match1 def-nomatch 667; SUBST-NEG-NEXT:not:1'0 X~~~~~~~~~~~~~~~~~~~~~~ 668; SUBST-NEG-NEXT:not:1'1 with "DEF_MATCH1" equal to "def-match1" 669; SUBST-NEG-NEXT:not:1'2 uses undefined variable(s): "UNDEF" 670; SUBST-NEG-NEXT:not:1'3 with "DEF_NOMATCH" equal to "foobar" 671; SUBST-NEG-NEXT: 2: def-match1 def-match2 672; SUBST-NEG-NEXT:not:1'0 ~~~~~~~~~~~~~~~~~~~~~~ 673; SUBST-NEG-NEXT:not:2'0 !~~~~~~~~~~~~~~~~~~~~ error: no match expected 674; SUBST-NEG-NEXT:not:2'1 with "DEF_MATCH1" equal to "def-match1" 675; SUBST-NEG-NEXT:not:2'2 with "DEF_MATCH2" equal to "def-match2" 676; SUBST-NEG-NEXT: 3: END 677; SUBST-NEG-NEXT:check:3 ^~~ 678; SUBST-NEG-NEXT:>>>>>> 679 680;-------------------------------------------------- 681; Captured variables 682;-------------------------------------------------- 683 684; RUN: echo 'strvar: foo' > %t.in 685; RUN: echo 'numvar no expr: 51' >> %t.in 686; RUN: echo 'numvar expr: -49' >> %t.in 687; RUN: echo 'many: foo 100 8 bar' >> %t.in 688; RUN: echo 'var in neg match: foo' >> %t.in 689; RUN: echo 'END' >> %t.in 690 691; RUN: echo 'CHECK: strvar: [[STRVAR:[a-z]+]]' > %t.chk 692; RUN: echo 'CHECK: numvar no expr: [[#NUMVAR_NO_EXPR:]]' >> %t.chk 693; RUN: echo 'CHECK: numvar expr: [[#%d,NUMVAR_EXPR:2-NUMVAR_NO_EXPR]]' >> %t.chk 694 695; Capture many variables of different kinds in a different order than their 696; names sort alphabetically to ensure they're sorted in capture order. 697; RUN: echo 'CHECK: many: [[VAR1:foo]] [[#%d,VAR3:]] [[#VAR2:]] [[VAR4:bar]]' \ 698; RUN: >> %t.chk 699 700; RUN: echo 'CHECK-NOT: var in neg match: [[VAR:foo]]' >> %t.chk 701; RUN: echo 'CHECK: END' >> %t.chk 702 703; RUN: %ProtectFileCheckOutput \ 704; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \ 705; RUN: | FileCheck -strict-whitespace -match-full-lines %s -check-prefix=CAPTURE-NEG 706 707; CAPTURE-NEG:<<<<<< 708; CAPTURE-NEG-NEXT: 1: strvar: foo 709; CAPTURE-NEG-NEXT:check:1'0 ^~~~~~~~~~~ 710; CAPTURE-NEG-NEXT:check:1'1 ^~~ captured var "STRVAR" 711; CAPTURE-NEG-NEXT: 2: numvar no expr: 51 712; CAPTURE-NEG-NEXT:check:2'0 ^~~~~~~~~~~~~~~~~~ 713; CAPTURE-NEG-NEXT:check:2'1 ^~ captured var "NUMVAR_NO_EXPR" 714; CAPTURE-NEG-NEXT: 3: numvar expr: -49 715; CAPTURE-NEG-NEXT:check:3'0 ^~~~~~~~~~~~~~~~ 716; CAPTURE-NEG-NEXT:check:3'1 with "%d,NUMVAR_EXPR:2-NUMVAR_NO_EXPR" equal to "-49" 717; CAPTURE-NEG-NEXT:check:3'2 ^~~ captured var "NUMVAR_EXPR" 718; CAPTURE-NEG-NEXT: 4: many: foo 100 8 bar 719; CAPTURE-NEG-NEXT:check:4'0 ^~~~~~~~~~~~~~~~~~~ 720; CAPTURE-NEG-NEXT:check:4'1 ^~~ captured var "VAR1" 721; CAPTURE-NEG-NEXT:check:4'2 ^~~ captured var "VAR3" 722; CAPTURE-NEG-NEXT:check:4'3 ^ captured var "VAR2" 723; CAPTURE-NEG-NEXT:check:4'4 ^~~ captured var "VAR4" 724; CAPTURE-NEG-NEXT: 5: var in neg match: foo 725; CAPTURE-NEG-NEXT:not:5'0 !~~~~~~~~~~~~~~~~~~~~ error: no match expected 726; CAPTURE-NEG-NEXT:not:5'1 !~~ captured var "VAR" 727; CAPTURE-NEG-NEXT: 6: END 728; CAPTURE-NEG-NEXT:check:6 ^~~ 729; CAPTURE-NEG-NEXT:>>>>>> 730 731;-------------------------------------------------- 732; CHECK-NEXT, CHECK-SAME, CHECK-DAG note fixups. 733; 734; When CHECK-NEXT or CHECK-SAME fails for the wrong line, or when a CHECK-DAG 735; match is discarded, the associated diagnostic type must be converted from 736; successful to failed or discarded. However, any note annotation must be 737; traversed to find that diagnostic. We check this behavior here only for 738; substitutions, but it's the same mechanism for all note annotations. 739;-------------------------------------------------- 740 741;- - - - - - - - - - - - - - - - - - - - - - - - - 742; CHECK-NEXT. 743;- - - - - - - - - - - - - - - - - - - - - - - - - 744 745; RUN: echo 'pre var' > %t.in 746 747; RUN: echo 'CHECK: pre' > %t.chk 748; RUN: echo 'CHECK-NEXT: [[VAR]]' >> %t.chk 749 750; RUN: %ProtectFileCheckOutput \ 751; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \ 752; RUN: -DVAR=var \ 753; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST_NEXT 754 755; SUBST_NEXT:<<<<<< 756; SUBST_NEXT-NEXT: 1: pre var 757; SUBST_NEXT-NEXT:check:1 ^~~ 758; SUBST_NEXT-NEXT:next:2'0 !~~ error: match on wrong line 759; SUBST_NEXT-NEXT:next:2'1 with "VAR" equal to "var" 760; SUBST_NEXT-NEXT:>>>>>> 761 762;- - - - - - - - - - - - - - - - - - - - - - - - - 763; CHECK-SAME. 764;- - - - - - - - - - - - - - - - - - - - - - - - - 765 766; RUN: echo 'pre' > %t.in 767; RUN: echo 'var' >> %t.in 768 769; RUN: echo 'CHECK: pre' > %t.chk 770; RUN: echo 'CHECK-SAME: [[VAR]]' >> %t.chk 771 772; RUN: %ProtectFileCheckOutput \ 773; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \ 774; RUN: -DVAR=var \ 775; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST_SAME 776 777; SUBST_SAME:<<<<<< 778; SUBST_SAME-NEXT: 1: pre 779; SUBST_SAME-NEXT:check:1 ^~~ 780; SUBST_SAME-NEXT: 2: var 781; SUBST_SAME-NEXT:same:2'0 !~~ error: match on wrong line 782; SUBST_SAME-NEXT:same:2'1 with "VAR" equal to "var" 783; SUBST_SAME-NEXT:>>>>>> 784 785;- - - - - - - - - - - - - - - - - - - - - - - - - 786; CHECK-DAG. 787;- - - - - - - - - - - - - - - - - - - - - - - - - 788 789; RUN: echo 'var' > %t.in 790; RUN: echo 'var' >> %t.in 791; RUN: echo 'END' >> %t.in 792 793; RUN: echo 'CHECK-DAG: var' > %t.chk 794; RUN: echo 'CHECK-DAG: [[VAR]]' >> %t.chk 795; RUN: echo 'CHECK: END' >> %t.chk 796 797; RUN: %ProtectFileCheckOutput \ 798; RUN: FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \ 799; RUN: -DVAR=var \ 800; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST_DAG 801 802; SUBST_DAG:<<<<<< 803; SUBST_DAG-NEXT: 1: var 804; SUBST_DAG-NEXT:dag:1 ^~~ 805; SUBST_DAG-NEXT:dag:2'0 !~~ discard: overlaps earlier match 806; SUBST_DAG-NEXT:dag:2'1 with "VAR" equal to "var" 807; SUBST_DAG-NEXT: 2: var 808; SUBST_DAG-NEXT:dag:2'2 ^~~ 809; SUBST_DAG-NEXT:dag:2'3 with "VAR" equal to "var" 810; SUBST_DAG-NEXT: 3: END 811; SUBST_DAG-NEXT:check:3 ^~~ 812; SUBST_DAG-NEXT:>>>>>> 813