Allow multiple check prefixes in FileCheck.

This is useful if you want to run multiple variations
of a single test, and the majority of check lines
should be the same.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194343 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matt Arsenault
2013-11-10 02:04:09 +00:00
parent 432bdf6571
commit ee4f5eae1c
15 changed files with 353 additions and 87 deletions
+5
View File
@@ -0,0 +1,5 @@
; RUN: FileCheck -check-prefix=A -check-prefix=B -input-file %s %s
this is the string to be matched
; B-DAG: this is the string to be {{matched}}
+5
View File
@@ -0,0 +1,5 @@
; RUN: FileCheck -check-prefix=B -check-prefix=A -input-file %s %s
this is the string to be matched
; B-DAG: this is the string to be {{matched}}
@@ -0,0 +1,7 @@
; RUN: FileCheck -check-prefix=A -input-file %s %s
this should be matched
; B-DAG: foo
; A-DAG: {{this}} should be matched
+27
View File
@@ -0,0 +1,27 @@
; RUN: FileCheck -check-prefix=A -check-prefix=B -input-file %s %s
add r10, r1, r2
add r11, r3, r4
mul r5, r10, r11
mul r11, r3, r4
mul r10, r1, r2
add r5, r10, r11
add r11, r3, r4
add r10, r1, r2
mul r5, r10, r11
; B-DAG: add [[REG1:r[0-9]+]], r1, r2
; B-DAG: add [[REG2:r[0-9]+]], r3, r4
; B: mul r5, [[REG1]], [[REG2]]
; A-DAG: mul [[REG1:r[0-9]+]], r1, r2
; A-DAG: mul [[REG2:r[0-9]+]], r3, r4
; A: add r5, [[REG1]], [[REG2]]
; B-DAG: add [[REG1:r[0-9]+]], r1, r2
; B-DAG: add [[REG2:r[0-9]+]], r3, r4
; B-NOT: xor
; B-DAG: mul r5, [[REG1]], [[REG2]]
@@ -0,0 +1,7 @@
; RUN: not FileCheck -check-prefix=A -check-prefix=AA -input-file %s %s
this is the string to be matched
this should also be matched
; BAA-DAG: this is the string to be {{matched}}
; BAA-DAG: this should also be {{matched}}
@@ -0,0 +1,6 @@
// RUN: FileCheck -check-prefix=ONE -check-prefix=TWO -input-file %s %s
foo
bar
; ONE-LABEL: {{f}}oo
; TWO-NEXT: {{b}}ar
@@ -0,0 +1,10 @@
// RUN: FileCheck -check-prefix=B -check-prefix=BOTH -input-file %s %s
// RUN: FileCheck -check-prefix=A -check-prefix=BOTH -input-file %s %s
; A: {{a}}aaaaa
; B: {{b}}bbbb
; BOTH: {{q}}qqqqq
aaaaaa
bbbbb
qqqqqq
ccccc
@@ -0,0 +1,11 @@
; RUN: FileCheck -check-prefix=FOO -check-prefix=FOOBAR -check-prefix=BARFOO -input-file %s %s
; RUN: FileCheck -check-prefix=FOOBAR -check-prefix=FOO -check-prefix=BARFOO -input-file %s %s
; RUN: FileCheck -check-prefix=FOOBAR -check-prefix=BARFOO -check-prefix=FOO -input-file %s %s
this is the match
this is another
FOO
FOOBAR
FOOBAR: this is the {{match}}
BARFOO: this is {{another}}
@@ -0,0 +1,9 @@
// RUN: FileCheck -check-prefix=AAAOVERLAP -check-prefix=OVERLAP -input-file %s %s
foo
bar
buzz
OVERLAP: foo
AAAOVERLAP: bar
OVERLAP: buzz
+2
View File
@@ -0,0 +1,2 @@
RUN: FileCheck -check-prefix=RUN -input-file %s %s
// Prefix is at the first character in the file. The run line then matches itself.
@@ -0,0 +1,9 @@
// RUN: FileCheck -check-prefix=ANOTHER-PREFIX -input-file %s %s
// RUN: not FileCheck -check-prefix=PREFIX1 -check-prefix=PREFIX2 -input-file %s %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK-NONEXISTENT-PREFIX -check-prefix=ALSO-NONEXISTENT %s
foobar
; ANOTHER-PREFIX: foobar
; We use regex to match the colon so that FileCheck won't think it is a check
; prefix.
; CHECK-NONEXISTENT-PREFIX: error: no check strings found with prefixes 'PREFIX1{{:}}', 'PREFIX2{{:}}'
+7
View File
@@ -0,0 +1,7 @@
// RUN: not FileCheck -check-prefix=SOMEPREFIX -input-file %s %s
// RUN: FileCheck -check-prefix=ANOTHER -input-file %s %s
asdf
; SOMEPREFIX: {{t}}his_is_not_asdf
; ANOTHER: {{a}}sdf
+4 -2
View File
@@ -1,7 +1,9 @@
// RUN: not FileCheck -check-prefix=A! -input-file %s %s 2>&1 | FileCheck -check-prefix=BAD_PREFIX %s
// RUN: FileCheck -check-prefix=A1a-B_c -input-file %s %s
// RUN: not FileCheck -check-prefix=REPEAT -check-prefix=REPEAT -input-file %s %s 2>&1 | FileCheck -check-prefix=BAD_PREFIX %s
// RUN: not FileCheck -check-prefix=VALID -check-prefix=A! -input-file %s %s 2>&1 | FileCheck -check-prefix=BAD_PREFIX %s
foobar
; A1a-B_c: foobar
; BAD_PREFIX: Supplied check-prefix is invalid! Prefixes must start with a letter and contain only alphanumeric characters, hyphens and underscores
; BAD_PREFIX: Supplied check-prefix is invalid! Prefixes must be
unique and start with a letter and contain only alphanumeric characters, hyphens and underscores