cmake: Add code coverage report generation
Add code coverage report generation with CMake rather than `pre-commit`. This reduces the coupling between git commit hooks which are installed through `pre-commit` and post-build coverage generation. Developers who install commit hooks will no longer be forced to build and run tests before committing changes which are not relevant to source code (for example docs or CI changes). Add a `covreport` target to CMake which will generate the code coverage report. This target should be run after tests are executed to ensure coverage files have been generated. The line coverage threshold can be set by passing `GCOVR_FAIL_UNDER_LINE` at CMake configure time. For example `-DGCOVR_FAIL_UNDER_LINE=50` would set the line coverage threshold to 50%. The coverage report output is stored in the build directory. Update CI to run unit tests and `pre-commit` in separate CI jobs, and update the unit-tests job to run the coverage generation. Signed-off-by:Robert Walton <rob.walton@arm.com> Co-authored-by:
Hugues Kamba-Mpiana <hugues.kambampiana@arm.com>
Loading
Please register or sign in to comment