Exclude test sources and generated artifacts from the coverage report

- new_docker_build.sh: after the lcov extract step, a --remove step drops
  the unit/smoke test sources (unit-test/, UnitTests/, tests/, *unit_test*)
  and the generated build artifacts (qt6-after/build/ autogen and moc
  files), so the report measures production code only (122 files instead
  of 197).
- README.md: document the exclusions in Step 6.
This commit is contained in:
berrux-dev committed 2026-11-20 10:57:04 +01:00
1 parent 2f82acd7e0
commit 363bde9a0e
2 files changed
+14 -1

No files matched your search

@@ -386,6 +386,16 @@ if [[ "${RUN_COVERAGE}" == "ON" ]]; then
--ignore-errors="${LCOV_IGNORE_ERRORS}" \
|| die "lcov extract failed"
rm -f "${COV_DIR}/coverage_raw.info"
# 2b) exclude test sources and generated build artifacts (autogen/moc)
# from the report: only production code is measured
lcov --remove "${COV_DIR}/coverage.info" \
"*/qt6-after/build/*" "*/unit-test/*" "*/UnitTests/*" \
"*unit_test*" "*/tests/*" \
--output-file "${COV_DIR}/coverage_filtered.info" \
--rc branch_coverage=1 \
--ignore-errors="${LCOV_IGNORE_ERRORS}" \
|| die "lcov remove failed"
mv -f "${COV_DIR}/coverage_filtered.info" "${COV_DIR}/coverage.info"
# 3) browsable report (line + branch coverage per file)
genhtml "${COV_DIR}/coverage.info" \
--output-directory "${COV_DIR}/html" \