summaryrefslogtreecommitdiff
path: root/test/profile
diff options
context:
space:
mode:
authorCalixte Denizet <cdenizet@mozilla.com>2018-10-30 18:41:41 +0000
committerCalixte Denizet <cdenizet@mozilla.com>2018-10-30 18:41:41 +0000
commitd3530c67cccb123ac28677eb55fdb083f939de90 (patch)
tree70331f3604e8f48217fa488dd93d011507930965 /test/profile
parent7ce5daddb0177ede2e67c089c3f208caebbf4a5c (diff)
downloadcompiler-rt-d3530c67cccb123ac28677eb55fdb083f939de90.tar.gz
[GCOV] Add a test for function defined on one line (follow-up of https://reviews.llvm.org/D53600)
Summary: Add a test for coverage for function definition like void foo() { }. Reviewers: marco-c Reviewed By: marco-c Subscribers: delcypher, llvm-commits, #sanitizers, sylvestre.ledru Differential Revision: https://reviews.llvm.org/D53601 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@345625 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/profile')
-rw-r--r--test/profile/Inputs/instrprof-gcov-one-line-function.c11
-rw-r--r--test/profile/Inputs/instrprof-gcov-one-line-function.c.gcov16
-rw-r--r--test/profile/instrprof-gcov-one-line-function.test9
3 files changed, 36 insertions, 0 deletions
diff --git a/test/profile/Inputs/instrprof-gcov-one-line-function.c b/test/profile/Inputs/instrprof-gcov-one-line-function.c
new file mode 100644
index 000000000..ee1582351
--- /dev/null
+++ b/test/profile/Inputs/instrprof-gcov-one-line-function.c
@@ -0,0 +1,11 @@
+void foo() { }
+
+void bar() { }
+
+int main(void) {
+ foo();
+
+ bar();
+
+ return 0;
+}
diff --git a/test/profile/Inputs/instrprof-gcov-one-line-function.c.gcov b/test/profile/Inputs/instrprof-gcov-one-line-function.c.gcov
new file mode 100644
index 000000000..145ce49cd
--- /dev/null
+++ b/test/profile/Inputs/instrprof-gcov-one-line-function.c.gcov
@@ -0,0 +1,16 @@
+// CHECK: -: 0:Source:/home/calixte/dev/mozilla/llvm.cal/projects/compiler-rt/test/profile/Inputs/instrprof-gcov-one-line-function.c
+// CHECK-NEXT: -: 0:Graph:instrprof-gcov-one-line-function.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-gcov-one-line-function.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: 1: 1:void foo() { }
+// CHECK-NEXT: -: 2:
+// CHECK-NEXT: 1: 3:void bar() { }
+// CHECK-NEXT: -: 4:
+// CHECK-NEXT: 1: 5:int main(void) {
+// CHECK-NEXT: 1: 6: foo();
+// CHECK-NEXT: -: 7:
+// CHECK-NEXT: 1: 8: bar();
+// CHECK-NEXT: -: 9:
+// CHECK-NEXT: 1: 10: return 0;
+// CHECK-NEXT: -: 11:}
diff --git a/test/profile/instrprof-gcov-one-line-function.test b/test/profile/instrprof-gcov-one-line-function.test
new file mode 100644
index 000000000..d67c21a86
--- /dev/null
+++ b/test/profile/instrprof-gcov-one-line-function.test
@@ -0,0 +1,9 @@
+RUN: mkdir -p %t.d
+RUN: cd %t.d
+
+RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-one-line-function.c
+RUN: test -f instrprof-gcov-one-line-function.gcno
+RUN: rm -f instrprof-gcov-one-line-function.gcda
+RUN: %run %t
+RUN: llvm-cov gcov instrprof-gcov-one-line-function.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-one-line-function.c.gcov %S/Inputs/instrprof-gcov-one-line-function.c.gcov