From ee4f5eae1c416eddbecbb2d742e2bb8dc0032bf6 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Sun, 10 Nov 2013 02:04:09 +0000 Subject: 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 --- test/FileCheck/check-a-b-has-b.txt | 5 +++++ test/FileCheck/check-b-a-has-b.txt | 5 +++++ test/FileCheck/check-dag-multi-prefix-2.txt | 7 ++++++ test/FileCheck/check-dag-multi-prefix.txt | 27 +++++++++++++++++++++++ test/FileCheck/check-dag-substring-prefix.txt | 7 ++++++ test/FileCheck/check-multi-prefix-label.txt | 6 +++++ test/FileCheck/check-multiple-prefixes-mixed.txt | 10 +++++++++ test/FileCheck/check-substring-multi-prefix-2.txt | 11 +++++++++ test/FileCheck/check-substring-multi-prefix.txt | 9 ++++++++ test/FileCheck/first-character-match.txt | 2 ++ test/FileCheck/multiple-missing-prefixes.txt | 9 ++++++++ test/FileCheck/separate-multi-prefix.txt | 7 ++++++ test/FileCheck/validate-check-prefix.txt | 6 +++-- 13 files changed, 109 insertions(+), 2 deletions(-) create mode 100644 test/FileCheck/check-a-b-has-b.txt create mode 100644 test/FileCheck/check-b-a-has-b.txt create mode 100644 test/FileCheck/check-dag-multi-prefix-2.txt create mode 100644 test/FileCheck/check-dag-multi-prefix.txt create mode 100644 test/FileCheck/check-dag-substring-prefix.txt create mode 100644 test/FileCheck/check-multi-prefix-label.txt create mode 100644 test/FileCheck/check-multiple-prefixes-mixed.txt create mode 100644 test/FileCheck/check-substring-multi-prefix-2.txt create mode 100644 test/FileCheck/check-substring-multi-prefix.txt create mode 100644 test/FileCheck/first-character-match.txt create mode 100644 test/FileCheck/multiple-missing-prefixes.txt create mode 100644 test/FileCheck/separate-multi-prefix.txt (limited to 'test/FileCheck') diff --git a/test/FileCheck/check-a-b-has-b.txt b/test/FileCheck/check-a-b-has-b.txt new file mode 100644 index 0000000000..4d64d098ae --- /dev/null +++ b/test/FileCheck/check-a-b-has-b.txt @@ -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}} diff --git a/test/FileCheck/check-b-a-has-b.txt b/test/FileCheck/check-b-a-has-b.txt new file mode 100644 index 0000000000..ac149906c5 --- /dev/null +++ b/test/FileCheck/check-b-a-has-b.txt @@ -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}} diff --git a/test/FileCheck/check-dag-multi-prefix-2.txt b/test/FileCheck/check-dag-multi-prefix-2.txt new file mode 100644 index 0000000000..4add70da16 --- /dev/null +++ b/test/FileCheck/check-dag-multi-prefix-2.txt @@ -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 diff --git a/test/FileCheck/check-dag-multi-prefix.txt b/test/FileCheck/check-dag-multi-prefix.txt new file mode 100644 index 0000000000..95dfe5a519 --- /dev/null +++ b/test/FileCheck/check-dag-multi-prefix.txt @@ -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]] + diff --git a/test/FileCheck/check-dag-substring-prefix.txt b/test/FileCheck/check-dag-substring-prefix.txt new file mode 100644 index 0000000000..49d4b2b9ba --- /dev/null +++ b/test/FileCheck/check-dag-substring-prefix.txt @@ -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}} diff --git a/test/FileCheck/check-multi-prefix-label.txt b/test/FileCheck/check-multi-prefix-label.txt new file mode 100644 index 0000000000..41fe64151d --- /dev/null +++ b/test/FileCheck/check-multi-prefix-label.txt @@ -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 diff --git a/test/FileCheck/check-multiple-prefixes-mixed.txt b/test/FileCheck/check-multiple-prefixes-mixed.txt new file mode 100644 index 0000000000..cd3b70a425 --- /dev/null +++ b/test/FileCheck/check-multiple-prefixes-mixed.txt @@ -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 diff --git a/test/FileCheck/check-substring-multi-prefix-2.txt b/test/FileCheck/check-substring-multi-prefix-2.txt new file mode 100644 index 0000000000..618a2884d4 --- /dev/null +++ b/test/FileCheck/check-substring-multi-prefix-2.txt @@ -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}} diff --git a/test/FileCheck/check-substring-multi-prefix.txt b/test/FileCheck/check-substring-multi-prefix.txt new file mode 100644 index 0000000000..b7edb8b530 --- /dev/null +++ b/test/FileCheck/check-substring-multi-prefix.txt @@ -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 diff --git a/test/FileCheck/first-character-match.txt b/test/FileCheck/first-character-match.txt new file mode 100644 index 0000000000..4b09c21df5 --- /dev/null +++ b/test/FileCheck/first-character-match.txt @@ -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. diff --git a/test/FileCheck/multiple-missing-prefixes.txt b/test/FileCheck/multiple-missing-prefixes.txt new file mode 100644 index 0000000000..cb557d9f26 --- /dev/null +++ b/test/FileCheck/multiple-missing-prefixes.txt @@ -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{{:}}' diff --git a/test/FileCheck/separate-multi-prefix.txt b/test/FileCheck/separate-multi-prefix.txt new file mode 100644 index 0000000000..5578d7f1b9 --- /dev/null +++ b/test/FileCheck/separate-multi-prefix.txt @@ -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 + diff --git a/test/FileCheck/validate-check-prefix.txt b/test/FileCheck/validate-check-prefix.txt index fe219a319c..db3392d581 100644 --- a/test/FileCheck/validate-check-prefix.txt +++ b/test/FileCheck/validate-check-prefix.txt @@ -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 -- cgit v1.2.3