Skip to content
Commit 4f790972 authored by Rob Walton's avatar Rob Walton Committed by Jaeden Amero
Browse files

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: Rob Walton's avatarRobert Walton <rob.walton@arm.com>
Co-authored-by: Hugues Kamba Mpiana's avatarHugues Kamba-Mpiana <hugues.kambampiana@arm.com>
parent 2a1861cc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment