From: Petr Špaček Date: Thu, 21 Dec 2017 09:09:11 +0000 (+0100) Subject: CI coverage: add missing Lua files to the report X-Git-Tag: v2.0.0~49^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5a447f91e0266c50232d6d23924574ff3294854;p=thirdparty%2Fknot-resolver.git 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. --- diff --git a/Makefile b/Makefile index 6a22017c6..897a17407 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/scripts/luacov_gen_empty.sh b/scripts/luacov_gen_empty.sh new file mode 100755 index 000000000..a224081cf --- /dev/null +++ b/scripts/luacov_gen_empty.sh @@ -0,0 +1,17 @@ +#!/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