I'm confused about how to use gcov
. I've got a cmake project that has two test executables which use googletest. I've added the required flags to my cmake script:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -g -O0")
And I've recompiled my code (using CLion and g++ 10.1).
Now I switch to the build directory and manually run both test suites. This, according to the docs should generate some files that can be used to generate the coverage report. Now I should be able to run
gcovr .
from the root of the build tree (right?), however the output is this:
(base) ciaran@DESKTOP-K0APGUV:/mnt/d/libOmexMeta/cmake-build-release-wsl-ubuntu1804-gcc101$ gcovr .------------------------------------------------------------------------------ GCC Code Coverage ReportDirectory: .------------------------------------------------------------------------------File Lines Exec Cover Missing------------------------------------------------------------------------------------------------------------------------------------------------------------TOTAL 0 0 --%------------------------------------------------------------------------------
Any idea what I've doing wrong?
#EditAlso running
gcovr -r . --html --html-details -o example-html-details.html
Works, but generate an empty report