From fcaa810350a59778e757a60f8ef23dad05883d1b Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Fri, 21 Nov 2008 14:51:28 +0000 Subject: [PATCH] Add rules to generate a code coverage report. --- Makefile.am | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Makefile.am b/Makefile.am index 4f1bdbd..304c8a2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,3 +34,26 @@ dist-hook: strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \ cp $$file $(distdir)$$strip; \ done) + +# Code Coverage + +init-coverage: + make clean + lcov --directory . --zerocounters + +COVERAGE_CCOPTS ?= "-g --coverage" +COVERAGE_OUT ?= docs/coverage + +build-coverage: + make CFLAGS=$(COVERAGE_CCOPTS) check + mkdir -p $(COVERAGE_OUT) + lcov --directory . --output-file $(COVERAGE_OUT)/$(PACKAGE).info \ + --capture + +gen-coverage: + genhtml --output-directory $(COVERAGE_OUT) \ + $(COVERAGE_OUT)/$(PACKAGE).info \ + --highlight --frames --legend \ + --title "$(PACKAGE_NAME)" + +coverage: init-coverage build-coverage gen-coverage