summaryrefslogtreecommitdiff
path: root/test/profile
diff options
context:
space:
mode:
authorMarco Castelluccio <mcastelluccio@mozilla.com>2018-11-07 09:38:26 +0000
committerMarco Castelluccio <mcastelluccio@mozilla.com>2018-11-07 09:38:26 +0000
commit0b881f23c6f2a637ab97d71e964cc3743fef98b8 (patch)
tree5be59b602db839a1cd0f679d14c3422b0cefd638 /test/profile
parentad472ad24487b137aec5458d0d896a540d233212 (diff)
downloadcompiler-rt-0b881f23c6f2a637ab97d71e964cc3743fef98b8.tar.gz
[GCOV] Close file mapping handle on Windows, so flushed gcda files can be removed while the process is in execution
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@346300 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/profile')
-rw-r--r--test/profile/Inputs/instrprof-gcov-__gcov_flush-multiple.c16
-rw-r--r--test/profile/Inputs/instrprof-gcov-__gcov_flush-multiple.c.gcov21
-rw-r--r--test/profile/instrprof-gcov-__gcov_flush-multiple.test10
3 files changed, 47 insertions, 0 deletions
diff --git a/test/profile/Inputs/instrprof-gcov-__gcov_flush-multiple.c b/test/profile/Inputs/instrprof-gcov-__gcov_flush-multiple.c
new file mode 100644
index 000000000..dadd89599
--- /dev/null
+++ b/test/profile/Inputs/instrprof-gcov-__gcov_flush-multiple.c
@@ -0,0 +1,16 @@
+int main(void) {
+ __gcov_flush();
+
+ if (remove("instrprof-gcov-__gcov_flush-multiple.gcda") != 0) {
+ return 1;
+ }
+
+ __gcov_flush();
+ __gcov_flush();
+
+ if (remove("instrprof-gcov-__gcov_flush-multiple.gcda") != 0) {
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/test/profile/Inputs/instrprof-gcov-__gcov_flush-multiple.c.gcov b/test/profile/Inputs/instrprof-gcov-__gcov_flush-multiple.c.gcov
new file mode 100644
index 000000000..f2141229b
--- /dev/null
+++ b/test/profile/Inputs/instrprof-gcov-__gcov_flush-multiple.c.gcov
@@ -0,0 +1,21 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-gcov-__gcov_flush-multiple.c
+// CHECK-NEXT: -: 0:Graph:instrprof-gcov-__gcov_flush-multiple.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-gcov-__gcov_flush-multiple.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: #####: 1:int main(void) {
+// CHECK-NEXT: #####: 2: __gcov_flush();
+// CHECK-NEXT: -: 3:
+// CHECK-NEXT: #####: 4: if (remove("instrprof-gcov-__gcov_flush-multiple.gcda") != 0) {
+// CHECK-NEXT: #####: 5: return 1;
+// CHECK-NEXT: -: 6: }
+// CHECK-NEXT: -: 7:
+// CHECK-NEXT: #####: 8: __gcov_flush();
+// CHECK-NEXT: #####: 9: __gcov_flush();
+// CHECK-NEXT: -: 10:
+// CHECK-NEXT: #####: 11: if (remove("instrprof-gcov-__gcov_flush-multiple.gcda") != 0) {
+// CHECK-NEXT: #####: 12: return 1;
+// CHECK-NEXT: -: 13: }
+// CHECK-NEXT: -: 14:
+// CHECK-NEXT: 1: 15: return 0;
+// CHECK-NEXT: 1: 16:}
diff --git a/test/profile/instrprof-gcov-__gcov_flush-multiple.test b/test/profile/instrprof-gcov-__gcov_flush-multiple.test
new file mode 100644
index 000000000..fdc93c93e
--- /dev/null
+++ b/test/profile/instrprof-gcov-__gcov_flush-multiple.test
@@ -0,0 +1,10 @@
+RUN: mkdir -p %t.d
+RUN: cd %t.d
+
+RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-__gcov_flush-multiple.c
+RUN: test -f instrprof-gcov-__gcov_flush-multiple.gcno
+
+RUN: rm -f instrprof-gcov-__gcov_flush-multiple.gcda
+RUN: %run %t
+RUN: llvm-cov gcov instrprof-gcov-__gcov_flush-multiple.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-__gcov_flush-multiple.c.gcov %S/Inputs/instrprof-gcov-__gcov_flush-multiple.c.gcov