Test coverage test

Find out which code lines are executed by any functional test.

Requirements

Debian: packages lcov and gcovr

Usage

cd <src_directory>
mkdir covbuild
cd covbuild         # must be empty
cmake -DCMAKE_BUILD_TYPE=Coverage -DBORNAGAIN_DEBUG_OPTIMIZATION=ON ..
make
make coverage       # yields unit test coverage
ctest
make coverage       # yields unit&functional test coverage
make coverage_reset 
ctest               
make coverage       # yields functional test coverage

This generates a bunch of HTML pages, with summary at coverage/index.html.

When 'make coverage_reset' is run before 'make', then unit tests will also contribute to the reported coverage.
When 'make coverage_reset' is run after 'make', then only functional tests contribute.

Parallel computing (-j) distorts coverage report!

Notes

The flag BORNAGAIN_DEBUG_OPTIMIZATION adds the -Og flag (gcc only) which is not strictly necessary, but makes the tests run much faster at minimal cost to coverage accuracy.

Log

Date unit tests fu tests both
%lines %fcts %lines %ftcts %lines %ftcts #lines #ftcts
master-1.7 23.6 32.3 42.9 46.8 47.0 51.9 36473 7710