Verified Commit 84fb5efc authored by Marek Vavruša's avatar Marek Vavruša Committed by Petr Špaček

CI coverage: build coverage report and publish to pages

Beware: this version does not handle parallel execution
parent 07ff6fda
......@@ -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
......
......@@ -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
......
......@@ -9,6 +9,7 @@ GO := go
CAT := cat
SED := sed
LCOV := lcov
GENHTML := genhtml
LIBEXT := .so
AREXT := .a
LIBTYPE := shared
......
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