Skip to content

Commit 0a75de4

Browse files
committed
Add a test with __gcov_flush called before terminating the program.
Test for https://bugs.llvm.org/show_bug.cgi?id=38067. llvm-svn: 337150
1 parent f854ce8 commit 0a75de4

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
int main(void) {
2+
int i = 22;
3+
4+
__gcov_flush();
5+
6+
i = 42;
7+
8+
asm("int $3");
9+
10+
i = 84;
11+
12+
return 0;
13+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-gcov-__gcov_flush-terminate.c
2+
// CHECK-NEXT: -: 0:Graph:instrprof-gcov-__gcov_flush-terminate.gcno
3+
// CHECK-NEXT: -: 0:Data:instrprof-gcov-__gcov_flush-terminate.gcda
4+
// CHECK-NEXT: -: 0:Runs:1
5+
// CHECK-NEXT: -: 0:Programs:1
6+
// CHECK-NEXT: -: 1:int main(void) {
7+
// CHECK-NEXT: 1: 2: int i = 22;
8+
// CHECK-NEXT: -: 3:
9+
// CHECK-NEXT: 1: 4: __gcov_flush();
10+
// CHECK-NEXT: -: 5:
11+
// CHECK-NEXT: #####: 6: i = 42;
12+
// CHECK-NEXT: -: 7:
13+
// CHECK-NEXT: #####: 8: asm("int $3");
14+
// CHECK-NEXT: -: 9:
15+
// CHECK-NEXT: #####: 10: i = 84;
16+
// CHECK-NEXT: -: 11:
17+
// CHECK-NEXT: #####: 12: return 0;
18+
// CHECK-NEXT: -: 13:}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
XFAIL: *
2+
3+
RUN: mkdir -p %t.d
4+
RUN: cd %t.d
5+
6+
RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-__gcov_flush-terminate.c
7+
RUN: test -f instrprof-gcov-__gcov_flush-terminate.gcno
8+
9+
RUN: rm -f instrprof-gcov-__gcov_flush-terminate.gcda
10+
RUN: %expect_crash %run %t
11+
RUN: llvm-cov gcov instrprof-gcov-__gcov_flush-terminate.gcda
12+
RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-__gcov_flush-terminate.c.gcov %S/Inputs/instrprof-gcov-__gcov_flush-terminate.c.gcov

0 commit comments

Comments
 (0)