Test coverage test¶
Find out which code lines are executed by any functional test.
Debian: packages lcov and gcovr
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!
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.
|Date||unit tests||fu tests||both|