feat: add code coverage with branch coverage
All checks were successful
CI Code / Check spelling (pull_request) Successful in 19s
CI Code / Check coding style (pull_request) Successful in 39s
CI Code / Code Coverage (pull_request) Successful in 15m36s
CI Code / Linux (arch) (pull_request) Successful in 16m18s
CI Code / Linux (debian) (pull_request) Successful in 16m44s
CI Code / Linux (ubuntu) (pull_request) Successful in 17m42s

- Add --enable-coverage option to configure.ac
- Add coverage/coverage-html targets to Makefile.am
- Add coverage CI job with lcov + Codecov upload
- Include both unit and functional tests in coverage
- Enable branch coverage (step towards MC/DC)
- Add lcov to all Dockerfiles
- Add coverage/ to .gitignore
This commit is contained in:
2026-01-19 16:39:06 +03:00
parent 5a34a4a1d3
commit c1a60dc603
9 changed files with 57 additions and 0 deletions

View File

@@ -386,6 +386,20 @@ check-unit: tests/unittests/unittests
@VALGRIND_CHECK_RULES@
VALGRIND_SUPPRESSIONS_FILES=prof.supp
# Code coverage targets (requires --enable-coverage)
coverage-clean:
find . -name '*.gcda' -delete
find . -name '*.gcno' -delete
rm -rf coverage-html coverage.info
coverage-report: check
lcov --capture --directory . --output-file coverage.info --ignore-errors inconsistent
lcov --remove coverage.info '/usr/*' '*/tests/*' --output-file coverage.info --ignore-errors inconsistent
genhtml coverage.info --output-directory coverage-html
@echo "Coverage report generated in coverage-html/index.html"
.PHONY: coverage-clean coverage-report
format: $(all_c_sources)
clang-format -i $(all_c_sources)