[gcr] build: Use gnome-common code coverage macros



commit a185f4f20f20776f6b0dcccb4f3eeba30941022a
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Aug 20 23:27:45 2012 +0100

    build: Use gnome-common code coverage macros
    
    Replace the existing home-grown gcov support with the new code coverage
    macro from gnome-common 3.6.0.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683211

 Makefile.am   |    2 +-
 Makefile.decl |   17 ++++++++---------
 configure.ac  |   40 +++-------------------------------------
 3 files changed, 12 insertions(+), 47 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 67a76e5..5037b91 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,7 +22,7 @@ EXTRA_DIST = \
 DISTCHECK_CONFIGURE_FLAGS = \
 	--enable-gtk-doc \
 	--enable-strict \
-	--disable-coverage \
+	--disable-code-coverage \
 	--disable-update-mime \
 	--disable-update-icon-cache \
 	--with-pkcs11-modules=$(abs_srcdir)/$(top_distdir)/_inst/lib/
diff --git a/Makefile.decl b/Makefile.decl
index 17af8c7..643d080 100644
--- a/Makefile.decl
+++ b/Makefile.decl
@@ -15,15 +15,14 @@ perform-memcheck: $(TEST_PROGS)
 			$(builddir)/$$test $(TEST_ARGS) || exit 3; \
 	done
 
-coverage:
-	mkdir -p $(top_builddir)/build/coverage
-	$(LCOV) --directory . --capture --output-file $(top_builddir)/build/coverage.info
-	$(GENHTML) --output-directory $(top_builddir)/build/coverage $(top_builddir)/build/coverage.info
-	$(LCOV) --directory . --zerocounters
-	@echo "file://$(abs_top_builddir)/build/coverage/index.html"
-
-clear-coverage:
-	$(LCOV) --directory . --zerocounters
+ GNOME_CODE_COVERAGE_RULES@
+
+CODE_COVERAGE_DIRECTORY = $(builddir)
+CODE_COVERAGE_OUTPUT_FILE = $(top_builddir)/build/coverage.info
+CODE_COVERAGE_OUTPUT_DIRECTORY = $(top_builddir)/build/coverage
+
+coverage: code-coverage
+clear-coverage: code-coverage-clean
 
 V_ASN1 = $(V_ASN1_$(V))
 V_ASN1_ = $(V_ASN1_$(AM_DEFAULT_VERBOSITY))
diff --git a/configure.ac b/configure.ac
index 6271957..c2af224 100644
--- a/configure.ac
+++ b/configure.ac
@@ -276,43 +276,9 @@ AC_MSG_RESULT($strict_status)
 AC_SUBST(INTROSPECTION_FLAGS)
 AC_SUBST(TEST_MODE)
 
-AC_MSG_CHECKING([whether to build with gcov testing])
-AC_ARG_ENABLE([coverage],
-		AS_HELP_STRING([--enable-coverage],
-			[Whether to enable coverage testing ]),
-		[],
-		[enable_coverage=no])
-
-AC_MSG_RESULT([$enable_coverage])
-
-if test "$enable_coverage" = "yes"; then
-	if test "$GCC" != "yes"; then
-		AC_MSG_ERROR(Coverage testing requires GCC)
-	fi
-
-	AC_PATH_PROG(GCOV, gcov, no)
-	if test "$GCOV" = "no" ; then
-		AC_MSG_ERROR(gcov tool is not available)
-	fi
-
-	AC_PATH_PROG(LCOV, lcov, no)
-	if test "$LCOV" = "no" ; then
-		AC_MSG_ERROR(lcov tool is not installed)
-	fi
-
-	AC_PATH_PROG(GENHTML, genhtml, no)
-	if test "$GENHTML" = "no" ; then
-		AC_MSG_ERROR(lcov's genhtml tool is not installed)
-	fi
-
-	CFLAGS="$CFLAGS -O0 -g -fprofile-arcs -ftest-coverage"
-	LDFLAGS="$LDFLAGS -lgcov"
-fi
-
-AM_CONDITIONAL([WITH_COVERAGE], [test "$enable_coverage" = "yes"])
-AC_SUBST(LCOV)
-AC_SUBST(GCOV)
-AC_SUBST(GENHTML)
+GNOME_CODE_COVERAGE
+CFLAGS="$CFLAGS $CODE_COVERAGE_CFLAGS"
+LDFLAGS="$LDFLAGS $CODE_COVERAGE_LDFLAGS"
 
 AC_ARG_ENABLE(valgrind,
 	AC_HELP_STRING([--enable-valgrind],



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]