Skip to content
This repository was archived by the owner on Oct 13, 2020. It is now read-only.

Commit 460ad08

Browse files
committed
CDRIVER-727 actually enable coverage in libbson
1 parent d08da2e commit 460ad08

File tree

5 files changed

+16
-0
lines changed

5 files changed

+16
-0
lines changed

build/autotools/Coverage.m4

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
COVERAGE_CFLAGS=""
2+
COVERAGE_LDFLAGS=""
3+
4+
if test "$enable_coverage" = "yes"; then
5+
COVERAGE_CFLAGS="--coverage -g"
6+
COVERAGE_LDFLAGS="-lgcov"
7+
fi
8+
9+
AC_SUBST(COVERAGE_CFLAGS)
10+
AC_SUBST(COVERAGE_LDFLAGS)

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ m4_include([build/autotools/CheckAtomics.m4])
4141
m4_include([build/autotools/AutoHarden.m4])
4242
m4_include([build/autotools/MaintainerFlags.m4])
4343
m4_include([build/autotools/Optimizations.m4])
44+
m4_include([build/autotools/Coverage.m4])
4445
m4_include([build/autotools/LDVersionScript.m4])
4546

4647
# We would put AM_INIT_AUTOMAKE into SetupAutomake.m4, but seems to cause autoconf errors.

src/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ libbson_1_0_la_LIBADD = \
77
-lm
88
libbson_1_0_la_LDFLAGS = \
99
$(OPTIMIZE_LDFLAGS) \
10+
$(COVERAGE_LDFLAGS) \
1011
$(BSON_LT_LDFLAGS) \
1112
-no-undefined \
1213
-rpath $(libdir)

src/bson/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ endif
6161
libbson_la_CFLAGS = \
6262
$(MAINTAINER_CFLAGS) \
6363
$(OPTIMIZE_CFLAGS) \
64+
$(COVERAGE_CFLAGS) \
6465
$(PTHREAD_CFLAGS)
6566

6667
libbson_la_SOURCES = \

tests/Makefile.am

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ test_libbson_CPPFLAGS = \
2828
-I$(top_srcdir)/src/bson \
2929
-I$(top_builddir)/src/bson \
3030
$(PTHREAD_CFLAGS) \
31+
$(COVERAGE_CFLAGS) \
3132
-DBSON_COMPILATION \
3233
-DBINARY_DIR="\"$(top_srcdir)/tests/binary\""
3334

35+
test_libbson_LDFLAGS = $(COVERAGE_LDFLAGS)
36+
3437
test_libbson_LDADD = \
3538
$(PTHREAD_LIBS) \
3639
libbson-1.0.la \

0 commit comments

Comments
 (0)