Generate coverage report
Coverage measurement is typically used to gauge the effectiveness of tests. It can show which parts of your code are being exercised by tests, and which are not.
The following dependencies are required for building coverage reports:
apt-get install binutils gcc lcov python3
ENABLE_COVERAGE when running cmake. To enable branch coverage, set
cmake -GNinja .. \ -DCMAKE_C_COMPILER=gcc \ -DCMAKE_CXX_COMPILER=g++ \ -DENABLE_COVERAGE=ON \ -DENABLE_BRANCH_COVERAGE=ON
The coverage target is associated to the test target.
ninja coverage-check builds a coverage report for the check target.
ninja coverage-check-functional for the check-functional target, etc.
To get a global coverage, one can use
ninja coverage-check-all or
The coverage report is generated in a folder named
ninja coverage-check-all will generate the report in the
cmake -GNinja .. \ -DCMAKE_C_COMPILER=gcc \ -DSECP256K1_ENABLE_COVERAGE=ON \ -DSECP256K1_ENABLE_BRANCH_COVERAGE=ON ninja coverage-check-secp256k1