diff options
| author | Joel E. Denny <jdenny.ornl@gmail.com> | 2018-12-18 00:02:47 +0000 |
|---|---|---|
| committer | Joel E. Denny <jdenny.ornl@gmail.com> | 2018-12-18 00:02:47 +0000 |
| commit | 0e7e3fa0e9a5dac6bf42f4771768968460ab48a8 (patch) | |
| tree | cc2243aa8bd79eaac4c4bee3aafbf77351049b38 /llvm/test/FileCheck | |
| parent | cadfcef493d4b31421558a03b895262e3d7769da (diff) | |
| download | bcm5719-llvm-0e7e3fa0e9a5dac6bf42f4771768968460ab48a8.tar.gz bcm5719-llvm-0e7e3fa0e9a5dac6bf42f4771768968460ab48a8.zip | |
[FileCheck] Annotate input dump (4/7)
This patch implements input annotations for diagnostics that report
unexpected matches for CHECK-NOT. Like wrong-line matches for
CHECK-NEXT, CHECK-SAME, and CHECK-EMPTY, these annotations mark match
ranges using red `!~~` to indicate bad matches that are errors.
For example:
```
$ FileCheck -dump-input=help
The following description was requested by -dump-input=help to
explain the input annotations printed by -dump-input=always and
-dump-input=fail:
- L: labels line number L of the input file
- T:L labels the only match result for a pattern of type T from line L of
the check file
- T:L'N labels the Nth match result for a pattern of type T from line L of
the check file
- !~~ marks bad match, such as:
- CHECK-NEXT on same line as previous match (error)
- CHECK-NOT found (error)
- X~~ marks search range when no match is found, such as:
- CHECK-NEXT not found (error)
- ? marks fuzzy match when no match is found
- colors error, fuzzy match
If you are not seeing color above or in input dumps, try: -color
$ FileCheck -v -dump-input=always check3 < input3 |& sed -n '/^<<<</,$p'
<<<<<<
1: abc foobar def
not:2 !~~~~~ error: no match expected
>>>>>>
$ cat check3
CHECK: abc
CHECK-NOT: foobar
CHECK: def
$ cat input3
abc foobar def
```
Reviewed By: george.karpenkov, probinson
Differential Revision: https://reviews.llvm.org/D53896
llvm-svn: 349421
Diffstat (limited to 'llvm/test/FileCheck')
| -rw-r--r-- | llvm/test/FileCheck/dump-input-annotations.txt | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/llvm/test/FileCheck/dump-input-annotations.txt b/llvm/test/FileCheck/dump-input-annotations.txt index d225ed2bd14..c808fb2c6d4 100644 --- a/llvm/test/FileCheck/dump-input-annotations.txt +++ b/llvm/test/FileCheck/dump-input-annotations.txt @@ -235,6 +235,53 @@ ; EMP2-NOT: {{.}} ;-------------------------------------------------- +; CHECK-NOT +;-------------------------------------------------- + +; No match (success) and unexpected match (error). + +; RUN: echo 'hello' > %t.in +; RUN: echo 'world' >> %t.in +; RUN: echo 'again' >> %t.in + +; RUN: echo 'CHECK-NOT: goodbye' > %t.chk +; RUN: echo 'CHECK-NOT: world' >> %t.chk + +; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \ +; RUN: | FileCheck -match-full-lines %s -check-prefix=NOT +; 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: 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 + +; NOT: <<<<<< +; NOT-NEXT: 1: hello +; NOT-NEXT: 2: world +; NOT-NEXT: not:2 !~~~~ error: no match expected +; NOT-NEXT: 3: again +; NOT-NEXT: >>>>>> +; NOT-NOT: {{.}} + +; Again, but with a CHECK instead of EOF as search range end. + +; RUN: echo 'CHECK: ain' >> %t.chk + +; RUN: not FileCheck -dump-input=always -input-file %t.in %t.chk 2>&1 \ +; RUN: | FileCheck -match-full-lines %s -check-prefix=NOT2 +; 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: 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 + +; NOT2: <<<<<< +; NOT2-NEXT: 1: hello +; NOT2-NEXT: 2: world +; NOT2-NEXT: not:2 !~~~~ error: no match expected +; NOT2-NEXT: 3: again +; NOT2-NEXT: >>>>>> +; NOT2-NOT: {{.}} + +;-------------------------------------------------- ; CHECK-DAG ;-------------------------------------------------- |

