From: Marek VavruĊĦa Date: Wed, 29 Nov 2017 21:24:55 +0000 (-0800) Subject: CI coverage: build coverage report and publish to pages X-Git-Tag: v2.0.0~49^2~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=84fb5efc2c1aff29ade3fce01c870f79b3a96277;p=thirdparty%2Fknot-resolver.git CI coverage: build coverage report and publish to pages Beware: this version does not handle parallel execution --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8a856de1f..c60c3a6b6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,7 +30,7 @@ test:linux:amd64: stage: test script: - PREFIX=$(pwd)/.local make -k check - - make coverage-c COVERAGE_STAGE=gcov-check + - PREFIX=$(pwd)/.local make coverage-c COVERAGE_STAGE=gcov-check dependencies: - build:linux:amd64 artifacts: @@ -46,7 +46,7 @@ installcheck:linux:amd64: stage: test script: - PREFIX=$(pwd)/.local make -k installcheck - - make coverage-c coverage-lua COVERAGE_STAGE=gcov-installcheck + - PREFIX=$(pwd)/.local make coverage-c coverage-lua COVERAGE_STAGE=gcov-installcheck dependencies: - build:linux:amd64 artifacts: @@ -62,7 +62,7 @@ deckard:linux:amd64: stage: test script: - PREFIX=$(pwd)/.local MAKEFLAGS="--jobs $(nproc) --keep-going" make check-integration - - make coverage-c coverage-lua COVERAGE_STAGE=gcov-deckard + - PREFIX=$(pwd)/.local make coverage-c coverage-lua COVERAGE_STAGE=gcov-deckard dependencies: - build:linux:amd64 artifacts: @@ -132,6 +132,8 @@ respdiff:iter:udp:linux:amd64: - cat results/respdiff.txt - echo 'test if mismatch rate >= 1 %' - grep -q '^target diagrees.*0\.[0-9][0-9] %' results/respdiff.txt + - killall --wait kresd + - PREFIX=$(pwd)/.local make coverage-c coverage-lua COVERAGE_STAGE=gcov-respdiff-iter-udp dependencies: - build:linux:amd64 artifacts: @@ -139,6 +141,7 @@ respdiff:iter:udp:linux:amd64: expire_in: '1 week' paths: - results/*.txt + - ./*.info tags: - docker - linux @@ -152,6 +155,8 @@ respdiff:iter:tcp:linux:amd64: - cat results/respdiff.txt - echo 'test if mismatch rate >= 1 %' - grep -q '^target diagrees.*0\.[0-9][0-9] %' results/respdiff.txt + - killall --wait kresd + - PREFIX=$(pwd)/.local make coverage-c coverage-lua COVERAGE_STAGE=gcov-respdiff-iter-tcp dependencies: - build:linux:amd64 artifacts: @@ -159,6 +164,7 @@ respdiff:iter:tcp:linux:amd64: expire_in: '1 week' paths: - results/*.txt + - ./*.info tags: - docker - linux @@ -172,6 +178,8 @@ respdiff:iter:tls:linux:amd64: - cat results/respdiff.txt - echo 'test if mismatch rate >= 1 %' - grep -q '^target diagrees.*0\.[0-9][0-9] %' results/respdiff.txt + - killall --wait kresd + - PREFIX=$(pwd)/.local make coverage-c coverage-lua COVERAGE_STAGE=gcov-respdiff-iter-tls dependencies: - build:linux:amd64 artifacts: @@ -179,20 +187,30 @@ respdiff:iter:tls:linux:amd64: expire_in: '1 week' paths: - results/*.txt + - ./*.info tags: - docker - linux - amd64 -coverage:linux:amd64: +pages: stage: deploy script: - - make coverage + - PREFIX=$(pwd)/.local make coverage + - mv coverage/ public/ coverage: '/lines\.+:\s(\d+.\d+\%)/' dependencies: + - build:linux:amd64 - test:linux:amd64 - installcheck:linux:amd64 - deckard:linux:amd64 + - respdiff:iter:udp:linux:amd64 + - respdiff:iter:tcp:linux:amd64 + - respdiff:iter:tls:linux:amd64 + artifacts: + expire_in: 30 days + paths: + - public tags: - docker - linux diff --git a/Makefile b/Makefile index 1d3cc8a9c..abb5bde67 100644 --- a/Makefile +++ b/Makefile @@ -12,14 +12,15 @@ lint: $(patsubst %.lua.in,%.lua,$(wildcard */*/*.lua.in)) luacheck --codes --formatter TAP . coverage-c: @echo "# C coverage in $(COVERAGE_STAGE).c.info" - @$(LCOV) --no-external --capture --directory . --output-file $(COVERAGE_STAGE).c.info > /dev/null + @$(LCOV) --no-external --capture -d lib -d daemon -d modules -o $(COVERAGE_STAGE).c.info > /dev/null coverage-lua: $(wildcard */*/luacov.stats.out) @echo "# Lua coverage in $(COVERAGE_STAGE).lua.info" @if [ ! -z "$^" ]; then ./scripts/luacov_to_info.lua $^ > $(COVERAGE_STAGE).lua.info; fi coverage: @$(LCOV) $(addprefix --add-tracefile ,$(wildcard $(COVERAGE_STAGE)*.info)) --output-file coverage.info + @$(GENHTML) -q --ignore-errors source -o coverage -p $(realpath $(CURDIR)) -t "Knot DNS Resolver $(VERSION)-$(PLATFORM) coverage report" --legend coverage.info -.PHONY: all install check clean doc info +.PHONY: all install check clean doc info coverage # Options ifdef COVERAGE diff --git a/platform.mk b/platform.mk index 6df6ee9ed..466e0c2e2 100644 --- a/platform.mk +++ b/platform.mk @@ -9,6 +9,7 @@ GO := go CAT := cat SED := sed LCOV := lcov +GENHTML := genhtml LIBEXT := .so AREXT := .a LIBTYPE := shared