]> git.ipfire.org Git - people/ms/strongswan.git/commitdiff
Also capture coverage data for tests but filter them from the result
authorTobias Brunner <tobias@strongswan.org>
Wed, 27 Mar 2013 16:41:04 +0000 (17:41 +0100)
committerTobias Brunner <tobias@strongswan.org>
Tue, 11 Jun 2013 09:03:12 +0000 (11:03 +0200)
Otherwise calls from test cases to static inline functions are not captured.

Makefile.am
src/libstrongswan/tests/Makefile.am

index c7ece4a21cdf674938c6f8743975bcdf686e74c9..d9bae5f20586e830cc37ecdbe3123887104b0390 100644 (file)
@@ -37,20 +37,24 @@ Doxyfile :  Doxyfile.in
 apidoc :       Doxyfile
                doxygen
 
-if COVERAGE
-cov-reset:
+cov-reset-common:
                @rm -rf $(top_builddir)/coverage
                @find $(top_builddir) -name "*.gcda" -delete
+
+if COVERAGE
+cov-reset: cov-reset-common
                @lcov --zerocounters --directory $(top_builddir)
 
 cov-report:
                @mkdir $(top_builddir)/coverage
                lcov -c -o $(top_builddir)/coverage/coverage.info -d $(top_builddir)
+               lcov -r $(top_builddir)/coverage/coverage.info '*/tests/*' \
+                        -o $(top_builddir)/coverage/coverage.cleaned.info
                genhtml --num-spaces 4 --legend \
                                -t "$(PACKAGE_STRING)" \
                                -o $(top_builddir)/coverage/html \
                                -p `readlink -m $(abs_top_srcdir)`/src \
-                               $(top_builddir)/coverage/coverage.info
+                               $(top_builddir)/coverage/coverage.cleaned.info
                @echo "Coverage Report at $(top_builddir)/coverage/html" >&2
 
 coverage:
@@ -58,12 +62,12 @@ coverage:
                @$(MAKE) check
                @$(MAKE) cov-report
 else
-cov-reset:
-
 coverage:
                @echo "reconfigure with --enable-coverage"
 endif
 
-clean-local:
-               @$(MAKE) cov-reset
-               rm -rf apidoc
+clean-local: cov-reset-common
+               @find $(top_builddir) -name "*.gcno" -delete
+               @rm -rf apidoc
+
+.PHONY: cov-reset-common cov-reset cov-report coverage
\ No newline at end of file
index e99b3b5e9d5beab686d9dee579bed7790a2ef34b..5e3a2526d5ed391a9f3e85f87cf952ea58c93884 100644 (file)
@@ -8,9 +8,9 @@ test_runner_SOURCES = \
   test_chunk.c test_hashtable.c test_identification.c \
   test_threading.c test_utils.c
 
-
 test_runner_CFLAGS = \
   -I$(top_srcdir)/src/libstrongswan \
+  @COVERAGE_CFLAGS@ \
   @CHECK_CFLAGS@
 
 test_runner_LDFLAGS = @COVERAGE_LDFLAGS@