mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
20f8c79d86
A more general name might be match-time error propagation. That is, it's conceivable we'll one day have non-numeric errors that require the handling fixed by this patch. Without this patch, FileCheck behaves as follows: ``` $ cat check CHECK-NOT: [[#0x8000000000000000+0x8000000000000000]] $ FileCheck -vv -dump-input=never check < input check:1:54: remark: implicit EOF: expected string found in input CHECK-NOT: [[#0x8000000000000000+0x8000000000000000]] ^ <stdin>:2:1: note: found here ^ check:1:15: error: unable to substitute variable or numeric expression: overflow error CHECK-NOT: [[#0x8000000000000000+0x8000000000000000]] ^ $ echo $? 0 ``` Notice that the exit status is 0 even though there's an error. Moreover, FileCheck doesn't print the error diagnostic unless both `-dump-input=never` and `-vv` are specified. The same problem occurs when `CHECK-NOT` does have a match but a capture fails due to overflow: exit status is 0, and no diagnostic is printed unless both `-dump-input=never` and `-vv` are specified. The usefulness of capturing from `CHECK-NOT` is questionable, but this case should certainly produce an error. With this patch, FileCheck always includes the error diagnostic and has non-zero exit status for the above examples. It's conceivable that this change will cause some existing tests to fail, but my assumption is that they should fail. Moreover, with nearly every project enabled, this patch didn't produce additional `check-all` failures for me. This patch also extends input dumps to include such numeric error diagnostics for both expected and excluded patterns. As noted in fixmes in some of the tests added by this patch, this patch worsens an existing issue with redundant diagnostics. I'll fix that bug in a subsequent patch. Reviewed By: thopre, jhenderson Differential Revision: https://reviews.llvm.org/D98086
64 lines
2.3 KiB
Plaintext
64 lines
2.3 KiB
Plaintext
; Check handling of diagnostics for problematic matches (e.g., variable capture
|
|
; overflow) in the case of expected patterns (e.g., CHECK).
|
|
|
|
RUN: echo > %t.chk 'CHECK: [[#122+1]] [[STR:abc]] [[#NUM:]]'
|
|
RUN: echo > %t.in '123 abc 1000000000000000000000000000000000000000000000000000'
|
|
|
|
ERR-NOT:{{.}}
|
|
ERR:{{.*}}: remark: CHECK: expected string found in input
|
|
ERR-NEXT:CHECK: {{.*}}
|
|
ERR-NEXT:{{ *}}^
|
|
ERR-NEXT:<stdin>:1:1: note: found here
|
|
ERR-NEXT:123 abc 10{{0*}}
|
|
ERR-NEXT:^~~~~~~~~{{~*}}
|
|
ERR-NEXT:<stdin>:1:1: note: with "122+1" equal to "123"
|
|
ERR-NEXT:123 abc 10{{0*}}
|
|
ERR-NEXT:^
|
|
ERR-NEXT:<stdin>:1:5: note: captured var "STR"
|
|
ERR-NEXT:123 abc 10{{0*}}
|
|
ERR-NEXT: ^~~
|
|
ERR-NEXT:<stdin>:1:9: error: unable to represent numeric value
|
|
ERR-NEXT:123 abc 10{{0*}}
|
|
ERR-NEXT: ^
|
|
ERR-NOT:{{error|note|remark}}:
|
|
|
|
DUMP:<<<<<<
|
|
DUMP-NEXT: 1: 123 abc 10{{0*}}
|
|
DUMP-NEXT:check:1'0 ^~~~~~~~~~{{~*}}
|
|
DUMP-NEXT:check:1'1 with "122+1" equal to "123"
|
|
DUMP-NEXT:check:1'2 ^~~ captured var "STR"
|
|
DUMP-NEXT:check:1'3 !~{{~*}} error: unable to represent numeric value
|
|
DUMP-NEXT:>>>>>>
|
|
|
|
;--------------------------------------------------
|
|
; Check -dump-input=never cases.
|
|
;--------------------------------------------------
|
|
|
|
RUN: %ProtectFileCheckOutput \
|
|
RUN: not FileCheck -dump-input=never %t.chk < %t.in 2>&1 \
|
|
RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR
|
|
|
|
RUN: %ProtectFileCheckOutput \
|
|
RUN: not FileCheck -dump-input=never -v %t.chk < %t.in 2>&1 \
|
|
RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR
|
|
|
|
RUN: %ProtectFileCheckOutput \
|
|
RUN: not FileCheck -dump-input=never -vv %t.chk < %t.in 2>&1 \
|
|
RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR
|
|
|
|
;--------------------------------------------------
|
|
; Check -dump-input=fail cases.
|
|
;--------------------------------------------------
|
|
|
|
RUN: %ProtectFileCheckOutput \
|
|
RUN: not FileCheck -dump-input=fail %t.chk < %t.in 2>&1 \
|
|
RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR,DUMP
|
|
|
|
RUN: %ProtectFileCheckOutput \
|
|
RUN: not FileCheck -dump-input=fail -v %t.chk < %t.in 2>&1 \
|
|
RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR,DUMP
|
|
|
|
RUN: %ProtectFileCheckOutput \
|
|
RUN: not FileCheck -dump-input=fail -vv %t.chk < %t.in 2>&1 \
|
|
RUN: | FileCheck %s -match-full-lines -check-prefixes=ERR,DUMP
|