[libgdata] build: Use gnome-common code coverage macros to add gcov support
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] build: Use gnome-common code coverage macros to add gcov support
- Date: Sun, 30 Sep 2012 09:01:51 +0000 (UTC)
commit ca75565d3f39122d4988e2ede960c9b7cd427ca0
Author: Philip Withnall <philip tecnocode co uk>
Date: Thu Aug 16 08:02:06 2012 +0100
build: Use gnome-common code coverage macros to add gcov support
This replaces libgdataâs existing home-grown solution with the gnome-common
code coverage macros added in gnome-common 3.5.6/3.6.0.
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=683209
Makefile.am | 44 +++++++-------------------------------------
configure.ac | 20 ++------------------
2 files changed, 9 insertions(+), 55 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index b16caac..0e04d3d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -445,14 +445,14 @@ gdata_libgdata_la_CPPFLAGS = \
gdata_libgdata_la_CFLAGS = \
$(GDATA_CFLAGS) \
$(GNOME_CFLAGS) \
- $(GCOV_CFLAGS) \
+ $(CODE_COVERAGE_CFLAGS) \
$(WARN_CFLAGS) \
$(AM_CFLAGS)
gdata_libgdata_la_LIBADD = \
$(GDATA_LIBS) \
$(GNOME_LIBS) \
- $(GCOV_LIBS) \
+ $(CODE_COVERAGE_LIBS) \
$(AM_LIBADD)
gdata_libgdata_la_LDFLAGS = \
@@ -513,40 +513,10 @@ DISTCHECK_CONFIGURE_FLAGS += --enable-introspection
EXTRA_DIST += introspection.m4
endif
-# gcov
-if GCOV_ENABLED
-gcov-report.txt: gcov-clean all check
- $(AM_V_GEN)(rm -f $@; \
- echo -e "Test coverage for libgdata:\n" >> $@; \
- total_covered=0; total_actual=0; \
- for file in $(filter %.c,$(gdata_libgdata_la_SOURCES)); do \
- file2=$${file##*/}; \
- cd $(abs_srcdir)/$${file%/*}; \
- gcov -o `find -newer $$file2 -name "*-$${file2/.c/.gcda}" -print0 | sed -e 's/\.gcda/\.o/'` $$file2 > /dev/null; \
- if test -f $$file2.gcov; then \
- actual=`grep -v ' -:' $$file2.gcov | wc -l`; \
- uncovered=`grep '#####:' $$file2.gcov | wc -l`; \
- covered=$$((actual - uncovered)); \
- total_covered=$$((total_covered + covered)); \
- total_actual=$$((total_actual + actual)); \
- echo -e "$$file:\t$$covered / $$actual\t($$((($$covered * 100) / $$actual))%)"; \
- fi \
- done >> $@; \
- cd $(abs_srcdir); \
- echo -e "\nSource lines: $$total_actual\nCovered statements: $$total_covered\nTotal coverage: $$((($$total_covered * 100) / $$total_actual))%" >> $@)
-
-gcov: gcov-report.txt
- @cat gcov-report.txt
-
-clean: gcov-clean
-gcov-clean:
- @find . -name "*.gcda" -o -name "*.gcov" -delete
-
-MAINTAINERCLEANFILES += gcov-report.txt
-else
-gcov:
- @echo "Need to reconfigure with --enable-gcov"
-endif
+# Code coverage
+ GNOME_CODE_COVERAGE_RULES@
+CODE_COVERAGE_DIRECTORY = $(top_builddir)/gdata
+CODE_COVERAGE_LCOV_OPTIONS = --base-directory $(abs_top_srcdir)
# Demo programs
noinst_PROGRAMS =
@@ -651,7 +621,7 @@ $(srcdir)/ChangeLog:
(echo A git checkout and git-log is required to generate ChangeLog >&2 && \
echo A git checkout and git-log is required to generate this file >> $@); \
fi
-.PHONY: $(srcdir)/ChangeLog gcov gcov-clean gcov-report.txt
+.PHONY: $(srcdir)/ChangeLog
MAINTAINERCLEANFILES += ChangeLog
diff --git a/configure.ac b/configure.ac
index 4085234..703333b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -108,24 +108,8 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"], [Define to the Gettext
AC_SUBST(GETTEXT_PACKAGE)
IT_PROG_INTLTOOL([0.40.0])
-# Code testing coverage with gcov
-AC_MSG_CHECKING(whether to build with gcov testing)
-AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov], [Whether to enable gcov testing]),, enable_gcov=no)
-
-if test "x$enable_gcov" = "xyes"; then
- if test "$GCC" = "no"; then
- AC_MSG_ERROR(not compiling with gcc, which is required for gcov testing)
- fi
-
- GCOV_CFLAGS="-fprofile-arcs -ftest-coverage"
- GCOV_LIBS="-lgcov"
-
- AC_SUBST(GCOV_CFLAGS)
- AC_SUBST(GCOV_LIBS)
-fi
-
-AM_CONDITIONAL(GCOV_ENABLED, test x$enable_gcov = xyes)
-AC_MSG_RESULT($enable_gcov)
+# Code coverage
+GNOME_CODE_COVERAGE
# General GNOME macros
GNOME_DEBUG_CHECK
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]