build: Use gnome-common code coverage macros
authorPhilip Withnall <philip@tecnocode.co.uk>
Mon, 20 Aug 2012 22:27:45 +0000 (23:27 +0100)
committerPhilip Withnall <philip@tecnocode.co.uk>
Wed, 3 Oct 2012 12:36:01 +0000 (13:36 +0100)
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
Makefile.decl
configure.ac

index 67a76e5..5037b91 100644 (file)
@@ -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/
index 17af8c7..643d080 100644 (file)
@@ -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))
index 6271957..c2af224 100644 (file)
@@ -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],