From 363bde9a0e01a55d0e8ad30f34e9c9def61f98a7 Mon Sep 17 00:00:00 2001 From: berrux_dev Date: Fri, 20 Nov 2026 10:57:04 +0100 Subject: [PATCH] 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. --- qt6-after/qt6-migrated-legatus/README.md | 5 ++++- qt6-after/qt6-migrated-legatus/new_docker_build.sh | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/qt6-after/qt6-migrated-legatus/README.md b/qt6-after/qt6-migrated-legatus/README.md index dc9184c6c..5e28e421e 100644 --- a/qt6-after/qt6-migrated-legatus/README.md +++ b/qt6-after/qt6-migrated-legatus/README.md @@ -267,7 +267,10 @@ The report is written to the tree: - `html/index.html` — browser report (line + branch coverage) -- `coverage.info` — lcov tracefile, filtered to `qt-migration-legatus/*` +- `coverage.info` — lcov tracefile: production code only. Test sources + (`unit-test/`, `UnitTests/`, `tests/`, `*unit_test*`) and generated + build artifacts (`qt6-after/build/` autogen/moc) are removed after the + extract step. - `coverage_summary.txt` — totals (line / branch hit rate) Source paths inside `coverage.info` and the html report are rewritten diff --git a/qt6-after/qt6-migrated-legatus/new_docker_build.sh b/qt6-after/qt6-migrated-legatus/new_docker_build.sh index 099bca0c7..4e3a45299 100755 --- a/qt6-after/qt6-migrated-legatus/new_docker_build.sh +++ b/qt6-after/qt6-migrated-legatus/new_docker_build.sh @@ -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" \