-
Notifications
You must be signed in to change notification settings - Fork 5
Building with code coverage
offa edited this page Mar 17, 2016
·
4 revisions
The project can build with code coverage using lcov. This feature is optional and off as default.
Code coverage is only supported in Debug-mode.
For code coverage lcov is required.
In general generating coverage files requires following steps:
- Building with coverage enabled
- Running tests
- Use
make coverageto generate coverage data
In a nutshell:
mkdir build
cmake -DCOVERAGE=ON ..
make
ctest
make coverage
Note: If no build type is specified and coverage enabled Debug will be set.
The code coverage is enabled through the COVERAGE option.
COVERAGE |
|
|---|---|
| ON | Enable coverage |
| OFF | Disable coverage (Default) |
This is usualy enabled using the -D<OPTION>=<VALUE> switch (or using the GUI):
mkdir build
cmake -DCOVERAGE=ON ..
make
Running tests:
ctest
or:
make test
Finally
make coverage
is used to generate coverage files. The files are created within the build directory in coverage/.
To reset the counters, make coverage-clean can be used.
Example:
make coverage-clean && make unittest && make coverage