diff options
| author | Fedor Sergeev <fedor.sergeev@azul.com> | 2018-11-13 00:46:13 +0000 |
|---|---|---|
| committer | Fedor Sergeev <fedor.sergeev@azul.com> | 2018-11-13 00:46:13 +0000 |
| commit | 6c9e19b504f456090ff0060288e3d851ac3ad666 (patch) | |
| tree | bd3d33df29b5c9802d002c9b487f0131d56dfc68 /llvm/test/FileCheck | |
| parent | 106946329d579ec1036a511e3770a8f9f84a4a82 (diff) | |
| download | bcm5719-llvm-6c9e19b504f456090ff0060288e3d851ac3ad666.tar.gz bcm5719-llvm-6c9e19b504f456090ff0060288e3d851ac3ad666.zip | |
[FileCheck] introduce CHECK-COUNT-<num> repetition directive
In some cases it is desirable to match the same pattern repeatedly
many times. Currently the only way to do it is to copy the same
check pattern as many times as needed. And that gets pretty unwieldy
when its more than count is big.
Introducing CHECK-COUNT-<num> directive which acts like a plain CHECK
directive yet matches the same pattern exactly <num> times.
Extended FileCheckType to a struct to add Count there.
Changed some parsing routines to handle non-fixed length of directive
(all currently existing directives were fixed-length).
The code is generic enough to allow future support for COUNT in more
than just PlainCheck directives.
See motivating example for this feature in reviews.llvm.org/D54223.
Reviewed By: chandlerc, dblaikie
Differential Revision: https://reviews.llvm.org/D54336
llvm-svn: 346722
Diffstat (limited to 'llvm/test/FileCheck')
| -rw-r--r-- | llvm/test/FileCheck/check-count.txt | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/llvm/test/FileCheck/check-count.txt b/llvm/test/FileCheck/check-count.txt new file mode 100644 index 00000000000..1782728949a --- /dev/null +++ b/llvm/test/FileCheck/check-count.txt @@ -0,0 +1,100 @@ +; +; Basic error checking. +; + +this is something else + +; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-ERR1 2>&1 | FileCheck %s --check-prefix=ERRCOUNT1 +CHECK-ERR1-COUNT-xx: this +ERRCOUNT1: [[@LINE-1]]:18: error: invalid count in -COUNT specification on prefix 'CHECK-ERR1' + +; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-ERR2 2>&1 | FileCheck %s --check-prefix=ERRCOUNT2 +CHECK-ERR2-COUNT-0x1: something +ERRCOUNT2: [[@LINE-1]]:19: error: invalid count in -COUNT specification on prefix 'CHECK-ERR2' + +; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-ERR3 2>&1 | FileCheck %s --check-prefix=ERRCOUNT3 +CHECK-ERR3-COUNT-100x: else +ERRCOUNT3: [[@LINE-1]]:21: error: invalid count in -COUNT specification on prefix 'CHECK-ERR3' + +; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-ERR4 2>&1 | FileCheck %s --check-prefix=ERRCOUNT4 +CHECK-ERR4-COUNT-0: else +ERRCOUNT4: [[@LINE-1]]:19: error: invalid count in -COUNT specification on prefix 'CHECK-ERR4' + +; +; Main functionality +; + +this is duplicate +this is duplicate +this is not duplicate +this is duplicate +this is duplicate +this is duplicate + +; RUN: FileCheck %s --input-file %s --check-prefix=CHECK-CNT1 +CHECK-CNT1-COUNT-1: this is duplicate +CHECK-CNT1: this is duplicate +CHECK-CNT1-NEXT: this is not duplicate + +; RUN: FileCheck %s --input-file %s --check-prefix=CHECK-CNT2 +CHECK-CNT2-COUNT-2: this is duplicate +CHECK-CNT2: this is not duplicate + +; RUN: FileCheck %s --input-file %s --check-prefix=CHECK-CNT3 +CHECK-CNT3-COUNT-2: this is duplicate +CHECK-CNT3: this is not duplicate +CHECK-CNT3-COUNT-3: this is duplicate +CHECK-CNT3-NOT: {{^}}this is duplicate + +; RUN: FileCheck %s --input-file %s --check-prefix=CHECK-CNT4 +CHECK-CNT4-COUNT-5: this is duplicate +CHECK-CNT4-EMPTY: + +Many-label: + +-many- +-many- +-many- +-many- +-many- +-many- +-many- +-many- +-many- +-many- +-many- +-many- +-many- +-many- +-many- +-many- + +; RUN: FileCheck %s --input-file %s --check-prefix=CHECK-CNTMANY +CHECK-CNTMANY-COUNT-2: this is duplicate +CHECK-CNTMANY-LABEL: Many-label: +CHECK-CNTMANY-EMPTY: +CHECK-CNTMANY-COUNT-16: {{^}}-many- +CHECK-CNTMANY-EMPTY: + +; +; Tests on mismatches: +; + +; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-MIS1 2>&1 | FileCheck %s --check-prefix=MISCOUNT1 +CHECK-MIS1-COUNT-3: this is duplicate +CHECK-MIS1: {{^}}this is not duplicate +MISCOUNT1: [[@LINE-1]]:13: error: CHECK-MIS1: expected string not found in input + +; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-MIS2 2>&1 | FileCheck %s --check-prefix=MISCOUNT2 +CHECK-MIS2-COUNT-10: {{^this is duplicate}} +CHECK-MIS2: {{^}}this is not duplicate +MISCOUNT2: [[@LINE-2]]:22: error: CHECK-MIS2-COUNT: expected string not found in input + +; RUN: not FileCheck %s --input-file %s --check-prefix=CHECK-MIS3 2>&1 | FileCheck %s --check-prefix=MISCOUNT3 +CHECK-MIS3-COUNT-5: this is duplicate +CHECK-MIS3-EMPTY: +CHECK-MIS3-LABEL: Many-label: +CHECK-MIS3-EMPTY: +CHECK-MIS3-COUNT-160: {{^}}-many- +CHECK-MIS3-EMPTY: +MISCOUNT3: [[@LINE-2]]:23: error: CHECK-MIS3-COUNT: expected string not found in input (17 out of 160) |

