CI coverage: add missing Lua files to the report

Luacov does not know about files which were not loaded at all.
Script generates empty luacov stats for all files
which forces luacov to show all files.
parent 5a75e722
......@@ -14,12 +14,15 @@ coverage-c:
@echo "# C coverage in $(COVERAGE_STAGE)"
@$(LCOV) --no-external --capture -d lib -d daemon -d modules -o $(COVERAGE_STAGE) > /dev/null
coverage-lua: $(shell find -type f -name 'luacov.stats.out')
# map install paths to source paths
@# map install paths to source paths
@$(MAKE) PREFIX=$(PREFIX) install --dry-run --always-make | scripts/map_install_src.lua --sed > .luacov_path_map
@find -type f -name 'luacov.stats.out' | xargs sed -i -f .luacov_path_map
@rm .luacov_path_map
@# add missing Lua files
@$(MAKE) PREFIX=$(PREFIX) install --dry-run --always-make | scripts/map_install_src.lua | cut -f 2 | grep '\.lua$$' | scripts/ > luacov.empty_stats.out
@echo "# Lua coverage in $(COVERAGE_STAGE)"
@scripts/luacov_to_info.lua $^ > $(COVERAGE_STAGE)
@scripts/luacov_to_info.lua luacov.empty_stats.out $^ > $(COVERAGE_STAGE)
@rm luacov.empty_stats.out
@$(LCOV) $(addprefix --add-tracefile ,$(wildcard $(COVERAGE_STAGE)*.info)) --output-file
@$(GENHTML) --no-function-coverage --no-branch-coverage -q -o coverage -p $(realpath $(CURDIR)) -t "Knot DNS Resolver $(VERSION)-$(PLATFORM) coverage report" --legend
# Generate stats file in luacov format indicating that files named on stdin
# were not processed.
# Normally luacov does not know about files which were not loaded so
# without this manual addition the files are missing in coverage report.
# Usage:
# $ < list_of_lua_files > luacov.empty_stats.out
set -o errexit -o nounset
while read FILENAME
echo -e "0:${FILENAME}\n "
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