Skip to content

Commit c4ca642

Browse files
committed
CDRIVER-727 actually enable coverage in libmongoc
1 parent e518097 commit c4ca642

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
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
@@ -40,6 +40,7 @@ m4_include([build/autotools/FindDependencies.m4])
4040
m4_include([build/autotools/AutoHarden.m4])
4141
m4_include([build/autotools/MaintainerFlags.m4])
4242
m4_include([build/autotools/Optimizations.m4])
43+
m4_include([build/autotools/Coverage.m4])
4344
m4_include([build/autotools/LDVersionScript.m4])
4445

4546
# We would put AM_INIT_AUTOMAKE into SetupAutomake.m4, but seems to cause

src/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ MONGOC_CPPFLAGS_SHARED = \
1515
-DMONGOC_COMPILATION \
1616
$(LIBC_FEATURES) \
1717
$(OPTIMIZE_CFLAGS) \
18+
$(COVERAGE_CFLAGS) \
1819
-I$(top_srcdir)/src \
1920
-I$(top_srcdir)/src/mongoc \
2021
-I$(top_builddir)/src/mongoc \
@@ -34,7 +35,7 @@ libmongoc_priv_la_CPPFLAGS = $(MONGOC_CPPFLAGS_SHARED)
3435
libmongoc_1_0_la_CPPFLAGS = $(MONGOC_CPPFLAGS_SHARED)
3536

3637

37-
MONGOC_LDFLAGS_SHARED = $(OPTIMIZE_LDFLAGS)
38+
MONGOC_LDFLAGS_SHARED = $(OPTIMIZE_LDFLAGS) $(COVERAGE_LDFLAGS)
3839
libmongoc_priv_la_LDFLAGS = \
3940
$(MONGOC_LDFLAGS_SHARED) \
4041
-no-undefined

0 commit comments

Comments
 (0)