1 # This test fails on Mac (https://bugs.llvm.org/show_bug.cgi?id=38134)
7 RUN: %clang --coverage -o libfunc.so -fPIC -shared %S/../Inputs/instrprof-shared-lib.c
8 RUN: test -f instrprof-shared-lib.gcno
10 # Test the case where we exit abruptly after calling __gcov_flush, which means we don't write out the counters at exit.
11 RUN: %clang -DEXIT_ABRUPTLY -DSHARED_CALL_BEFORE_GCOV_FLUSH -DSHARED_CALL_AFTER_GCOV_FLUSH --coverage -o %t -L%t.d -rpath %t.d -lfunc %S/../Inputs/instrprof-shared-main-gcov-flush.c
12 RUN: test -f instrprof-shared-main-gcov-flush.gcno
14 RUN: rm -f instrprof-shared-main-gcov-flush.gcda instrprof-shared-lib.gcda
16 RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda
17 RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-main-gcov-flush.c.gcov %S/../Inputs/instrprof-shared-main-gcov-flush_no-writeout.c.gcov
18 RUN: llvm-cov gcov instrprof-shared-lib.gcda
19 RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/../Inputs/instrprof-shared-lib.c.gcov
21 # Test the case where we exit normally and we have a call to the shared library function before __gcov_flush.
22 RUN: %clang -DSHARED_CALL_BEFORE_GCOV_FLUSH --coverage -o %t -L%t.d -rpath %t.d -lfunc %S/../Inputs/instrprof-shared-main-gcov-flush.c
23 RUN: test -f instrprof-shared-main-gcov-flush.gcno
25 RUN: rm -f instrprof-shared-main-gcov-flush.gcda instrprof-shared-lib.gcda
27 RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda
28 RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-main-gcov-flush.c.gcov %S/../Inputs/instrprof-shared-main-gcov-flush_shared-call-before.c.gcov
29 RUN: llvm-cov gcov instrprof-shared-lib.gcda
30 RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/../Inputs/instrprof-shared-lib.c.gcov
32 # Test the case where we exit normally and we have a call to the shared library function after __gcov_flush.
33 RUN: %clang -DSHARED_CALL_AFTER_GCOV_FLUSH --coverage -o %t -L%t.d -rpath %t.d -lfunc %S/../Inputs/instrprof-shared-main-gcov-flush.c
34 RUN: test -f instrprof-shared-main-gcov-flush.gcno
36 RUN: rm -f instrprof-shared-main-gcov-flush.gcda instrprof-shared-lib.gcda
38 RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda
39 RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-main-gcov-flush.c.gcov %S/../Inputs/instrprof-shared-main-gcov-flush_shared-call-after.c.gcov
40 RUN: llvm-cov gcov instrprof-shared-lib.gcda
41 RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/../Inputs/instrprof-shared-lib.c.gcov
43 # Test the case where we exit normally and we have calls to the shared library function before and after __gcov_flush.
44 RUN: %clang -DSHARED_CALL_BEFORE_GCOV_FLUSH -DSHARED_CALL_AFTER_GCOV_FLUSH --coverage -o %t -L%t.d -rpath %t.d -lfunc %S/../Inputs/instrprof-shared-main-gcov-flush.c
45 RUN: test -f instrprof-shared-main-gcov-flush.gcno
47 RUN: rm -f instrprof-shared-main-gcov-flush.gcda instrprof-shared-lib.gcda
49 RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda
50 RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-main-gcov-flush.c.gcov %S/../Inputs/instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov
51 RUN: llvm-cov gcov instrprof-shared-lib.gcda
52 RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/../Inputs/instrprof-shared-lib_called-twice.c.gcov