https://github.com/jdenny-ornl updated https://github.com/llvm/llvm-project/pull/198137
>From 2b7c4d04afabd18b0f84bbea9294935bc84e5657 Mon Sep 17 00:00:00 2001 From: "Joel E. Denny" <[email protected]> Date: Sat, 16 May 2026 20:14:44 -0400 Subject: [PATCH] [FileCheck] Refactor -dump-input test This patch refactors `llvm/test/FileCheck/dump-input/annotations.txt` to improve maintainability and coverage and to prepare for the upcoming implementation of search range annotations. Lit substitutions ================= The test repeats the same basic set of RUN lines *many* times. This patch encapsulates those in lit substitutions to improve maintainability. By doing so, it also helps to ensure more consistent coverage of all cases and thus slightly expands coverage. -strict-whitespace ================== Via those substitutions, this patch adds `-strict-whitespace` throughout the test, and it drops the initial `-strict-whitespace` case because it is then redundant. That causes many whitespace changes throughout the test, so this patch is easier to read with `git diff -w`. When I originally wrote the test, I thought maintaining it would be too painful with `-strict-whitespace`. However, I now think it is important for usability to thoroughly check that annotations are correctly aligned with the input, especially given the upcoming search range annotations. -dump-input-label-width ======================= To address that anticipated maintenance pain, and to make the above change easier to implement, this patch also implements a new hidden FileCheck option, `-dump-input-label-width`. It enables tests like this one not to have to fuss with fluctuations in the label column width that are caused when varying the verbosity options. I do not anticipate this option will be used outside FileCheck's own test suite. Splitting directive blocks ========================== To improve readability, this patch splits apart directive blocks where the same annotations appear multiple times with small differences at different verbosity levels. See new header comments for details. --- .../test/FileCheck/dump-input/annotations.txt | 1123 +++++++++-------- llvm/utils/FileCheck/FileCheck.cpp | 11 + 2 files changed, 614 insertions(+), 520 deletions(-) diff --git a/llvm/test/FileCheck/dump-input/annotations.txt b/llvm/test/FileCheck/dump-input/annotations.txt index 367ea3377e6ae..f928f3c3eaada 100644 --- a/llvm/test/FileCheck/dump-input/annotations.txt +++ b/llvm/test/FileCheck/dump-input/annotations.txt @@ -1,43 +1,111 @@ +; Throughout this file, where %{pre}=FOO, FileCheck prefixes are as follows to +; indicate the level of FileCheck verbosity under test: +; - FOO = quiet, -v, or -vv +; - FOO-V = -v or -vv (-vv implies -v) +; - FOO-VV = -vv +; - FOO-Q = quiet only +; - FOO-VQ = -v only +; +; Most cases use just FOO, FOO-V, and FOO-VV in a unified block of directives +; that checks an input dump where some annotations are omitted at lower +; verbosity levels. +; +; For a few cases, multiple annotations persist but *change* across verbosity +; levels, usually due to modified annotation labels. Seeing multiple versions +; of the same annotation in the same block of directives can be confusing. To +; improve readability, it is usually best to split these into separate blocks. +; For example, use FOO-Q to check only the version without -v or -vv. + +; DEFINE: %{pre} = +; DEFINE: %{opts} = +; +; DEFINE: %{run-fc} = \ +; DEFINE: %ProtectFileCheckOutput \ +; DEFINE: FileCheck -dump-input=always -input-file=%t.in %t.chk \ +; DEFINE: -dump-input-label-width=15 %{opts} +; +; DEFINE: %{check-fc} = \ +; DEFINE: FileCheck -strict-whitespace -match-full-lines %s \ +; DEFINE: -allow-unused-prefixes \ +; DEFINE: -implicit-check-not='remark:' -implicit-check-not='error:' +; +; For each case, it is usually best to run these in order of decreasing +; verbosity to maximize the information for debugging when the case is broken. +; +; DEFINE: %{run-vv} = %{run-fc} -vv 2>&1 | \ +; DEFINE: %{check-fc} -check-prefixes=%{pre},%{pre}-V,%{pre}-VV +; DEFINE: %{run-v} = %{run-fc} -v 2>&1 | \ +; DEFINE: %{check-fc} -check-prefixes=%{pre},%{pre}-V,%{pre}-VQ +; DEFINE: %{run} = %{run-fc} 2>&1 | \ +; DEFINE: %{check-fc} -check-prefixes=%{pre},%{pre}-Q + ;-------------------------------------------------- -; Use -strict-whitespace to check marker and note alignment here. -; (Also check multiline marker where start/end columns vary across lines.) +; Label column width ; -; In the remaining checks, don't use -strict-whitespace and thus check just the -; presence, order, and lengths of markers. That way, if we ever change padding -; within line labels, we don't have to adjust so many tests. +; Check that the label column width is sane when we do not force a minimum. The +; rest of the test file is easier to maintain if we otherwise always force it +; because that avoids the possibility of it fluctuating across different +; verbosity levels. ;-------------------------------------------------- +; Check with both the annotation label and the line number fairly short. +; ; RUN: echo 'hello world' > %t.in -; RUN: echo 'goodbye' >> %t.in -; RUN: echo 'world' >> %t.in -; RUN: echo 'unicorn' >> %t.in - -; RUN: echo 'CHECK: hello' > %t.chk -; RUN: echo 'CHECK: universe' >> %t.chk - -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \ -; RUN: | FileCheck -strict-whitespace -match-full-lines -check-prefix=ALIGN \ -; RUN: -implicit-check-not='remark:' %s +; RUN: echo 'CHECK: hello world' > %t.chk +; +; REDEFINE: %{opts} = -dump-input-label-width=0 +; REDEFINE: %{pre} = WIDTH-SHORT +; RUN: %{run-v} +; +; WIDTH-SHORT:<<<<<< +; WIDTH-SHORT-NEXT: 1: hello world +; WIDTH-SHORT-NEXT:check:1 ^~~~~~~~~~~ +; WIDTH-SHORT-NEXT:>>>>>> +; WIDTH-SHORT-NOT:{{.}} -; Verbose diagnostics are suppressed but not errors. -; ALIGN:{{.*}}error:{{.*}} -; ALIGN:{{.*}}possible intended match here{{.*}} - -; ALIGN:Input was: -; ALIGN-NEXT:<<<<<< -; ALIGN-NEXT: 1: hello world -; ALIGN-NEXT:check:1 ^~~~~ -; ALIGN-NEXT:check:2'0 X~~~~~~ error: no match found -; ALIGN-NEXT: 2: goodbye -; ALIGN-NEXT:check:2'0 ~~~~~~~~ -; ALIGN-NEXT: 3: world -; ALIGN-NEXT:check:2'0 ~~~~~~ -; ALIGN-NEXT: 4: unicorn -; ALIGN-NEXT:check:2'0 ~~~~~~~~ -; ALIGN-NEXT:check:2'1 ? possible intended match -; ALIGN-NEXT:>>>>>> -; ALIGN-NOT:{{.}} +; Check that lengthening the annotation label widens the column. +; +; RUN: echo 'hello world' > %t.in +; RUN: echo 'hello world' >> %t.in +; RUN: echo 'CHECK-COUNT-2: hello world' > %t.chk +; +; REDEFINE: %{opts} = -dump-input-label-width=0 +; REDEFINE: %{pre} = WIDTH-ANNOT +; RUN: %{run-v} +; +; WIDTH-ANNOT:<<<<<< +; WIDTH-ANNOT-NEXT: 1: hello world +; WIDTH-ANNOT-NEXT:count:1'0 ^~~~~~~~~~~ +; WIDTH-ANNOT-NEXT: 2: hello world +; WIDTH-ANNOT-NEXT:count:1'1 ^~~~~~~~~~~ +; WIDTH-ANNOT-NEXT:>>>>>> +; WIDTH-ANNOT-NOT:{{.}} + +; Check that a longer line number (6 characters) than annotation label (5 +; characters) widens the column. +; +; RUN: %python -c 'print("x\n" * 10**5, end="")' > %t.in +; RUN: echo 'the end' >> %t.in +; RUN: echo 'CHECK-DAG: the end' > %t.chk +; +; REDEFINE: %{opts} = -dump-input-label-width=0 -dump-input-filter=annotation \ +; REDEFINE: -dump-input-context=3 +; REDEFINE: %{pre} = WIDTH-LINENO +; RUN: %{run-v} +; +; WIDTH-LINENO:<<<<<< +; WIDTH-LINENO-NEXT: . +; WIDTH-LINENO-NEXT: . +; WIDTH-LINENO-NEXT: . +; WIDTH-LINENO-NEXT: 99998: x +; WIDTH-LINENO-NEXT: 99999: x +; WIDTH-LINENO-NEXT: 100000: x +; WIDTH-LINENO-NEXT: 100001: the end +; WIDTH-LINENO-NEXT:dag:1 ^~~~~~~ +; WIDTH-LINENO-NEXT:>>>>>> +; WIDTH-LINENO-NOT:{{.}} + +; REDEFINE: %{opts} = ;-------------------------------------------------- ; CHECK (also: multi-line search range, fuzzy match) @@ -52,34 +120,26 @@ ; RUN: echo 'CHECK: hello' > %t.chk ; RUN: echo 'CHECK: world' >> %t.chk -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefix=CHK \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=CHK,CHK-V \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=CHK,CHK-V \ -; RUN: -implicit-check-not='remark:' +; REDEFINE: %{pre} = CHK +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} ; Verbose diagnostics are suppressed but not errors. -; CHK: {{.*}}error:{{.*}} -; CHK: {{.*}}possible intended match here{{.*}} - -; CHK: <<<<<< -; CHK-NEXT: 1: hello -; CHK-V-NEXT: check:1 ^~~~~ -; CHK-NEXT: check:2'0 X error: no match found -; CHK-NEXT: 2: again -; CHK-NEXT: check:2'0 ~~~~~~ -; CHK-NEXT: 3: whirled -; CHK-NEXT: check:2'0 ~~~~~~~~ -; CHK-NEXT: check:2'1 ? possible intended match -; CHK-NEXT: >>>>>> -; CHK-NOT: {{.}} +; CHK:{{.*}}error:{{.*}} +; CHK:{{.*}}possible intended match here{{.*}} + +; CHK:<<<<<< +; CHK-NEXT: 1: hello +; CHK-V-NEXT:check:1 ^~~~~ +; CHK-NEXT:check:2'0 X error: no match found +; CHK-NEXT: 2: again +; CHK-NEXT:check:2'0 ~~~~~~ +; CHK-NEXT: 3: whirled +; CHK-NEXT:check:2'0 ~~~~~~~~ +; CHK-NEXT:check:2'1 ? possible intended match +; CHK-NEXT:>>>>>> +; CHK-NOT:{{.}} ;-------------------------------------------------- ; CHECK-COUNT-<num> @@ -93,36 +153,35 @@ ; RUN: echo 'CHECK-COUNT-3: pete' > %t.chk -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=CNT,CNT-Q \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=CNT,CNT-V \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=CNT,CNT-V \ -; RUN: -implicit-check-not='remark:' +; REDEFINE: %{pre} = CNT +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} ; Verbose diagnostics are suppressed but not errors. -; CNT: {{.*}}error:{{.*}} - -; CNT: <<<<<< -; CNT-NEXT: 1: pete -; CNT-V-NEXT: count:1'0 ^~~~ -; CNT-NEXT: 2: repete -; CNT-V-NEXT: count:1'1 ^~~~ -; CNT-Q-NEXT: count:1'0 X error: no match found -; CNT-V-NEXT: count:1'2 X error: no match found -; CNT-NEXT: 3: repeat -; CNT-Q-NEXT: count:1'0 ~~~~~~~ -; CNT-Q-NEXT: count:1'1 ? possible intended match -; CNT-V-NEXT: count:1'2 ~~~~~~~ -; CNT-V-NEXT: count:1'3 ? possible intended match -; CNT-NEXT: >>>>>> -; CNT-NOT: {{.}} +; CNT:{{.*}}error:{{.*}} + +; CNT-V:<<<<<< +; CNT-V-NEXT: 1: pete +; CNT-V-NEXT:count:1'0 ^~~~ +; CNT-V-NEXT: 2: repete +; CNT-V-NEXT:count:1'1 ^~~~ +; CNT-V-NEXT:count:1'2 X error: no match found +; CNT-V-NEXT: 3: repeat +; CNT-V-NEXT:count:1'2 ~~~~~~~ +; CNT-V-NEXT:count:1'3 ? possible intended match +; CNT-V-NEXT:>>>>>> +; CNT-V-NOT:{{.}} + +; CNT-Q:<<<<<< +; CNT-Q-NEXT: 1: pete +; CNT-Q-NEXT: 2: repete +; CNT-Q-NEXT:count:1'0 X error: no match found +; CNT-Q-NEXT: 3: repeat +; CNT-Q-NEXT:count:1'0 ~~~~~~~ +; CNT-Q-NEXT:count:1'1 ? possible intended match +; CNT-Q-NEXT:>>>>>> +; CNT-Q-NOT:{{.}} ;-------------------------------------------------- ; CHECK-NEXT (also: EOF search-range, wrong-line match) @@ -137,48 +196,46 @@ ; RUN: echo 'CHECK-NEXT: again' >> %t.chk ; RUN: echo 'CHECK-NEXT: world' >> %t.chk -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefix=NXT \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=NXT,NXT-V \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=NXT,NXT-V,NXT-VV \ -; RUN: -implicit-check-not='remark:' -allow-unused-prefixes +; REDEFINE: %{pre} = NXT +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} ; Verbose diagnostics are suppressed but not errors. -; NXT: {{.*}}error:{{.*}} +; NXT:{{.*}}error:{{.*}} -; NXT: <<<<<< -; NXT-NEXT: 1: hello -; NXT-V-NEXT: check:1 ^~~~~ -; NXT-NEXT: 2: again -; NXT-V-NEXT: next:2 ^~~~~ -; NXT-NEXT: next:3 X error: no match found -; NXT-NEXT: >>>>>> -; NXT-NOT: {{.}} +; NXT:<<<<<< +; NXT-NEXT: 1: hello +; NXT-V-NEXT:check:1 ^~~~~ +; NXT-NEXT: 2: again +; NXT-V-NEXT:next:2 ^~~~~ +; NXT-NEXT:next:3 X error: no match found +; NXT-NEXT:>>>>>> +; NXT-NOT:{{.}} ; Wrong-line match. ; RUN: echo 'yonder' >> %t.in ; RUN: echo 'world' >> %t.in -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefix=NXT2 +; REDEFINE: %{pre} = NXT2 +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} -; NXT2: <<<<<< -; NXT2-NEXT: 1: hello -; NXT2-NEXT: 2: again -; NXT2-NEXT: 3: yonder -; NXT2-NEXT: 4: world -; NXT2-NEXT: next:3 !~~~~ error: match on wrong line -; NXT2-NEXT: >>>>>> -; NXT2-NOT: {{.}} +; Verbose diagnostics are suppressed but not errors. +; NXT2:{{.*}}error:{{.*}} + +; NXT2:<<<<<< +; NXT2-NEXT: 1: hello +; NXT2-V-NEXT:check:1 ^~~~~ +; NXT2-NEXT: 2: again +; NXT2-V-NEXT:next:2 ^~~~~ +; NXT2-NEXT: 3: yonder +; NXT2-NEXT: 4: world +; NXT2-NEXT:next:3 !~~~~ error: match on wrong line +; NXT2-NEXT:>>>>>> +; NXT2-NOT:{{.}} ;-------------------------------------------------- ; CHECK-SAME (also: multiple annotations per line, single-char search range, @@ -193,50 +250,42 @@ ; RUN: echo 'CHECK-SAME: world' >> %t.chk ; RUN: echo 'CHECK-SAME: again' >> %t.chk -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefix=SAM \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=SAM,SAM-V \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=SAM,SAM-V,SAM-VV \ -; RUN: -implicit-check-not='remark:' -allow-unused-prefixes +; REDEFINE: %{pre} = SAM +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} ; Verbose diagnostics are suppressed but not errors. -; SAM: {{.*}}error:{{.*}} +; SAM:{{.*}}error:{{.*}} -; SAM: <<<<<< -; SAM-NEXT: 1: hello world! -; SAM-V-NEXT: check:1 ^~~~~ -; SAM-V-NEXT: same:2 ^~~~~ -; SAM-NEXT: same:3 X~ error: no match found -; SAM-NEXT: >>>>>> -; SAM-NOT: {{.}} +; SAM:<<<<<< +; SAM-NEXT: 1: hello world! +; SAM-V-NEXT:check:1 ^~~~~ +; SAM-V-NEXT:same:2 ^~~~~ +; SAM-NEXT:same:3 X~ error: no match found +; SAM-NEXT:>>>>>> +; SAM-NOT:{{.}} ; Wrong-line match. ; RUN: echo 'again' >> %t.in -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=SAM2 \ -; RUN: -implicit-check-not='remark:' +; REDEFINE: %{pre} = SAM2 +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} ; Verbose diagnostics are suppressed but not errors. -; SAM2: {{.*}}error:{{.*}} +; SAM2:{{.*}}error:{{.*}} -; SAM2: <<<<<< -; SAM2-NEXT: 1: hello world! -; SAM2-NEXT: check:1 ^~~~~ -; SAM2-NEXT: same:2 ^~~~~ -; SAM2-NEXT: 2: again -; SAM2-NEXT: same:3 !~~~~ error: match on wrong line -; SAM2-NEXT: >>>>>> -; SAM2-NOT: {{.}} +; SAM2:<<<<<< +; SAM2-NEXT: 1: hello world! +; SAM2-V-NEXT:check:1 ^~~~~ +; SAM2-V-NEXT:same:2 ^~~~~ +; SAM2-NEXT: 2: again +; SAM2-NEXT:same:3 !~~~~ error: match on wrong line +; SAM2-NEXT:>>>>>> +; SAM2-NOT:{{.}} ;-------------------------------------------------- ; CHECK-EMPTY (also: search range ends at label, single-char match, wrong-line @@ -260,35 +309,27 @@ ; RUN: echo 'CHECK-EMPTY:' >> %t.chk ; RUN: echo 'CHECK-LABEL: label' >> %t.chk -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefix=EMP \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=EMP,EMP-V \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=EMP,EMP-V,EMP-VV \ -; RUN: -implicit-check-not='remark:' -allow-unused-prefixes +; REDEFINE: %{pre} = EMP +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} ; Verbose diagnostics are suppressed but not errors. -; EMP: {{.*}}error:{{.*}} - -; EMP: <<<<<< -; EMP-NEXT: 1: hello -; EMP-V-NEXT: check:1 ^~~~~ -; EMP-NEXT: 2: -; EMP-V-NEXT: empty:2 ^ -; EMP-NEXT: empty:3 X error: no match found -; EMP-NEXT: 3: world -; EMP-NEXT: empty:3 ~~~~~~ -; EMP-NEXT: 4: label -; EMP-V-NEXT: label:4 ^~~~~ -; EMP-NEXT: empty:3 ~~~~~ -; EMP-NEXT: >>>>>> -; EMP-NOT: {{.}} +; EMP:{{.*}}error:{{.*}} + +; EMP:<<<<<< +; EMP-NEXT: 1: hello +; EMP-V-NEXT:check:1 ^~~~~ +; EMP-NEXT: 2: +; EMP-V-NEXT:empty:2 ^ +; EMP-NEXT:empty:3 X error: no match found +; EMP-NEXT: 3: world +; EMP-NEXT:empty:3 ~~~~~~ +; EMP-NEXT: 4: label +; EMP-V-NEXT:label:4 ^~~~~ +; EMP-NEXT:empty:3 ~~~~~ +; EMP-NEXT:>>>>>> +; EMP-NOT:{{.}} ; Wrong-line match. @@ -298,30 +339,22 @@ ; RUN: echo 'CHECK: hello' > %t.chk ; RUN: echo 'CHECK-EMPTY:' >> %t.chk -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefix=EMP2 \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=EMP2,EMP2-V \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=EMP2,EMP2-V,EMP2-VV \ -; RUN: -implicit-check-not='remark:' -allow-unused-prefixes +; REDEFINE: %{pre} = EMP2 +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} ; Verbose diagnostics are suppressed but not errors. -; EMP2: {{.*}}error:{{.*}} +; EMP2:{{.*}}error:{{.*}} -; EMP2: <<<<<< -; EMP2-NEXT: 1: hello -; EMP2-V-NEXT: check:1 ^~~~~ -; EMP2-NEXT: 2: world -; EMP2-NEXT: 3: -; EMP2-NEXT: empty:2 ! error: match on wrong line -; EMP2-NEXT: >>>>>> -; EMP2-NOT: {{.}} +; EMP2:<<<<<< +; EMP2-NEXT: 1: hello +; EMP2-V-NEXT:check:1 ^~~~~ +; EMP2-NEXT: 2: world +; EMP2-NEXT: 3: +; EMP2-NEXT:empty:2 ! error: match on wrong line +; EMP2-NEXT:>>>>>> +; EMP2-NOT:{{.}} ;-------------------------------------------------- ; CHECK-NOT (also: EOF pattern, and multiline range that ends before EOL) @@ -336,66 +369,50 @@ ; RUN: echo 'CHECK-NOT: goodbye' > %t.chk ; RUN: echo 'CHECK-NOT: world' >> %t.chk -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefix=NOT \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=NOT,NOT-V \ -; RUN: -implicit-check-not='remark:' -allow-unused-prefixes -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=NOT,NOT-V,NOT-VV \ -; RUN: -implicit-check-not='remark:' -allow-unused-prefixes +; REDEFINE: %{pre} = NOT +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} ; Verbose diagnostics are suppressed but not errors. -; NOT: {{.*}}error:{{.*}} - -; NOT: <<<<<< -; NOT-NEXT: 1: hello -; NOT-VV-NEXT: not:1 X~~~~~ -; NOT-NEXT: 2: world -; NOT-VV-NEXT: not:1 ~~~~~~ -; NOT-NEXT: not:2 !~~~~ error: no match expected -; NOT-NEXT: 3: again -; NOT-VV-NEXT: not:1 ~~~~~~ -; NOT-VV-NEXT: 4: -; NOT-VV-NEXT: eof:2 ^ -; NOT-NEXT: >>>>>> -; NOT-NOT: {{.}} +; NOT:{{.*}}error:{{.*}} + +; NOT:<<<<<< +; NOT-NEXT: 1: hello +; NOT-VV-NEXT:not:1 X~~~~~ +; NOT-NEXT: 2: world +; NOT-VV-NEXT:not:1 ~~~~~~ +; NOT-NEXT:not:2 !~~~~ error: no match expected +; NOT-NEXT: 3: again +; NOT-VV-NEXT:not:1 ~~~~~~ +; NOT-VV-NEXT: 4: +; NOT-VV-NEXT:eof:2 ^ +; NOT-NEXT:>>>>>> +; NOT-NOT:{{.}} ; Again, but with a CHECK instead of EOF as search range end. ; RUN: echo 'CHECK: ain' >> %t.chk -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefix=NOT2 \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=NOT2,NOT2-V \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=NOT2,NOT2-V,NOT2-VV \ -; RUN: -implicit-check-not='remark:' +; REDEFINE: %{pre} = NOT2 +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} ; Verbose diagnostics are suppressed but not errors. -; NOT2: {{.*}}error:{{.*}} - -; NOT2: <<<<<< -; NOT2-NEXT: 1: hello -; NOT2-VV-NEXT: not:1 X~~~~~ -; NOT2-NEXT: 2: world -; NOT2-VV-NEXT: not:1 ~~~~~~ -; NOT2-NEXT: not:2 !~~~~ error: no match expected -; NOT2-NEXT: 3: again -; NOT2-V-NEXT: check:3 ^~~ -; NOT2-VV-NEXT: not:1 ~~ -; NOT2-NEXT: >>>>>> -; NOT2-NOT: {{.}} +; NOT2:{{.*}}error:{{.*}} + +; NOT2:<<<<<< +; NOT2-NEXT: 1: hello +; NOT2-VV-NEXT:not:1 X~~~~~ +; NOT2-NEXT: 2: world +; NOT2-VV-NEXT:not:1 ~~~~~~ +; NOT2-NEXT:not:2 !~~~~ error: no match expected +; NOT2-NEXT: 3: again +; NOT2-V-NEXT:check:3 ^~~ +; NOT2-VV-NEXT:not:1 ~~ +; NOT2-NEXT:>>>>>> +; NOT2-NOT:{{.}} ;-------------------------------------------------- ; CHECK-DAG (also: matches in different order than directives, discarded match) @@ -412,47 +429,48 @@ ; RUN: echo 'CHECK-DAG: abc' >> %t.chk ; RUN: echo 'CHECK-DAG: def' >> %t.chk -; Prefixes used here: -; DAG = quiet, -v, or -vv -; DAG-Q = quiet -; DAG-V = -v or -vv (-vv implies -v) -; DAG-VQ = -v and not -vv -; DAG-VV = -vv - -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG,DAG-Q \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG,DAG-V,DAG-VQ \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG,DAG-V,DAG-VV \ -; RUN: -implicit-check-not='remark:' +; REDEFINE: %{pre} = DAG +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} ; Verbose diagnostics are suppressed but not errors. -; DAG: {{.*}}error:{{.*}} - -; DAG: <<<<<< -; DAG-NEXT: 1: abc -; DAG-V-NEXT: dag:2 ^~~ -; DAG-VV-NEXT: dag:3'0 !~~ discard: overlaps earlier match -; DAG-NEXT: 2: def -; DAG-V-NEXT: dag:1 ^~~ -; DAG-VV-NEXT: dag:4'0 !~~ discard: overlaps earlier match -; DAG-Q-NEXT: dag:4 X error: no match found -; DAG-VQ-NEXT: dag:4 X error: no match found -; DAG-VV-NEXT: dag:4'1 X error: no match found -; DAG-NEXT: 3: abc -; DAG-VQ-NEXT: dag:3 ^~~ -; DAG-VV-NEXT: dag:3'1 ^~~ -; DAG-Q-NEXT: dag:4 ~~~~ -; DAG-VQ-NEXT: dag:4 ~~~~ -; DAG-VV-NEXT: dag:4'1 ~~~~ -; DAG-NEXT: >>>>>> -; DAG-NOT: {{.}} +; DAG:{{.*}}error:{{.*}} + +; DAG-VV:<<<<<< +; DAG-VV-NEXT: 1: abc +; DAG-VV-NEXT:dag:2 ^~~ +; DAG-VV-NEXT:dag:3'0 !~~ discard: overlaps earlier match +; DAG-VV-NEXT: 2: def +; DAG-VV-NEXT:dag:1 ^~~ +; DAG-VV-NEXT:dag:4'0 !~~ discard: overlaps earlier match +; DAG-VV-NEXT:dag:4'1 X error: no match found +; DAG-VV-NEXT: 3: abc +; DAG-VV-NEXT:dag:3'1 ^~~ +; DAG-VV-NEXT:dag:4'1 ~~~~ +; DAG-VV-NEXT:>>>>>> +; DAG-VV-NOT:{{.}} + +; DAG-VQ:<<<<<< +; DAG-VQ-NEXT: 1: abc +; DAG-VQ-NEXT:dag:2 ^~~ +; DAG-VQ-NEXT: 2: def +; DAG-VQ-NEXT:dag:1 ^~~ +; DAG-VQ-NEXT:dag:4 X error: no match found +; DAG-VQ-NEXT: 3: abc +; DAG-VQ-NEXT:dag:3 ^~~ +; DAG-VQ-NEXT:dag:4 ~~~~ +; DAG-VQ-NEXT:>>>>>> +; DAG-VQ-NOT:{{.}} + +; DAG-Q:<<<<<< +; DAG-Q-NEXT: 1: abc +; DAG-Q-NEXT: 2: def +; DAG-Q-NEXT:dag:4 X error: no match found +; DAG-Q-NEXT: 3: abc +; DAG-Q-NEXT:dag:4 ~~~~ +; DAG-Q-NEXT:>>>>>> +; DAG-Q-NOT:{{.}} ; Check sorting of annotations when the order of diagnostics across an input ; line is different than the order of the associated directives in the check @@ -467,39 +485,43 @@ ; RUN: echo 'CHECK-DAG: de' >> %t.chk ; RUN: echo 'CHECK-DAG: def' >> %t.chk -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG1L,DAG1L-Q \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG1L,DAG1L-V,DAG1L-VQ \ -; RUN: -implicit-check-not='remark:' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=DAG1L,DAG1L-V,DAG1L-VV \ -; RUN: -implicit-check-not='remark:' +; REDEFINE: %{pre} = DAG1L +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} ; Verbose diagnostics are suppressed but not errors. ; DAG1L:{{.*}}error:{{.*}} -; DAG1L:<<<<<< -; DAG1L-NEXT: 1: abc def abc def -; DAG1L-V-NEXT:dag:1 ^~~ -; DAG1L-V-NEXT:dag:2 ^~ -; DAG1L-VV-NEXT:dag:3'0 !~~ discard: overlaps earlier match -; DAG1L-VQ-NEXT:dag:3 ^~~ -; DAG1L-VV-NEXT:dag:3'1 ^~~ -; DAG1L-VV-NEXT:dag:4'0 !~ discard: overlaps earlier match -; DAG1L-VQ-NEXT:dag:4 ^~ -; DAG1L-VV-NEXT:dag:4'1 ^~ -; DAG1L-VV-NEXT:dag:5'0 !~~ discard: overlaps earlier match -; DAG1L-VV-NEXT:dag:5'1 !~~ discard: overlaps earlier match -; DAG1L-Q-NEXT:dag:5 X~ error: no match found -; DAG1L-VQ-NEXT:dag:5 X~ error: no match found -; DAG1L-VV-NEXT:dag:5'2 X~ error: no match found -; DAG1L-NEXT:>>>>>> -; DAG1L-NOT:{{.}} +; DAG1L-VV:<<<<<< +; DAG1L-VV-NEXT: 1: abc def abc def +; DAG1L-VV-NEXT:dag:1 ^~~ +; DAG1L-VV-NEXT:dag:2 ^~ +; DAG1L-VV-NEXT:dag:3'0 !~~ discard: overlaps earlier match +; DAG1L-VV-NEXT:dag:3'1 ^~~ +; DAG1L-VV-NEXT:dag:4'0 !~ discard: overlaps earlier match +; DAG1L-VV-NEXT:dag:4'1 ^~ +; DAG1L-VV-NEXT:dag:5'0 !~~ discard: overlaps earlier match +; DAG1L-VV-NEXT:dag:5'1 !~~ discard: overlaps earlier match +; DAG1L-VV-NEXT:dag:5'2 X~ error: no match found +; DAG1L-VV-NEXT:>>>>>> +; DAG1L-VV-NOT:{{.}} + +; DAG1L-VQ:<<<<<< +; DAG1L-VQ-NEXT: 1: abc def abc def +; DAG1L-VQ-NEXT:dag:1 ^~~ +; DAG1L-VQ-NEXT:dag:2 ^~ +; DAG1L-VQ-NEXT:dag:3 ^~~ +; DAG1L-VQ-NEXT:dag:4 ^~ +; DAG1L-VQ-NEXT:dag:5 X~ error: no match found +; DAG1L-VQ-NEXT:>>>>>> +; DAG1L-VQ-NOT:{{.}} + +; DAG1L-Q:<<<<<< +; DAG1L-Q-NEXT: 1: abc def abc def +; DAG1L-Q-NEXT:dag:5 X~ error: no match found +; DAG1L-Q-NEXT:>>>>>> +; DAG1L-Q-NOT:{{.}} ;-------------------------------------------------- ; CHECK-LABEL @@ -547,61 +569,73 @@ ; RUN: echo 'CHECK-NOT: labelF' >> %t.chk ; RUN: echo 'CHECK-LABEL: labelF' >> %t.chk -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=LAB,LAB-Q \ -; RUN: -implicit-check-not='{{remark:|error:}}' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -v 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=LAB,LAB-V \ -; RUN: -implicit-check-not='{{remark:|error:}}' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk -vv 2>&1 \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=LAB,LAB-V,LAB-VV \ -; RUN: -implicit-check-not='{{remark:|error:}}' +; REDEFINE: %{pre} = LAB +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} ; Verbose diagnostics are suppressed but not errors. ; LAB:{{.*}}.chk:3:8: error: CHECK: expected string not found in input ; LAB:{{.*}}.chk:6:14: error: CHECK-LABEL: expected string not found in input ; LAB:{{.*}}.chk:9:12: error: CHECK-NOT: excluded string found in input -; LAB:<<<<<< -; LAB-NEXT: 1: text -; LAB-V-NEXT:check:1 ^~~~ -; LAB-NEXT: 2: labelA -; LAB-V-NEXT:label:2'0 ^~~~~~ -; LAB-V-NEXT:label:2'1 ^~~~~~ -; LAB-NEXT:check:3 X error: no match found -; LAB-NEXT: 3: textA -; LAB-NEXT:check:3 ~~~~~~ -; LAB-NEXT: 4: labelB -; LAB-V-NEXT:label:4 ^~~~~~ -; LAB-NEXT:check:3 ~~~~~~ -; LAB-NEXT: 5: textB -; LAB-NEXT: 6: labelC -; LAB-V-NEXT:label:6'0 ^~~~~~ -; LAB-V-NEXT:check:5 ^~~~~~ -; LAB-Q-NEXT:label:6 X error: no match found -; LAB-V-NEXT:label:6'1 X error: no match found -; LAB-VV-NEXT:not:7 X -; LAB-NEXT: 7: textC -; LAB-VV-NEXT:not:7 ~~~~~~ -; LAB-NEXT: 8: labelD -; LAB-V-NEXT:label:8'0 ^~~~~~ -; LAB-V-NEXT:label:8'1 ^~~~~~ -; LAB-NEXT: 9: textD -; LAB-NEXT:not:9 !~~~~ error: no match expected -; LAB-NEXT: 10: labelE -; LAB-V-NEXT:label:10'0 ^~~~~~ -; LAB-V-NEXT:label:10'1 ^~~~~~ -; LAB-VV-NEXT:not:11 X -; LAB-NEXT: 11: textE -; LAB-VV-NEXT:not:11 ~~~~~~ -; LAB-NEXT: 12: labelF -; LAB-V-NEXT:label:12'0 ^~~~~~ -; LAB-V-NEXT:label:12'1 ^~~~~~ -; LAB-NEXT:>>>>>> -; LAB-NOT:{{.}} +; LAB-V:<<<<<< +; LAB-V-NEXT: 1: text +; LAB-V-NEXT:check:1 ^~~~ +; LAB-V-NEXT: 2: labelA +; LAB-V-NEXT:label:2'0 ^~~~~~ +; LAB-V-NEXT:label:2'1 ^~~~~~ +; LAB-V-NEXT:check:3 X error: no match found +; LAB-V-NEXT: 3: textA +; LAB-V-NEXT:check:3 ~~~~~~ +; LAB-V-NEXT: 4: labelB +; LAB-V-NEXT:label:4 ^~~~~~ +; LAB-V-NEXT:check:3 ~~~~~~ +; LAB-V-NEXT: 5: textB +; LAB-V-NEXT: 6: labelC +; LAB-V-NEXT:label:6'0 ^~~~~~ +; LAB-V-NEXT:check:5 ^~~~~~ +; LAB-V-NEXT:label:6'1 X error: no match found +; LAB-VV-NEXT:not:7 X +; LAB-V-NEXT: 7: textC +; LAB-VV-NEXT:not:7 ~~~~~~ +; LAB-V-NEXT: 8: labelD +; LAB-V-NEXT:label:8'0 ^~~~~~ +; LAB-V-NEXT:label:8'1 ^~~~~~ +; LAB-V-NEXT: 9: textD +; LAB-V-NEXT:not:9 !~~~~ error: no match expected +; LAB-V-NEXT: 10: labelE +; LAB-V-NEXT:label:10'0 ^~~~~~ +; LAB-V-NEXT:label:10'1 ^~~~~~ +; LAB-VV-NEXT:not:11 X +; LAB-V-NEXT: 11: textE +; LAB-VV-NEXT:not:11 ~~~~~~ +; LAB-V-NEXT: 12: labelF +; LAB-V-NEXT:label:12'0 ^~~~~~ +; LAB-V-NEXT:label:12'1 ^~~~~~ +; LAB-V-NEXT:>>>>>> +; LAB-V-NOT:{{.}} + +; LAB-Q:<<<<<< +; LAB-Q-NEXT: 1: text +; LAB-Q-NEXT: 2: labelA +; LAB-Q-NEXT:check:3 X error: no match found +; LAB-Q-NEXT: 3: textA +; LAB-Q-NEXT:check:3 ~~~~~~ +; LAB-Q-NEXT: 4: labelB +; LAB-Q-NEXT:check:3 ~~~~~~ +; LAB-Q-NEXT: 5: textB +; LAB-Q-NEXT: 6: labelC +; LAB-Q-NEXT:label:6 X error: no match found +; LAB-Q-NEXT: 7: textC +; LAB-Q-NEXT: 8: labelD +; LAB-Q-NEXT: 9: textD +; LAB-Q-NEXT:not:9 !~~~~ error: no match expected +; LAB-Q-NEXT: 10: labelE +; LAB-Q-NEXT: 11: textE +; LAB-Q-NEXT: 12: labelF +; LAB-Q-NEXT:>>>>>> +; LAB-Q-NOT:{{.}} ;-------------------------------------------------- ; --implicit-check-not @@ -618,58 +652,50 @@ ; RUN: echo 'CHECK: wor' >> %t.chk ; RUN: echo 'CHECK: !' >> %t.chk -; Prefixes used here: -; IMPNOT = quiet, -v, or -vv -; IMPNOT-Q = quiet -; IMPNOT-V = -v or -vv (-vv implies -v) -; IMPNOT-VQ = -v and not -vv -; IMPNOT-VV = -vv - -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file=%t.in %t.chk 2>&1 \ -; RUN: --implicit-check-not='goodbye' \ -; RUN: --implicit-check-not='world' \ -; RUN: --implicit-check-not='again' \ -; RUN: | FileCheck -match-full-lines %s -check-prefixes=IMPNOT,IMPNOT-Q \ -; RUN: -implicit-check-not='{{remark:|error:}}' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file=%t.in %t.chk -v 2>&1 \ -; RUN: --implicit-check-not='goodbye' \ -; RUN: --implicit-check-not='world' \ -; RUN: --implicit-check-not='again' \ -; RUN: | FileCheck -match-full-lines %s \ -; RUN: -check-prefixes=IMPNOT,IMPNOT-V,IMPNOT-VQ \ -; RUN: -implicit-check-not='{{remark:|error:}}' -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -input-file=%t.in %t.chk -vv 2>&1 \ -; RUN: --implicit-check-not='goodbye' \ -; RUN: --implicit-check-not='world' \ -; RUN: --implicit-check-not='again' \ -; RUN: | FileCheck -match-full-lines %s \ -; RUN: -check-prefixes=IMPNOT,IMPNOT-V,IMPNOT-VV \ -; RUN: -implicit-check-not='{{remark:|error:}}' +; REDEFINE: %{pre} = IMPNOT +; REDEFINE: %{opts} = \ +; REDEFINE: --implicit-check-not='goodbye' \ +; REDEFINE: --implicit-check-not='world' \ +; REDEFINE: --implicit-check-not='again' +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} +; REDEFINE: %{opts} = ; Verbose diagnostics are suppressed but not errors. ; IMPNOT:{{.*}}command line:1:22: error: IMPLICIT-CHECK-NOT: excluded string found in input -; IMPNOT:<<<<<< -; IMPNOT-NEXT: 1: hello world again! -; IMPNOT-V-NEXT:check:1 ^~~ -; IMPNOT-VV-NEXT:not:imp1'0 X -; IMPNOT-VV-NEXT:not:imp2'0 X -; IMPNOT-VV-NEXT:not:imp3'0 X -; IMPNOT-V-NEXT:check:2 ^~~ -; IMPNOT-VV-NEXT:not:imp1'1 X~~ -; IMPNOT-VV-NEXT:not:imp2'1 X~~ -; IMPNOT-VV-NEXT:not:imp3'1 X~~ -; IMPNOT-V-NEXT:check:3 ^ -; IMPNOT-VV-NEXT:not:imp1'2 X~~~~~~~ -; IMPNOT-VV-NEXT:not:imp2'2 X~~~~~~~ -; IMPNOT-Q-NEXT:not:imp3 !~~~~ error: no match expected -; IMPNOT-VQ-NEXT:not:imp3 !~~~~ error: no match expected -; IMPNOT-VV-NEXT:not:imp3'2 !~~~~ error: no match expected -; IMPNOT-NEXT:>>>>>> -; IMPNOT-NOT:{{.}} +; IMPNOT-VV:<<<<<< +; IMPNOT-VV-NEXT: 1: hello world again! +; IMPNOT-VV-NEXT:check:1 ^~~ +; IMPNOT-VV-NEXT:not:imp1'0 X +; IMPNOT-VV-NEXT:not:imp2'0 X +; IMPNOT-VV-NEXT:not:imp3'0 X +; IMPNOT-VV-NEXT:check:2 ^~~ +; IMPNOT-VV-NEXT:not:imp1'1 X~~ +; IMPNOT-VV-NEXT:not:imp2'1 X~~ +; IMPNOT-VV-NEXT:not:imp3'1 X~~ +; IMPNOT-VV-NEXT:check:3 ^ +; IMPNOT-VV-NEXT:not:imp1'2 X~~~~~~~ +; IMPNOT-VV-NEXT:not:imp2'2 X~~~~~~~ +; IMPNOT-VV-NEXT:not:imp3'2 !~~~~ error: no match expected +; IMPNOT-VV-NEXT:>>>>>> +; IMPNOT-VV-NOT:{{.}} + +; IMPNOT-VQ:<<<<<< +; IMPNOT-VQ-NEXT: 1: hello world again! +; IMPNOT-VQ-NEXT:check:1 ^~~ +; IMPNOT-VQ-NEXT:check:2 ^~~ +; IMPNOT-VQ-NEXT:check:3 ^ +; IMPNOT-VQ-NEXT:not:imp3 !~~~~ error: no match expected +; IMPNOT-VQ-NEXT:>>>>>> +; IMPNOT-VQ-NOT:{{.}} + +; IMPNOT-Q:<<<<<< +; IMPNOT-Q-NEXT: 1: hello world again! +; IMPNOT-Q-NEXT:not:imp3 !~~~~ error: no match expected +; IMPNOT-Q-NEXT:>>>>>> +; IMPNOT-Q-NOT:{{.}} ;-------------------------------------------------- ; Substitutions: successful and failed positive directives. @@ -681,25 +707,32 @@ ; RUN: echo 'CHECK: [[DEF_MATCH1]] [[DEF_MATCH2]]' > %t.chk ; RUN: echo 'CHECK: [[DEF_MATCH1]] [[UNDEF]] [[DEF_NOMATCH]]' >> %t.chk -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \ -; RUN: -DDEF_MATCH1=def-match1 -DDEF_MATCH2=def-match2 \ -; RUN: -DDEF_NOMATCH=foobar \ -; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST-POS - -; SUBST-POS:<<<<<< -; SUBST-POS-NEXT: 1: def-match1 def-match2 -; SUBST-POS-NEXT:check:1'0 ^~~~~~~~~~~~~~~~~~~~~ -; SUBST-POS-NEXT:check:1'1 with "DEF_MATCH1" equal to "def-match1" -; SUBST-POS-NEXT:check:1'2 with "DEF_MATCH2" equal to "def-match2" -; SUBST-POS-NEXT:check:2'0 X error: match failed for invalid pattern -; SUBST-POS-NEXT:check:2'1 undefined variable: UNDEF -; SUBST-POS-NEXT:check:2'2 with "DEF_MATCH1" equal to "def-match1" -; SUBST-POS-NEXT:check:2'3 with "DEF_NOMATCH" equal to "foobar" -; SUBST-POS-NEXT: 2: def-match1 def-nomatch -; SUBST-POS-NEXT:check:2'0 ~~~~~~~~~~~~~~~~~~~~~~~ -; SUBST-POS-NEXT:check:2'4 ? possible intended match -; SUBST-POS-NEXT:>>>>>> +; REDEFINE: %{pre} = SUBST-POS +; REDEFINE: %{opts} = \ +; REDEFINE: -DDEF_MATCH1=def-match1 -DDEF_MATCH2=def-match2 \ +; REDEFINE: -DDEF_NOMATCH=foobar +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} +; REDEFINE: %{opts} = + +; Verbose diagnostics are suppressed but not errors. +; SUBST-POS:{{.*}}error:{{.*}} +; SUBST-POS:{{.*}}possible intended match here{{.*}} + +; SUBST-POS:<<<<<< +; SUBST-POS-NEXT: 1: def-match1 def-match2 +; SUBST-POS-V-NEXT:check:1'0 ^~~~~~~~~~~~~~~~~~~~~ +; SUBST-POS-V-NEXT:check:1'1 with "DEF_MATCH1" equal to "def-match1" +; SUBST-POS-V-NEXT:check:1'2 with "DEF_MATCH2" equal to "def-match2" +; SUBST-POS-NEXT:check:2'0 X error: match failed for invalid pattern +; SUBST-POS-NEXT:check:2'1 undefined variable: UNDEF +; SUBST-POS-NEXT:check:2'2 with "DEF_MATCH1" equal to "def-match1" +; SUBST-POS-NEXT:check:2'3 with "DEF_NOMATCH" equal to "foobar" +; SUBST-POS-NEXT: 2: def-match1 def-nomatch +; SUBST-POS-NEXT:check:2'0 ~~~~~~~~~~~~~~~~~~~~~~~ +; SUBST-POS-NEXT:check:2'4 ? possible intended match +; SUBST-POS-NEXT:>>>>>> ;-------------------------------------------------- ; Substitutions: successful and failed negative directives. @@ -713,26 +746,33 @@ ; RUN: echo 'CHECK-NOT: [[DEF_MATCH1]] [[DEF_MATCH2]]' >> %t.chk ; RUN: echo 'CHECK: END' >> %t.chk -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \ -; RUN: -DDEF_MATCH1=def-match1 -DDEF_MATCH2=def-match2 \ -; RUN: -DDEF_NOMATCH=foobar \ -; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST-NEG - -; SUBST-NEG:<<<<<< -; SUBST-NEG-NEXT: 1: def-match1 def-nomatch -; SUBST-NEG-NEXT:not:1'0 X~~~~~~~~~~~~~~~~~~~~~~ error: match failed for invalid pattern -; SUBST-NEG-NEXT:not:1'1 undefined variable: UNDEF -; SUBST-NEG-NEXT:not:1'2 with "DEF_MATCH1" equal to "def-match1" -; SUBST-NEG-NEXT:not:1'3 with "DEF_NOMATCH" equal to "foobar" -; SUBST-NEG-NEXT: 2: def-match1 def-match2 -; SUBST-NEG-NEXT:not:1'0 ~~~~~~~~~~~~~~~~~~~~~~ -; SUBST-NEG-NEXT:not:2'0 !~~~~~~~~~~~~~~~~~~~~ error: no match expected -; SUBST-NEG-NEXT:not:2'1 with "DEF_MATCH1" equal to "def-match1" -; SUBST-NEG-NEXT:not:2'2 with "DEF_MATCH2" equal to "def-match2" -; SUBST-NEG-NEXT: 3: END -; SUBST-NEG-NEXT:check:3 ^~~ -; SUBST-NEG-NEXT:>>>>>> +; REDEFINE: %{pre} = SUBST-NEG +; REDEFINE: %{opts} = \ +; REDEFINE: -DDEF_MATCH1=def-match1 -DDEF_MATCH2=def-match2 \ +; REDEFINE: -DDEF_NOMATCH=foobar +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} +; REDEFINE: %{opts} = + +; Verbose diagnostics are suppressed but not errors. +; SUBST-NEG:{{.*}}error:{{.*}} +; SUBST-NEG:{{.*}}error:{{.*}} + +; SUBST-NEG:<<<<<< +; SUBST-NEG-NEXT: 1: def-match1 def-nomatch +; SUBST-NEG-NEXT:not:1'0 X~~~~~~~~~~~~~~~~~~~~~~ error: match failed for invalid pattern +; SUBST-NEG-NEXT:not:1'1 undefined variable: UNDEF +; SUBST-NEG-NEXT:not:1'2 with "DEF_MATCH1" equal to "def-match1" +; SUBST-NEG-NEXT:not:1'3 with "DEF_NOMATCH" equal to "foobar" +; SUBST-NEG-NEXT: 2: def-match1 def-match2 +; SUBST-NEG-NEXT:not:1'0 ~~~~~~~~~~~~~~~~~~~~~~ +; SUBST-NEG-NEXT:not:2'0 !~~~~~~~~~~~~~~~~~~~~ error: no match expected +; SUBST-NEG-NEXT:not:2'1 with "DEF_MATCH1" equal to "def-match1" +; SUBST-NEG-NEXT:not:2'2 with "DEF_MATCH2" equal to "def-match2" +; SUBST-NEG-NEXT: 3: END +; SUBST-NEG-V-NEXT:check:3 ^~~ +; SUBST-NEG-NEXT:>>>>>> ;-------------------------------------------------- ; Captured variables @@ -757,33 +797,37 @@ ; RUN: echo 'CHECK-NOT: var in neg match: [[VAR:foo]]' >> %t.chk ; RUN: echo 'CHECK: END' >> %t.chk -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \ -; RUN: | FileCheck -strict-whitespace -match-full-lines %s -check-prefix=CAPTURE-NEG - -; CAPTURE-NEG:<<<<<< -; CAPTURE-NEG-NEXT: 1: strvar: foo -; CAPTURE-NEG-NEXT:check:1'0 ^~~~~~~~~~~ -; CAPTURE-NEG-NEXT:check:1'1 ^~~ captured var "STRVAR" -; CAPTURE-NEG-NEXT: 2: numvar no expr: 51 -; CAPTURE-NEG-NEXT:check:2'0 ^~~~~~~~~~~~~~~~~~ -; CAPTURE-NEG-NEXT:check:2'1 ^~ captured var "NUMVAR_NO_EXPR" -; CAPTURE-NEG-NEXT: 3: numvar expr: -49 -; CAPTURE-NEG-NEXT:check:3'0 ^~~~~~~~~~~~~~~~ -; CAPTURE-NEG-NEXT:check:3'1 with "%d,NUMVAR_EXPR:2-NUMVAR_NO_EXPR" equal to "-49" -; CAPTURE-NEG-NEXT:check:3'2 ^~~ captured var "NUMVAR_EXPR" -; CAPTURE-NEG-NEXT: 4: many: foo 100 8 bar -; CAPTURE-NEG-NEXT:check:4'0 ^~~~~~~~~~~~~~~~~~~ -; CAPTURE-NEG-NEXT:check:4'1 ^~~ captured var "VAR1" -; CAPTURE-NEG-NEXT:check:4'2 ^~~ captured var "VAR3" -; CAPTURE-NEG-NEXT:check:4'3 ^ captured var "VAR2" -; CAPTURE-NEG-NEXT:check:4'4 ^~~ captured var "VAR4" -; CAPTURE-NEG-NEXT: 5: var in neg match: foo -; CAPTURE-NEG-NEXT:not:5'0 !~~~~~~~~~~~~~~~~~~~~ error: no match expected -; CAPTURE-NEG-NEXT:not:5'1 !~~ captured var "VAR" -; CAPTURE-NEG-NEXT: 6: END -; CAPTURE-NEG-NEXT:check:6 ^~~ -; CAPTURE-NEG-NEXT:>>>>>> +; REDEFINE: %{pre} = CAPTURE-NEG +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} + +; Verbose diagnostics are suppressed but not errors. +; CAPTURE-NEG:{{.*}}error:{{.*}} + +; CAPTURE-NEG:<<<<<< +; CAPTURE-NEG-NEXT: 1: strvar: foo +; CAPTURE-NEG-V-NEXT:check:1'0 ^~~~~~~~~~~ + CAPTURE-NEG-V-NEXT:check:1'1 ^~~ captured var "STRVAR" +; CAPTURE-NEG-NEXT: 2: numvar no expr: 51 +; CAPTURE-NEG-V-NEXT:check:2'0 ^~~~~~~~~~~~~~~~~~ +; CAPTURE-NEG-V-NEXT:check:2'1 ^~ captured var "NUMVAR_NO_EXPR" +; CAPTURE-NEG-NEXT: 3: numvar expr: -49 +; CAPTURE-NEG-V-NEXT:check:3'0 ^~~~~~~~~~~~~~~~ +; CAPTURE-NEG-V-NEXT:check:3'1 with "%d,NUMVAR_EXPR:2-NUMVAR_NO_EXPR" equal to "-49" +; CAPTURE-NEG-V-NEXT:check:3'2 ^~~ captured var "NUMVAR_EXPR" +; CAPTURE-NEG-NEXT: 4: many: foo 100 8 bar +; CAPTURE-NEG-V-NEXT:check:4'0 ^~~~~~~~~~~~~~~~~~~ +; CAPTURE-NEG-V-NEXT:check:4'1 ^~~ captured var "VAR1" +; CAPTURE-NEG-V-NEXT:check:4'2 ^~~ captured var "VAR3" +; CAPTURE-NEG-V-NEXT:check:4'3 ^ captured var "VAR2" +; CAPTURE-NEG-V-NEXT:check:4'4 ^~~ captured var "VAR4" +; CAPTURE-NEG-NEXT: 5: var in neg match: foo +; CAPTURE-NEG-NEXT:not:5'0 !~~~~~~~~~~~~~~~~~~~~ error: no match expected +; CAPTURE-NEG-NEXT:not:5'1 !~~ captured var "VAR" +; CAPTURE-NEG-NEXT: 6: END +; CAPTURE-NEG-V-NEXT:check:6 ^~~ +; CAPTURE-NEG-NEXT:>>>>>> ;-------------------------------------------------- ; CHECK-NEXT, CHECK-SAME, CHECK-DAG note fixups. @@ -804,17 +848,27 @@ ; RUN: echo 'CHECK: pre' > %t.chk ; RUN: echo 'CHECK-NEXT: [[VAR]]' >> %t.chk -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \ -; RUN: -DVAR=var \ -; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST_NEXT +; REDEFINE: %{pre} = SUBST_NEXT +; REDEFINE: %{opts} = -DVAR=var +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} +; REDEFINE: %{opts} = -; SUBST_NEXT:<<<<<< -; SUBST_NEXT-NEXT: 1: pre var -; SUBST_NEXT-NEXT:check:1 ^~~ -; SUBST_NEXT-NEXT:next:2'0 !~~ error: match on wrong line -; SUBST_NEXT-NEXT:next:2'1 with "VAR" equal to "var" -; SUBST_NEXT-NEXT:>>>>>> +; Verbose diagnostics are suppressed but not errors. +; SUBST_NEXT:{{.*}}error:{{.*}} + +; SUBST_NEXT-V:<<<<<< +; SUBST_NEXT-V-NEXT: 1: pre var +; SUBST_NEXT-V-NEXT:check:1 ^~~ +; SUBST_NEXT-V-NEXT:next:2'0 !~~ error: match on wrong line +; SUBST_NEXT-V-NEXT:next:2'1 with "VAR" equal to "var" +; SUBST_NEXT-V-NEXT:>>>>>> + +; SUBST_NEXT-Q:<<<<<< +; SUBST_NEXT-Q-NEXT: 1: pre var +; SUBST_NEXT-Q-NEXT:next:2 !~~ error: match on wrong line +; SUBST_NEXT-Q-NEXT:>>>>>> ;- - - - - - - - - - - - - - - - - - - - - - - - - ; CHECK-SAME. @@ -826,18 +880,29 @@ ; RUN: echo 'CHECK: pre' > %t.chk ; RUN: echo 'CHECK-SAME: [[VAR]]' >> %t.chk -; RUN: %ProtectFileCheckOutput \ -; RUN: not FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \ -; RUN: -DVAR=var \ -; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST_SAME +; REDEFINE: %{pre} = SUBST_SAME +; REDEFINE: %{opts} = -DVAR=var +; RUN: not %{run-vv} +; RUN: not %{run-v} +; RUN: not %{run} +; REDEFINE: %{opts} = -; SUBST_SAME:<<<<<< -; SUBST_SAME-NEXT: 1: pre -; SUBST_SAME-NEXT:check:1 ^~~ -; SUBST_SAME-NEXT: 2: var -; SUBST_SAME-NEXT:same:2'0 !~~ error: match on wrong line -; SUBST_SAME-NEXT:same:2'1 with "VAR" equal to "var" -; SUBST_SAME-NEXT:>>>>>> +; Verbose diagnostics are suppressed but not errors. +; SUBST_SAME:{{.*}}error:{{.*}} + +; SUBST_SAME-V:<<<<<< +; SUBST_SAME-V-NEXT: 1: pre +; SUBST_SAME-V-NEXT:check:1 ^~~ +; SUBST_SAME-V-NEXT: 2: var +; SUBST_SAME-V-NEXT:same:2'0 !~~ error: match on wrong line +; SUBST_SAME-V-NEXT:same:2'1 with "VAR" equal to "var" +; SUBST_SAME-V-NEXT:>>>>>> + +; SUBST_SAME-Q:<<<<<< +; SUBST_SAME-Q-NEXT: 1: pre +; SUBST_SAME-Q-NEXT: 2: var +; SUBST_SAME-Q-NEXT:same:2 !~~ error: match on wrong line +; SUBST_SAME-Q-NEXT:>>>>>> ;- - - - - - - - - - - - - - - - - - - - - - - - - ; CHECK-DAG. @@ -851,19 +916,37 @@ ; RUN: echo 'CHECK-DAG: [[VAR]]' >> %t.chk ; RUN: echo 'CHECK: END' >> %t.chk -; RUN: %ProtectFileCheckOutput \ -; RUN: FileCheck -dump-input=always -vv -input-file=%t.in %t.chk 2>&1 \ -; RUN: -DVAR=var \ -; RUN: | FileCheck -match-full-lines %s -check-prefix=SUBST_DAG - -; SUBST_DAG:<<<<<< -; SUBST_DAG-NEXT: 1: var -; SUBST_DAG-NEXT:dag:1 ^~~ -; SUBST_DAG-NEXT:dag:2'0 !~~ discard: overlaps earlier match -; SUBST_DAG-NEXT:dag:2'1 with "VAR" equal to "var" -; SUBST_DAG-NEXT: 2: var -; SUBST_DAG-NEXT:dag:2'2 ^~~ -; SUBST_DAG-NEXT:dag:2'3 with "VAR" equal to "var" -; SUBST_DAG-NEXT: 3: END -; SUBST_DAG-NEXT:check:3 ^~~ -; SUBST_DAG-NEXT:>>>>>> +; REDEFINE: %{pre} = SUBST_DAG +; REDEFINE: %{opts} = -DVAR=var +; RUN: %{run-vv} +; RUN: %{run-v} +; RUN: %{run} +; REDEFINE: %{opts} = + +; SUBST_DAG-VV:<<<<<< +; SUBST_DAG-VV-NEXT: 1: var +; SUBST_DAG-VV-NEXT:dag:1 ^~~ +; SUBST_DAG-VV-NEXT:dag:2'0 !~~ discard: overlaps earlier match +; SUBST_DAG-VV-NEXT:dag:2'1 with "VAR" equal to "var" +; SUBST_DAG-VV-NEXT: 2: var +; SUBST_DAG-VV-NEXT:dag:2'2 ^~~ +; SUBST_DAG-VV-NEXT:dag:2'3 with "VAR" equal to "var" +; SUBST_DAG-VV-NEXT: 3: END +; SUBST_DAG-VV-NEXT:check:3 ^~~ +; SUBST_DAG-VV-NEXT:>>>>>> + +; SUBST_DAG-VQ:<<<<<< +; SUBST_DAG-VQ-NEXT: 1: var +; SUBST_DAG-VQ-NEXT:dag:1 ^~~ +; SUBST_DAG-VQ-NEXT: 2: var +; SUBST_DAG-VQ-NEXT:dag:2'0 ^~~ +; SUBST_DAG-VQ-NEXT:dag:2'1 with "VAR" equal to "var" +; SUBST_DAG-VQ-NEXT: 3: END +; SUBST_DAG-VQ-NEXT:check:3 ^~~ +; SUBST_DAG-VQ-NEXT:>>>>>> + +; SUBST_DAG-Q:<<<<<< +; SUBST_DAG-Q-NEXT: 1: var +; SUBST_DAG-Q-NEXT: 2: var +; SUBST_DAG-Q-NEXT: 3: END +; SUBST_DAG-Q-NEXT:>>>>>> diff --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp index faa568a791757..8c760db50a375 100644 --- a/llvm/utils/FileCheck/FileCheck.cpp +++ b/llvm/utils/FileCheck/FileCheck.cpp @@ -168,6 +168,16 @@ static cl::list<unsigned> DumpInputContexts( "this option, the largest specified <N> has precedence. The\n" "default is 5.\n")); +static cl::opt<unsigned> DumpInputLabelWidth( + "dump-input-label-width", cl::value_desc("N"), cl::init(0), cl::Hidden, + cl::desc("In the dump requested by -dump-input, set <N> as the minimum\n" + "width for the initial label column. When there are multiple\n" + "occurrences of this option, the last specified has precedence.\n" + "The default is 0, meaning that the actual labels fully\n" + "determine the width. FileCheck's own test suite uses this\n" + "option to avoid a fluctuating column width when checking input\n" + "dumps. This option is not expected to be useful elsewhere.\n")); + typedef cl::list<std::string>::const_iterator prefix_iterator; @@ -759,6 +769,7 @@ static void DumpAnnotatedInput(raw_ostream &OS, const FileCheckRequest &Req, // One space would be enough to achieve that, but more makes it even easier // to see. LabelWidthGlobal = std::max(LabelWidthGlobal, LineNoWidth) + 3; + LabelWidthGlobal = std::max(LabelWidthGlobal, DumpInputLabelWidth.getValue()); // Print annotated input lines. unsigned PrevLineInFilter = 0; // 0 means none so far _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
