2013-09-13 17:01:40 +00:00
|
|
|
Instructions for Testing and Measuring Code Coverage
|
|
|
|
====================================================
|
|
|
|
|
2013-09-27 03:51:59 +00:00
|
|
|
To measure code coverage, compile TESTCOV build using g++:
|
2013-09-13 17:01:40 +00:00
|
|
|
|
|
|
|
mkdir -p build/testcov
|
|
|
|
cd build/testcov
|
2013-09-27 03:51:59 +00:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Debug -DTESTCOV=ON -DCMAKE_CXX_COMPILER=g++-4.8 -G Ninja ../../src
|
2013-09-13 17:01:40 +00:00
|
|
|
|
2013-09-27 03:51:59 +00:00
|
|
|
and run:
|
2013-09-13 17:01:40 +00:00
|
|
|
|
2013-09-27 03:51:59 +00:00
|
|
|
ninja cov
|
|
|
|
|
|
|
|
It will build the project, run testcases, and compute code-coverage.
|
|
|
|
In the end, you have ``build/testcov/coverage`` directory containing
|
|
|
|
a code-coverage report in HTML format.
|
2013-09-13 17:01:40 +00:00
|
|
|
|
2013-09-27 16:27:37 +00:00
|
|
|
Make sure that the version of ``gcov`` matches with the one of
|
|
|
|
``g++``. Also try to use the latest ``lcov`` (currently lcov-1.10)
|
|
|
|
if you have a problem with the existing one:
|
|
|
|
|
|
|
|
wget http://downloads.sourceforge.net/ltp/lcov-1.10.tar.gz;
|
|
|
|
tar xvfz lcov-1.10.tar.gz;
|
|
|
|
cp -v lcov-1.10/bin/{lcov,genpng,gendesc,genhtml,geninfo} /usr/bin/;
|
|
|
|
rm -rf lcov-1.10.tar.gz lcov-1.10;
|
2013-09-13 17:01:40 +00:00
|
|
|
|
|
|
|
[gcov]: http://gcc.gnu.org/onlinedocs/gcc/Gcov.html
|
|
|
|
[lcov]: http://ltp.sourceforge.net/coverage/lcov.php
|