Commit b5a447f9 authored by Petr Špaček's avatar Petr Špaček

CI coverage: add missing Lua files to the report

Luacov does not know about files which were not loaded at all.
Script luacov_gen_empty.sh 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).c.info"
@$(LCOV) --no-external --capture -d lib -d daemon -d modules -o $(COVERAGE_STAGE).c.info > /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_gen_empty.sh > luacov.empty_stats.out
@echo "# Lua coverage in $(COVERAGE_STAGE).lua.info"
@scripts/luacov_to_info.lua $^ > $(COVERAGE_STAGE).lua.info
@scripts/luacov_to_info.lua luacov.empty_stats.out $^ > $(COVERAGE_STAGE).lua.info
@rm luacov.empty_stats.out
coverage:
@$(LCOV) $(addprefix --add-tracefile ,$(wildcard $(COVERAGE_STAGE)*.info)) --output-file coverage.info
@$(GENHTML) --no-function-coverage --no-branch-coverage -q -o coverage -p $(realpath $(CURDIR)) -t "Knot DNS Resolver $(VERSION)-$(PLATFORM) coverage report" --legend coverage.info
......
#!/bin/bash
# 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:
# $ luacov_gen_empty.sh < list_of_lua_files > luacov.empty_stats.out
set -o errexit -o nounset
IFS=$'\n'
while read FILENAME
do
echo -e "0:${FILENAME}\n "
done
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