Skip to content

Commit

Permalink
Coverage
Browse files Browse the repository at this point in the history
- Add `--enable-gcov` and `gcov` make target for Code coverage
  • Loading branch information
jelu committed Aug 12, 2020
1 parent e23ba7e commit 29bd143
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ AC_ARG_ENABLE([dnstap], [AS_HELP_STRING([--enable-dnstap], [DNSTAP input support
])
AM_CONDITIONAL([USE_DNSTAP], [test x$use_dnstap = xyes])

# Check --enable-gcov
AC_ARG_ENABLE([gcov], [AS_HELP_STRING([--enable-gcov], [Enable coverage testing])], [
coverage_cflags="--coverage -g -O0 -fno-inline -fno-inline-small-functions -fno-default-inline"
AC_MSG_NOTICE([enabling coverage testing... $coverage_cflags])
AS_VAR_APPEND(CFLAGS, [" $coverage_cflags"])
])
AM_CONDITIONAL([ENABLE_GCOV], [test "x$enable_gcov" != "xno"])
AM_EXTRA_RECURSIVE_TARGETS([gcov])

# Checks for libraries.
AC_CHECK_LIB([resolv], [inet_aton])
AC_CHECK_LIB([nsl], [gethostbyname])
Expand Down
9 changes: 8 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in $(srcdir)/config.h.in
CLEANFILES = dsc.conf.sample dsc.1 dsc.conf.5
CLEANFILES = dsc.conf.sample dsc.1 dsc.conf.5 *.gcda *.gcno *.gcov

SUBDIRS = test

Expand Down Expand Up @@ -71,3 +71,10 @@ dsc.1.html: dsc.1

dsc.conf.5.html: dsc.conf.5
cat dsc.conf.5 | groff -mandoc -Thtml > dsc.conf.5.html

if ENABLE_GCOV
gcov-local:
for src in $(dsc_SOURCES); do \
gcov -l -r -s "$(srcdir)" "$$src"; \
done
endif

0 comments on commit 29bd143

Please sign in to comment.