Skip to content
Snippets Groups Projects
Commit 31392b44 authored by Daniel Salzman's avatar Daniel Salzman
Browse files

Makefile: improve code coverage usage

parent 2681332a
No related branches found
No related tags found
No related merge requests found
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = libtap src tests samples doc man patches
AM_DISTCHECK_CONFIGURE_FLAGS = \
AM_DISTCHECK_CONFIGURE_FLAGS = \
--disable-code-coverage
code_coverage_quiet = --quiet
check-code-coverage:
if CODE_COVERAGE_ENABLED
$(MAKE) $(AM_MAKEFLAGS) code-coverage-initial
-$(MAKE) $(AM_MAKEFLAGS) -k check
$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
$(MAKE) $(AM_MAKEFLAGS) code-coverage-html
$(MAKE) $(AM_MAKEFLAGS) code-coverage-summary
else
@echo "You need to run configure with --enable-code-coverage to enable code coverage"
endif
code-coverage-initial:
if CODE_COVERAGE_ENABLED
$(LCOV) $(code_coverage_quiet) \
--directory $(top_builddir)/src/common \
--directory $(top_builddir)/src/knot \
--directory $(top_builddir)/src/libknot \
--capture --initial \
--ignore-errors source \
--base-directory $(top_builddir)/src \
--output-file "$(PACKAGE_NAME)-$(PACKAGE_VERSION)-src_base.info" \
--test-name "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
--no-checksum --compat-libtool
$(LCOV) $(code_coverage_quiet) \
--directory $(top_builddir)/src/knot/conf \
--capture --initial \
--ignore-errors source \
--base-directory $(top_builddir)/src/knot/conf \
--output-file "$(PACKAGE_NAME)-$(PACKAGE_VERSION)-conf_base.info" \
--test-name "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
--no-checksum --compat-libtool
$(LCOV) $(code_coverage_quiet) \
--directory $(top_builddir)/src/zscanner \
--capture --initial \
--ignore-errors source \
--base-directory $(top_builddir)/src/zscanner \
--output-file "$(PACKAGE_NAME)-$(PACKAGE_VERSION)-zscanner_base.info" \
--test-name "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
--no-checksum --compat-libtool
else
@echo "You need to run configure with --enable-code-coverage to enable code coverage"
endif
......@@ -44,11 +78,13 @@ if CODE_COVERAGE_ENABLED
--test-name "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
--no-checksum --compat-libtool
$(LCOV) $(code_coverage_quiet) \
--add-tracefile "$(PACKAGE_NAME)-$(PACKAGE_VERSION)-src_base.info" \
--add-tracefile "$(PACKAGE_NAME)-$(PACKAGE_VERSION)-conf_base.info" \
--add-tracefile "$(PACKAGE_NAME)-$(PACKAGE_VERSION)-zscanner_base.info" \
--add-tracefile "$(PACKAGE_NAME)-$(PACKAGE_VERSION)-src_capture.info" \
--add-tracefile "$(PACKAGE_NAME)-$(PACKAGE_VERSION)-conf_capture.info" \
--add-tracefile "$(PACKAGE_NAME)-$(PACKAGE_VERSION)-zscanner_capture.info" \
--output-file "$(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info"
-@rm -f $(PACKAGE_NAME)-$(PACKAGE_VERSION)-*_base.info $(PACKAGE_NAME)-$(PACKAGE_VERSION)-*_capture.info
else
@echo "You need to run configure with --enable-code-coverage to enable code coverage"
endif
......@@ -63,14 +99,24 @@ else
@echo "You need to run configure with --enable-code-coverage to enable code coverage"
endif
code-coverage-summary:
if CODE_COVERAGE_ENABLED
$(LCOV) \
--summary "$(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info"
else
@echo "You need to run configure with --enable-code-coverage to enable code coverage"
endif
if CODE_COVERAGE_ENABLED
clean-local: code-coverage-clean
-find . -name "*.gcno" -delete
code-coverage-clean:
-$(LCOV) --directory $(top_builddir) -z
-rm -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)-*_base.info \
$(PACKAGE_NAME)-$(PACKAGE_VERSION)-*_coverage.info \
$(PACKAGE_NAME)-$(PACKAGE_VERSION)-*_capture.info \
$(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info \
$(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage/
-find . -name "*.gcda" -o -name "*.gcov" -delete
endif
.PHONY: check-code-coverage code-coverage-initial code-coverage-capture code-coverage-html code-coverage-clean
.PHONY: check-code-coverage code-coverage-initial code-coverage-capture code-coverage-html code-coverage-summary code-coverage-clean
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment