diff options
author | Matthias Clasen <mclasen@redhat.com> | 2013-12-20 22:14:00 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2013-12-20 22:14:00 -0500 |
commit | 8d2aade60c486d7ac0e7ac9988448409d77eb75b (patch) | |
tree | b26cb5704833d7f3070b5a67f652ba54e8f56a9f | |
parent | 8b93ff287dcbcf7862d40e4eebbf5fae594a07c2 (diff) | |
download | gdk-pixbuf-8d2aade60c486d7ac0e7ac9988448409d77eb75b.tar.gz |
Enable coverage testing
Use --enable-coverage and make coverage to get it.
-rw-r--r-- | Makefile.am | 11 | ||||
-rw-r--r-- | configure.ac | 38 |
2 files changed, 49 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index 8b3550a94..a726da58b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,5 +34,16 @@ MAINTAINERCLEANFILES = \ ltmain.sh \ missing +if WITH_COVERAGE +.PHONY: coverage clear-coverage + +coverage: + $(AM_V_GEN) $(LCOV) --quiet --directory $(top_builddir) --capture --output-file $(top_builddir)/coverage.info --no-checksum --compat-libtool; \ + $(GENHTML) --quiet --output-directory $(top_builddir)/coverage $(top_builddir)/coverage.info + @echo "file://$(abs_top_builddir)/coverage/index.html" + +clear-coverage: + $(AM_V_GEN) $(LCOV) --directory . --zerocounters +endif -include $(top_srcdir)/git.mk diff --git a/configure.ac b/configure.ac index 54700840f..be56c4dcb 100644 --- a/configure.ac +++ b/configure.ac @@ -1027,6 +1027,44 @@ AC_SUBST(GDK_PIXBUF_LINK_FLAGS) GLIB_TESTS +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) + ################################################## # Output commands ################################################## |