AutomaticDifferentiation/coverage_test.txt

11 lines
833 B
Text
Executable file

To help the next person with a similar question, here's what I ended up doing (thanks to /u/flyingcaribou):
1- I'm using cmake to build my project and Catch for unit tests.
2- In the root CMakeLists.txt I create multiple targets, including a test executable (tests.exe)which will run all unit tests. The compile flags are -O0 -g --coverage -std=c++14.
3- ./tests.exe
4- In the build directory under ./CMakeFiles/, each target has its own subdirectory. In there (e.g. under build/CMakeFiles/targetName/src) a file with gcno extension will be created as the result of running tests. I used lcov to parse these coverage files.
5- brew install lcov
6- lcov -c -d CMakeFiles -o cov.info
7- genhtml cov.info -o out
8- open out/index.html
https://medium.com/@naveen.maltesh/generating-code-coverage-report-using-gnu-gcov-lcov-ee54a4de3f11