Verified Commit adf1f7a8 authored by Philippe B.'s avatar Philippe B. 🏂 Committed by Mehdi Bouaziz

Makefile/test: add directives for code coverage

Add directives related to code coverage
 - make coverage-setup
 - make coverage-report
 - make coverage-clean

Ignore directories related to code coverage
_coverage_output/ for coverage output
_coverage_report/ for the html report
parent 2d4f4503
......@@ -31,6 +31,8 @@ docs/api/rpc.rst
docs/api/p2p.rst
src/bin_client/test/LOG.*
_coverage_output
_coverage_report
**/*.install
**/.merlin
......
......@@ -38,6 +38,8 @@ __pycache__
/docs/api/p2p.rst
/src/bin_client/test/LOG.*
/_coverage_output
/_coverage_report
*.install
.merlin
......
......@@ -18,6 +18,8 @@ DOCKER_DEBUG_IMAGE_VERSION := latest
DOCKER_DEPS_IMAGE_NAME := registry.gitlab.com/tezos/opam-repository
DOCKER_DEPS_IMAGE_VERSION := ${opam_repository_tag}
DOCKER_DEPS_MINIMAL_IMAGE_VERSION := minimal--${opam_repository_tag}
COVERAGE_REPORT := _coverage_report
COVERAGE_OUTPUT := _coverage_output
ifeq ($(filter ${opam_version}.%,${current_opam_version}),)
$(error Unexpected opam version (found: ${current_opam_version}, expected: ${opam_version}.*))
......@@ -103,6 +105,29 @@ doc-html: all
doc-html-and-linkcheck: doc-html
@${MAKE} -C docs all
EXPECTED_BISECT_FILE := ${CURDIR}/${COVERAGE_OUTPUT}/bisect
.PHONY: coverage-setup
coverage-setup:
@mkdir -p ${COVERAGE_OUTPUT}
@echo "Before compiling, use ./scripts/instrument_dune_bisect.sh to add the"
@echo "bisect_ppx preprocessing directive to the dune files of the packages"
@echo "to be analyzed."
@echo
@echo "Examples:"
@echo " ./scripts/instrument_dune_bisect.sh src/lib_p2p/dune"
@echo " ./scripts/instrument_dune_bisect.sh src/proto_alpha/lib_protocol/dune.inc"
@echo
ifneq (${EXPECTED_BISECT_FILE}, ${BISECT_FILE})
@echo "Warning: BISECT_FILE isn't properly set. Run:"
@echo " export BISECT_FILE=${EXPECTED_BISECT_FILE}"
endif
.PHONY: coverage-report
coverage-report:
@bisect-ppx-report -ignore-missing-files -html ${COVERAGE_REPORT} ${COVERAGE_OUTPUT}/*.out
@echo "Report should be available in ${COVERAGE_REPORT}/index.html"
.PHONY: build-sandbox
build-sandbox:
@dune build src/bin_sandbox/main.exe
......@@ -191,8 +216,12 @@ install:
uninstall:
@dune uninstall
.PHONY: coverage-clean
coverage-clean:
@-rm -Rf ${COVERAGE_OUTPUT} ${COVERAGE_REPORT}
.PHONY: clean
clean:
clean: coverage-clean
@-dune clean
@-rm -f \
tezos-node \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment