[#372] Enhance coverage script to generate branch coverage reports for workspace and individual components#1350
[#372] Enhance coverage script to generate branch coverage reports for workspace and individual components#1350Afshankk wants to merge 1 commit intoeclipse-iceoryx:mainfrom
Conversation
…rage reports for workspace and individual components
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1350 +/- ##
==========================================
- Coverage 77.81% 77.80% -0.02%
==========================================
Files 412 412
Lines 39008 39008
Branches 1256 1256
==========================================
- Hits 30354 30350 -4
- Misses 7621 7625 +4
Partials 1033 1033
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
| if [[ $SHOW_BRANCHES == "1" ]]; then | ||
| GCOVR_BRANCH_FLAG="--branches" | ||
| fi |
There was a problem hiding this comment.
I'm not sure if this flag has any effect because we see the branch coverage already in the existing report for the C++ Code and this flag is in gcovr marked as deprecated and affects only the txt output.
When comparing the reports where the flag is enabled/disabled there seems to be no difference.
| echo " -l|--lcov - creates lcov report" | ||
| echo " -t|--html - creates html report" | ||
| echo " -f|--full - generate coverage report and create html and lcov" | ||
| echo " -b|--branches - include branch coverage in reports" |
There was a problem hiding this comment.
The branch coverage can be enabled by default so that the additional parameter here is not needed.
| echo " $0 --generate --html --component iceoryx2-cal" | ||
| echo | ||
| echo " Generate coverage for multiple components:" | ||
| echo " $0 --generate --html --component iceoryx2 --component iceoryx2-cal" |
There was a problem hiding this comment.
I tried this command and it generates an empty report for the Rust code. The target folder was cleaned up before. It could be maybe related to the handling of GRCOV_IGNORES in the generate_report() function.
The Rust build and test respects the component setting correctly.
Notes for Reviewer
This PR enhances the coverage script (
internal/scripts/generate-cov-report.sh) to support branch coverage reporting and per-component coverage generation.Key Changes:
--branchesflag to enable branch coverage in reports (for both Rust and C++)--component <name>flag to generate coverage for specific components (can be used multiple times)show_overview()andshow_report()functions to support branch coverage filteringgenerate_rust_profile()to support testing individual components viacargo test -pgenerate_report()to dynamically build ignore patterns for component filteringTesting:
The script now supports multiple usage patterns:
./generate-cov-report.sh --full --branches./generate-cov-report.sh --generate --html --component iceoryx2-cal./generate-cov-report.sh --html --component iceoryx2 --component iceoryx2-cal --branchesDocumentation:
doc/release-notes/iceoryx2-unreleased.mdunder Workflow sectionPre-Review Checklist for the PR Author
iox2-372)[#372])References
Closes #372