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:
1 parent
2f82acd7e0
commit
363bde9a0e
2 files changed
+14
-1
No files matched your search
@@ -267,7 +267,10 @@ The report is written to
|
|||||||
the tree:
|
the tree:
|
||||||
|
|
||||||
- `html/index.html` — browser report (line + branch coverage)
|
- `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)
|
- `coverage_summary.txt` — totals (line / branch hit rate)
|
||||||
|
|
||||||
Source paths inside `coverage.info` and the html report are rewritten
|
Source paths inside `coverage.info` and the html report are rewritten
|
||||||
|
|||||||
@@ -386,6 +386,16 @@ if [[ "${RUN_COVERAGE}" == "ON" ]]; then
|
|||||||
--ignore-errors="${LCOV_IGNORE_ERRORS}" \
|
--ignore-errors="${LCOV_IGNORE_ERRORS}" \
|
||||||
|| die "lcov extract failed"
|
|| die "lcov extract failed"
|
||||||
rm -f "${COV_DIR}/coverage_raw.info"
|
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)
|
# 3) browsable report (line + branch coverage per file)
|
||||||
genhtml "${COV_DIR}/coverage.info" \
|
genhtml "${COV_DIR}/coverage.info" \
|
||||||
--output-directory "${COV_DIR}/html" \
|
--output-directory "${COV_DIR}/html" \
|
||||||
|
|||||||
Reference in new issue
Block a user