summaryrefslogtreecommitdiffstats
path: root/test/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'test/Makefile')
-rw-r--r--test/Makefile48
1 files changed, 34 insertions, 14 deletions
diff --git a/test/Makefile b/test/Makefile
index 41d28f9f772..27e750137ef 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -80,7 +80,7 @@ PIP_TOOLS_VERSION=6.6.0
PIP_SETUPTOOLS_VERSION=62.1.0
PYTHON_DEPENDS=requirements-$(PYTHON_VERSION).txt
SCAPY_SOURCE=$(shell find $(VENV_PATH)/lib/python* -name site-packages)
-BUILD_COV_DIR=$(TEST_BR)/coverage
+BUILD_COV_DIR=$(BR)/test-coverage
PIP_TOOLS_INSTALL_DONE=$(VENV_RUN_DIR)/pip-tools-install-$(PYTHON_VERSION)-$(PIP_TOOLS_VERSION).done
PIP_INSTALL_DONE=$(VENV_RUN_DIR)/pip-install-$(PYTHON_VERSION)-$(PIP_VERSION).done
@@ -326,19 +326,36 @@ wipe: reset
$(BUILD_COV_DIR):
@mkdir -p $@
-.PHONY: cov
-cov: wipe-cov test-dep ext $(BUILD_COV_DIR)
+.PHONY: cov-prep
+cov-prep: test-dep
@lcov --zerocounters --directory $(VPP_BUILD_DIR)
@test -z "$(EXTERN_COV_DIR)" || lcov --zerocounters --directory $(EXTERN_COV_DIR)
- $(call retest-func)
- @lcov --capture --directory $(VPP_BUILD_DIR) --output-file $(BUILD_COV_DIR)/coverage.info
- @test -z "$(EXTERN_COV_DIR)" || lcov --capture --directory $(EXTERN_COV_DIR) --output-file $(BUILD_COV_DIR)/extern-coverage.info
- @genhtml $(BUILD_COV_DIR)/coverage.info --output-directory $(BUILD_COV_DIR)/html
- @test -z "$(EXTERN_COV_DIR)" || genhtml $(BUILD_COV_DIR)/extern-coverage.info --output-directory $(BUILD_COV_DIR)/extern-html
+
+.PHONY: cov-post
+cov-post: wipe-cov $(BUILD_COV_DIR)
+ @lcov --capture \
+ --directory $(VPP_BUILD_DIR) \
+ --output-file $(BUILD_COV_DIR)/coverage.info
+ @test -z "$(EXTERN_COV_DIR)" || \
+ lcov --capture \
+ --directory $(EXTERN_COV_DIR) \
+ --output-file $(BUILD_COV_DIR)/extern-coverage.info
+ @lcov --remove $(BUILD_COV_DIR)/coverage.info \
+ "/usr/include/*" "*/build-root/*" "/opt/*" "/usr/lib/*" \
+ -o $(BUILD_COV_DIR)/coverage-filtered.info
+ @genhtml $(BUILD_COV_DIR)/coverage-filtered.info \
+ --output-directory $(BUILD_COV_DIR)/html
+ @test -z "$(EXTERN_COV_DIR)" || \
+ genhtml $(BUILD_COV_DIR)/extern-coverage.info \
+ --output-directory $(BUILD_COV_DIR)/extern-html
@echo
@echo "Build finished. Code coverage report is in $(BUILD_COV_DIR)/html/index.html"
@test -z "$(EXTERN_COV_DIR)" || echo "Code coverage report for out-of-tree objects is in $(BUILD_COV_DIR)/extern-html/index.html"
+.PHONY: cov
+cov:
+ make -C . cov-prep test cov-post
+
.PHONY: wipe-cov
wipe-cov: wipe
@rm -rf $(BUILD_COV_DIR)
@@ -388,14 +405,17 @@ help:
@echo ""
@echo " test - build and run (basic) functional tests"
@echo " test-debug - build and run (basic) functional tests (debug build)"
+ @echo " test-cov - generate code coverage report for functional tests"
+ @echo " test-cov-prep - coverage phase #1 : prepare lcov"
+ @echo " test-cov-build - coverage phase #2 : build gcov image & run tests against it (use TEST=)"
+ @echo " test-cov-post - coverage phase #3 : generate lcov html report"
@echo " test-all - build and run functional and extended tests"
@echo " test-all-debug - build and run functional and extended tests (debug build)"
+ @echo " test-all-cov - generate code coverage report for functional and extended tests"
@echo " retest - run functional tests"
@echo " retest-debug - run functional tests (debug build)"
@echo " retest-all - run functional and extended tests"
@echo " retest-all-debug - run functional and extended tests (debug build)"
- @echo " test-cov - generate code coverage report for test framework"
- @echo " test-gcov - build and run functional tests (gcov build)"
@echo " test-wipe - wipe (temporary) files generated by unit tests"
@echo " test-wipe-cov - wipe code coverage report for test framework"
@echo " test-wipe-papi - rebuild vpp_papi sources"
@@ -556,6 +576,10 @@ help:
@echo " enable debugging of the test framework itself (expert)"
@echo " (default: no)"
@echo ""
+ @echo " TEST_GCOV=[1|y|yes]"
+ @echo " enable tests specifically designed soley for code coverage"
+ @echo " (default: no)"
+ @echo ""
@echo " API_FUZZ=[1|y|yes]"
@echo " enable VPP api fuzz testing"
@echo " (default: no)"
@@ -569,7 +593,3 @@ help:
@echo " test-start-vpp-in-gdb - start VPP in gdb (release)"
@echo " test-start-vpp-debug-in-gdb - start VPP in gdb (debug)"
@echo ""
- @echo "Creating test code coverage report:"
- @echo ""
- @echo " test-cov - generate code coverage report for test framework"
- @echo " test-wipe-cov - wipe code coverage report for test framework"