[llvm] r274143 - [llvm-cov] Change some FileCheck prefixes to make tests reusable (NFC)
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 29 10:47:08 PDT 2016
Author: vedantk
Date: Wed Jun 29 12:47:08 2016
New Revision: 274143
URL: http://llvm.org/viewvc/llvm-project?rev=274143&view=rev
Log:
[llvm-cov] Change some FileCheck prefixes to make tests reusable (NFC)
I'm planning on extending these two tests with checks that validate
html coverage reports. Make it easier to extend them by not using a
prefix called "CHECK".
Modified:
llvm/trunk/test/tools/llvm-cov/showLineExecutionCounts.cpp
llvm/trunk/test/tools/llvm-cov/showTemplateInstantiations.cpp
Modified: llvm/trunk/test/tools/llvm-cov/showLineExecutionCounts.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/showLineExecutionCounts.cpp?rev=274143&r1=274142&r2=274143&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/showLineExecutionCounts.cpp (original)
+++ llvm/trunk/test/tools/llvm-cov/showLineExecutionCounts.cpp Wed Jun 29 12:47:08 2016
@@ -3,37 +3,37 @@
// before any coverage // WHOLE-FILE: | [[@LINE]]|// before
// FILTER-NOT: | [[@LINE-1]]|// before
-int main() { // CHECK: 161| [[@LINE]]|int main(
- int x = 0; // CHECK: 161| [[@LINE]]| int x
- // CHECK: 161| [[@LINE]]|
- if (x) { // CHECK: 0| [[@LINE]]| if (x)
- x = 0; // CHECK: 0| [[@LINE]]| x = 0
- } else { // CHECK: 161| [[@LINE]]| } else
- x = 1; // CHECK: 161| [[@LINE]]| x = 1
- } // CHECK: 161| [[@LINE]]| }
- // CHECK: 161| [[@LINE]]|
- for (int i = 0; i < 100; ++i) { // CHECK: 16.2k| [[@LINE]]| for (
- x = 1; // CHECK: 16.1k| [[@LINE]]| x = 1
- } // CHECK: 16.1k| [[@LINE]]| }
- // CHECK: 161| [[@LINE]]|
- x = x < 10 ? x + 1 : x - 1; // CHECK: 161| [[@LINE]]| x =
- x = x > 10 ? // CHECK: 161| [[@LINE]]| x =
- x - 1: // CHECK: 0| [[@LINE]]| x
- x + 1; // CHECK: 161| [[@LINE]]| x
- // CHECK: 161| [[@LINE]]|
- return 0; // CHECK: 161| [[@LINE]]| return
-} // CHECK: 161| [[@LINE]]|}
+int main() { // TEXT: 161| [[@LINE]]|int main(
+ int x = 0; // TEXT: 161| [[@LINE]]| int x
+ // TEXT: 161| [[@LINE]]|
+ if (x) { // TEXT: 0| [[@LINE]]| if (x)
+ x = 0; // TEXT: 0| [[@LINE]]| x = 0
+ } else { // TEXT: 161| [[@LINE]]| } else
+ x = 1; // TEXT: 161| [[@LINE]]| x = 1
+ } // TEXT: 161| [[@LINE]]| }
+ // TEXT: 161| [[@LINE]]|
+ for (int i = 0; i < 100; ++i) { // TEXT: 16.2k| [[@LINE]]| for (
+ x = 1; // TEXT: 16.1k| [[@LINE]]| x = 1
+ } // TEXT: 16.1k| [[@LINE]]| }
+ // TEXT: 161| [[@LINE]]|
+ x = x < 10 ? x + 1 : x - 1; // TEXT: 161| [[@LINE]]| x =
+ x = x > 10 ? // TEXT: 161| [[@LINE]]| x =
+ x - 1: // TEXT: 0| [[@LINE]]| x
+ x + 1; // TEXT: 161| [[@LINE]]| x
+ // TEXT: 161| [[@LINE]]|
+ return 0; // TEXT: 161| [[@LINE]]| return
+} // TEXT: 161| [[@LINE]]|}
// after coverage // WHOLE-FILE: | [[@LINE]]|// after
// FILTER-NOT: | [[@LINE-1]]|// after
-// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck -check-prefixes=CHECK,WHOLE-FILE %s
-// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -filename-equivalence -name=main %s | FileCheck -check-prefixes=CHECK,FILTER %s
+// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck -check-prefixes=TEXT,WHOLE-FILE %s
+// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -filename-equivalence -name=main %s | FileCheck -check-prefixes=TEXT,FILTER %s
// Test -output-dir.
// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -o %t.dir -instr-profile %t.profdata -filename-equivalence %s
// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -output-dir %t.dir -instr-profile %t.profdata -filename-equivalence -name=main %s
-// RUN: FileCheck -check-prefixes=CHECK,WHOLE-FILE -input-file %t.dir/coverage/tmp/showLineExecutionCounts.cpp.txt %s
-// RUN: FileCheck -check-prefixes=CHECK,FILTER -input-file %t.dir/functions.txt %s
+// RUN: FileCheck -check-prefixes=TEXT,WHOLE-FILE -input-file %t.dir/coverage/tmp/showLineExecutionCounts.cpp.txt %s
+// RUN: FileCheck -check-prefixes=TEXT,FILTER -input-file %t.dir/functions.txt %s
//
// Test index creation.
// RUN: FileCheck -check-prefix=INDEX -input-file %t.dir/index.txt %s
Modified: llvm/trunk/test/tools/llvm-cov/showTemplateInstantiations.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/showTemplateInstantiations.cpp?rev=274143&r1=274142&r2=274143&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/showTemplateInstantiations.cpp (original)
+++ llvm/trunk/test/tools/llvm-cov/showTemplateInstantiations.cpp Wed Jun 29 12:47:08 2016
@@ -1,5 +1,5 @@
-// RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -filename-equivalence %s | FileCheck -check-prefix=CHECK -check-prefix=ALL %s
-// RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -filename-equivalence -name=_Z4funcIbEiT_ %s | FileCheck -check-prefix=CHECK -check-prefix=FILTER %s
+// RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -filename-equivalence %s | FileCheck -check-prefixes=SHARED,ALL %s
+// RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -filename-equivalence -name=_Z4funcIbEiT_ %s | FileCheck -check-prefixes=SHARED,FILTER %s
// before coverage // ALL: | [[@LINE]]|// before
// FILTER-NOT: | [[@LINE-1]]|// before
@@ -12,14 +12,14 @@ int func(T x) { // ALL-NEXT: 2|
int j = 1; // ALL-NEXT: 0| [[@LINE]]| int j = 1;
} // ALL-NEXT: 2| [[@LINE]]|}
- // CHECK: {{^ *(\| )?}}_Z4funcIbEiT_:
- // CHECK-NEXT: 1| [[@LINE-9]]|int func(T x) {
- // CHECK-NEXT: 1| [[@LINE-9]]| if(x)
- // CHECK-NEXT: 1| [[@LINE-9]]| return 0;
- // CHECK-NEXT: 1| [[@LINE-9]]| else
- // CHECK-NEXT: 0| [[@LINE-9]]| return 1;
- // CHECK-NEXT: 0| [[@LINE-9]]| int j = 1;
- // CHECK-NEXT: 1| [[@LINE-9]]|}
+ // SHARED: {{^ *(\| )?}}_Z4funcIbEiT_:
+ // SHARED-NEXT: 1| [[@LINE-9]]|int func(T x) {
+ // SHARED-NEXT: 1| [[@LINE-9]]| if(x)
+ // SHARED-NEXT: 1| [[@LINE-9]]| return 0;
+ // SHARED-NEXT: 1| [[@LINE-9]]| else
+ // SHARED-NEXT: 0| [[@LINE-9]]| return 1;
+ // SHARED-NEXT: 0| [[@LINE-9]]| int j = 1;
+ // SHARED-NEXT: 1| [[@LINE-9]]|}
// ALL: {{^ *}}| _Z4funcIiEiT_:
// FILTER-NOT: {{^ *(\| )?}} _Z4funcIiEiT_:
More information about the llvm-commits
mailing list