From 127bae3db77d4a6d7831c63607345c6d1cd2cc21 Mon Sep 17 00:00:00 2001 From: Tristan Matthews <tristan.matthews@savoirfairelinux.com> Date: Wed, 6 Mar 2013 16:34:56 -0500 Subject: [PATCH] * #20736: daemon: added --enable-coverage option and make targets To get code coverage metrics, run ./configure --enable-coverage make make check make coverage --- daemon/Makefile.am | 13 +++++++++++++ daemon/configure.ac | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 34aed6bc2a..18d5876919 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -26,3 +26,16 @@ EXTRA_DIST = m4/libtool.m4 \ m4/ltoptions.m4 \ m4/ltsugar.m4 \ m4/ltversion.m4 + +coverage: + $(AM_V_at)lcov --directory $(top_builddir) --capture --output-file sflphone-coverage.info + $(MKDIR_P) html-output + genhtml -o html-output sflphone-coverage.info + +coverage-clean: + $(AM_V_at)lcov --directory $(top_builddir) --zerocounters + $(AM_V_at)rm -rf sflphone-coverage.info + $(AM_V_at)find -name '*.gcda' -exec rm -f {} + + $(AM_V_at)find -name '*.gcno' -exec rm -f {} + + +.PHONY: coverage coverage-clean diff --git a/daemon/configure.ac b/daemon/configure.ac index 9da7e19428..774e37160c 100644 --- a/daemon/configure.ac +++ b/daemon/configure.ac @@ -94,6 +94,12 @@ dnl Check for the samplerate development package - name: libsamplerate0-dev LIBSAMPLERATE_MIN_VERSION=0.1.2 PKG_CHECK_MODULES(SAMPLERATE, samplerate >= ${LIBSAMPLERATE_MIN_VERSION},, AC_MSG_ERROR([Missing libsamplerate development package: libsamplerate0-dev])) +dnl Coverage is default-disabled +AC_ARG_ENABLE([coverage], AS_HELP_STRING([--enable-coverage], [Enable coverage])) + +AS_IF([test "x$enable_coverage" = "xyes"], [ + CXXFLAGS="${CXXFLAGS} -fprofile-arcs -ftest-coverage" + LDFLAGS="${LDFLAGS} -fprofile-arcs -ftest-coverage"]) dnl Video is default-disabled AC_ARG_ENABLE([video], AS_HELP_STRING([--enable-video], [Enable video])) -- GitLab