-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use code-coverage.cmake
from cmake-scripts
#124
Comments
Okay I figured out why the What is even weirder is that when generating the code coverage data, it includes |
Okay, I don't know how I didn't see this before. It's so simple. To instrument a library target and an executable one, just call Although it also imports |
It should though, e.g. using Makefiles on Mac, the code coverage data is stored in cmake -Htest -Bbuild/test -DENABLE_TEST_COVERAGE=1
cmake --build build/test
./build/test/GreeterTests To summarise the data you could simply call > gcovr
------------------------------------------------------------------------------
GCC Code Coverage Report
Directory: .
------------------------------------------------------------------------------
File Lines Exec Cover Missing
------------------------------------------------------------------------------
source/greeter.cpp 8 8 100%
------------------------------------------------------------------------------
TOTAL 8 8 100%
------------------------------------------------------------------------------ TBH I don't do much local analysis myself and rely on platforms such as codecov.io for a nice visualisation. But all the data should be there and you should be able to easily generate the html reports locally. I'm not really sure about the advantage of adding additional abstraction for the coverage, as the flags are straightforward to use and give most user control without additional required code. To read more about gcov and how the flags work, see the wikipedia entry. |
As far as I see it, the current solution doesn't support |
This doesn't seem to work anymore:
|
@acgetchell try a |
@ClausKlein That fixes it, thanks! |
Currently, the template just applies
-fprofile-arcs -ftest-coverage
to theGreeter
target fromtest
. As far as I could tell, it doesn't really generate the code coverage data locally, and I think it'd be useful to be able to do that.The
code-coverage.cmake
script exposes targets that we can run if we want to generate the data locally too. It also does checks that the current ModernCppStarter solution doesn't.The text was updated successfully, but these errors were encountered: