diff options
| author | Marco Castelluccio <mcastelluccio@mozilla.com> | 2018-07-05 15:52:59 +0000 |
|---|---|---|
| committer | Marco Castelluccio <mcastelluccio@mozilla.com> | 2018-07-05 15:52:59 +0000 |
| commit | 32d18beb8c8300f901e36d04ac5fff278d23fb01 (patch) | |
| tree | 6acc65091132cbfe178b2e16d6c9defd4bfe351c /compiler-rt/test/profile/instrprof-shared-gcov-flush.test | |
| parent | cb54964f808bd4383938948b0ebeb224d918d1bf (diff) | |
| download | bcm5719-llvm-32d18beb8c8300f901e36d04ac5fff278d23fb01.tar.gz bcm5719-llvm-32d18beb8c8300f901e36d04ac5fff278d23fb01.zip | |
Make __gcov_flush flush counters for all shared libraries
Summary:
This will make the behavior of __gcov_flush match the GCC behavior.
I would like to rename __gcov_flush to __llvm_gcov_flush (in case of programs linking to libraries built with different compilers), but I guess we can't for compatibility reasons.
Reviewers: davidxl
Reviewed By: davidxl
Subscribers: samsonov, vitalybuka, pcc, kcc, junbuml, glider, fhahn, eugenis, dvyukov, davidxl, srhines, chh, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D48538
llvm-svn: 336365
Diffstat (limited to 'compiler-rt/test/profile/instrprof-shared-gcov-flush.test')
| -rw-r--r-- | compiler-rt/test/profile/instrprof-shared-gcov-flush.test | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/compiler-rt/test/profile/instrprof-shared-gcov-flush.test b/compiler-rt/test/profile/instrprof-shared-gcov-flush.test new file mode 100644 index 00000000000..33bcc275fe4 --- /dev/null +++ b/compiler-rt/test/profile/instrprof-shared-gcov-flush.test @@ -0,0 +1,49 @@ +RUN: mkdir -p %t.d +RUN: cd %t.d + +RUN: %clang --coverage -o libfunc.so -fPIC -shared %S/Inputs/instrprof-shared-lib.c +RUN: test -f instrprof-shared-lib.gcno + +# Test the case where we exit abruptly after calling __gcov_flush, which means we don't write out the counters at exit. +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 +RUN: test -f instrprof-shared-main-gcov-flush.gcno + +RUN: %run %t +RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda +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 +RUN: llvm-cov gcov instrprof-shared-lib.gcda +RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/Inputs/instrprof-shared-lib.c.gcov +RUN: rm instrprof-shared-main-gcov-flush.gcda instrprof-shared-lib.gcda + +# Test the case where we exit normally and we have a call to the shared library function before __gcov_flush. +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 +RUN: test -f instrprof-shared-main-gcov-flush.gcno + +RUN: %run %t +RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda +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 +RUN: llvm-cov gcov instrprof-shared-lib.gcda +RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/Inputs/instrprof-shared-lib.c.gcov +RUN: rm instrprof-shared-main-gcov-flush.gcda instrprof-shared-lib.gcda + +# Test the case where we exit normally and we have a call to the shared library function after __gcov_flush. +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 +RUN: test -f instrprof-shared-main-gcov-flush.gcno + +RUN: %run %t +RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda +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 +RUN: llvm-cov gcov instrprof-shared-lib.gcda +RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/Inputs/instrprof-shared-lib.c.gcov +RUN: rm instrprof-shared-main-gcov-flush.gcda instrprof-shared-lib.gcda + +# Test the case where we exit normally and we have calls to the shared library function before and after __gcov_flush. +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 +RUN: test -f instrprof-shared-main-gcov-flush.gcno + +RUN: %run %t +RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda +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 +RUN: llvm-cov gcov instrprof-shared-lib.gcda +RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/Inputs/instrprof-shared-lib_called-twice.c.gcov +RUN: rm instrprof-shared-main-gcov-flush.gcda instrprof-shared-lib.gcda |

