summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2012-07-05 23:19:59 -0400
committerRyan Lortie <desrt@desrt.ca>2012-07-06 00:19:40 -0400
commit8330ed133c521418af9695b833697f8f48b789ff (patch)
tree608a2fa0997b9a62f5272a76853b01b5fd68c146
parentbb4f8d75af0a08b1e5262986a75042874da29850 (diff)
downloaddconf-8330ed133c521418af9695b833697f8f48b789ff.tar.gz
Add support for measuring testcase coverage
You need to ./configure with --enable-gcov and then type 'make lcov'. HTML report goes into ./lcov-html/index.html
-rw-r--r--.gitignore4
-rw-r--r--Makefile.am21
-rw-r--r--configure.ac9
3 files changed, 34 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index beccb04..6538832 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,10 @@ Makefile
*.gir
*.typelib
+# gcov
+*.gcda
+*.gcno
+
# autofoo stuff here
/m4/
/aux/
diff --git a/Makefile.am b/Makefile.am
index a30c0de..6f243f7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,3 +9,24 @@ SUBDIRS += editor
endif
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
+
+.PHONY: lcov lcov-clean
+# use recursive makes in order to ignore errors during check
+lcov:
+ -$(MAKE) $(AM_MAKEFLAGS) lcov-clean
+ -$(MAKE) $(AM_MAKEFLAGS) -k check
+ lcov --directory $(top_builddir) --capture --output-file dconf-lcov.info --test-name dconf --no-checksum --compat-libtool
+ LANG=C genhtml --prefix $(top_builddir) --output-directory lcov-html --legend --show-details dconf-lcov.info
+ @echo
+ @echo " file://$(abs_top_builddir)/lcov-html/index.html"
+ @echo
+
+clean-am: lcov-clean gcno-clean
+
+gcno-clean:
+ -find -name '*.gcno' -exec rm -f '{}' ';'
+
+lcov-clean:
+ -lcov --directory $(top_builddir) -z
+ -find -name '*.gcda' -exec rm -f '{}' ';'
+ rm -rf lcov-html dconf-lcov.info
diff --git a/configure.ac b/configure.ac
index 2b41e78..25c32da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,6 +51,15 @@ AC_SUBST(dconfincludedir, ${includedir}/dconf)
AC_PATH_PROG(gio_QUERYMODULES, gio-querymodules, no)
+AC_ARG_ENABLE(gcov,
+ AC_HELP_STRING([--enable-gcov],
+ [enable generation of code coverage information]))
+
+if test "x$enable_gcov" == "xyes"; then
+ CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
+ LDFLAGS="$LDFLAGS -lgcov"
+fi
+
AC_CONFIG_FILES([
common/Makefile
gvdb/Makefile