[compiler-rt] r338453 - [gcov] Add tests using switch, one with break clauses and one with fallthrough
Marco Castelluccio via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 31 16:26:50 PDT 2018
Author: marco
Date: Tue Jul 31 16:26:50 2018
New Revision: 338453
URL: http://llvm.org/viewvc/llvm-project?rev=338453&view=rev
Log:
[gcov] Add tests using switch, one with break clauses and one with fallthrough
Added:
compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch1.c
compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch1.c.gcov
compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch2.c
compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch2.c.gcov
compiler-rt/trunk/test/profile/instrprof-gcov-switch.test
Added: compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch1.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch1.c?rev=338453&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch1.c (added)
+++ compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch1.c Tue Jul 31 16:26:50 2018
@@ -0,0 +1,18 @@
+int main(void)
+{
+ int i = 22;
+
+ switch (i) {
+ case 7:
+ break;
+
+ case 22:
+ i = 7;
+ break;
+
+ case 42:
+ break;
+ }
+
+ return 0;
+}
Added: compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch1.c.gcov
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch1.c.gcov?rev=338453&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch1.c.gcov (added)
+++ compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch1.c.gcov Tue Jul 31 16:26:50 2018
@@ -0,0 +1,23 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-gcov-switch1.c
+// CHECK-NEXT: -: 0:Graph:instrprof-gcov-switch1.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-gcov-switch1.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: -: 1:int main(void)
+// CHECK-NEXT: -: 2:{
+// CHECK-NEXT: 2: 3: int i = 22;
+// CHECK-NEXT: -: 4:
+// CHECK-NEXT: 2: 5: switch (i) {
+// CHECK-NEXT: -: 6: case 7:
+// CHECK-NEXT: #####: 7: break;
+// CHECK-NEXT: -: 8:
+// CHECK-NEXT: -: 9: case 22:
+// CHECK-NEXT: 1: 10: i = 7;
+// CHECK-NEXT: 1: 11: break;
+// CHECK-NEXT: -: 12:
+// CHECK-NEXT: -: 13: case 42:
+// CHECK-NEXT: #####: 14: break;
+// CHECK-NEXT: -: 15: }
+// CHECK-NEXT: -: 16:
+// CHECK-NEXT: 1: 17: return 0;
+// CHECK-NEXT: -: 18:}
Added: compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch2.c?rev=338453&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch2.c (added)
+++ compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch2.c Tue Jul 31 16:26:50 2018
@@ -0,0 +1,18 @@
+int main(void)
+{
+ int i = 22;
+
+ switch (i) {
+ case 7:
+ break;
+
+ case 22:
+ i = 7;
+
+ case 42:
+ i = 22;
+ break;
+ }
+
+ return 0;
+}
Added: compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch2.c.gcov
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch2.c.gcov?rev=338453&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch2.c.gcov (added)
+++ compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-switch2.c.gcov Tue Jul 31 16:26:50 2018
@@ -0,0 +1,23 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-gcov-switch2.c
+// CHECK-NEXT: -: 0:Graph:instrprof-gcov-switch2.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-gcov-switch2.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: -: 1:int main(void)
+// CHECK-NEXT: -: 2:{
+// CHECK-NEXT: 3: 3: int i = 22;
+// CHECK-NEXT: -: 4:
+// CHECK-NEXT: 3: 5: switch (i) {
+// CHECK-NEXT: -: 6: case 7:
+// CHECK-NEXT: #####: 7: break;
+// CHECK-NEXT: -: 8:
+// CHECK-NEXT: -: 9: case 22:
+// CHECK-NEXT: 1: 10: i = 7;
+// CHECK-NEXT: -: 11:
+// CHECK-NEXT: -: 12: case 42:
+// CHECK-NEXT: 1: 13: i = 22;
+// CHECK-NEXT: 1: 14: break;
+// CHECK-NEXT: -: 15: }
+// CHECK-NEXT: -: 16:
+// CHECK-NEXT: 1: 17: return 0;
+// CHECK-NEXT: -: 18:}
Added: compiler-rt/trunk/test/profile/instrprof-gcov-switch.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-gcov-switch.test?rev=338453&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/instrprof-gcov-switch.test (added)
+++ compiler-rt/trunk/test/profile/instrprof-gcov-switch.test Tue Jul 31 16:26:50 2018
@@ -0,0 +1,16 @@
+RUN: mkdir -p %t.d
+RUN: cd %t.d
+
+RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-switch1.c
+RUN: test -f instrprof-gcov-switch1.gcno
+RUN: rm -f instrprof-gcov-switch1.gcda
+RUN: %run %t
+RUN: llvm-cov gcov instrprof-gcov-switch1.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-switch1.c.gcov %S/Inputs/instrprof-gcov-switch1.c.gcov
+
+RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-switch2.c
+RUN: test -f instrprof-gcov-switch2.gcno
+RUN: rm -f instrprof-gcov-switch2.gcda
+RUN: %run %t
+RUN: llvm-cov gcov instrprof-gcov-switch2.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-switch2.c.gcov %S/Inputs/instrprof-gcov-switch2.c.gcov
More information about the llvm-commits
mailing list