summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorDavid King <amigadave@amigadave.com>2011-12-24 17:53:36 +0100
committerDavid King <amigadave@amigadave.com>2011-12-24 18:04:47 +0100
commit8e9260e9674b9b75d750206e4317f96d10eef510 (patch)
tree0e4c842e8060d377a54a024836bd86145c471c3d /Makefile.am
parent936d8fdb96ee6825eb79bbb769f2bbf2dd1de7b4 (diff)
Add code coverage reporting, using lcov
Introduce new Makfile targets lcov and lcov-clean, to generate an HTML report of libcheese test code coverage and clean up the generated files. Check for lcov and genhtml in configure.ac.
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am28
1 files changed, 27 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 9123537..34a2c4a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -432,6 +432,31 @@ test:
echo "Test run disabled due to the lack of GLib testing utilities"
endif
+# Code coverage reporting.
+if CHEESE_ENABLE_LCOV
+# Depend on full-report so that all the tests are run.
+lcov: full-report
+ $(AM_V_at)$(LCOV) --base-directory $(top_builddir) \
+ --directory $(top_builddir)/libcheese --capture \
+ --output-file cheese-lcov.info --test-name CHEESE \
+ --no-checksum --compat-libtool
+ $(AM_V_at)LANG=C $(LCOV_GENHTML) --prefix $(top_builddir) \
+ --output-directory cheese-lcov --title "Cheese code coverage" \
+ --legend --show-details cheese-lcov.info
+
+lcov-clean:
+ $(AM_V_at)$(LCOV) --directory $(top_builddir) -z
+ $(AM_V_at)rm -rf cheese-lcov.info cheese-lcov
+ $(AM_V_at)find -name '*.gcda' -exec rm -f {} +
+else # !CHEESE_ENABLE_LCOV
+lcov:
+ $(AM_V_at)echo "Code coverage reporting not available"
+
+lcov-clean:
+ $(AM_V_at)rm -rf cheese-lcov.info cheese-lcov
+ $(AM_V_at)find -name '*.gcda' -exec rm -f {} +
+endif
+
# gtk-doc
gtkdoc_builddir = $(top_builddir)/docs/reference
gtkdoc_distdir = $(top_distdir)/docs/reference
@@ -442,7 +467,7 @@ all-local: $(bin_PROGRAMS)
# run make test as part of make check.
check-local: test
cd $(gtkdoc_builddir) && $(MAKE) $(AM_MAKEFlAGS) check
-clean-local:
+clean-local: lcov-clean
cd $(gtkdoc_builddir) && $(MAKE) $(AM_MAKEFLAGS) clean
distclean-local:
cd $(gtkdoc_builddir) && $(MAKE) $(AM_MAKEFLAGS) distclean
@@ -538,3 +563,4 @@ git-changelog-hook:
fi
.PHONY: docs git-changelog-hook test test-report perf-report full-report
+.PHONY: lcov lcov-clean