I'm generating code coverage for a C++ project.
My project has multiple binaries in it. When I'm running unit tests, it generates the gcda files and I generate code coverage based on the respective gcda and gcno files.
This is the command I run:
gcovr --gcov-ignore-parse-errors -r $repositoryRootDir `
--object-directory $gcdaSourceDir --xml "outputDir/coverage_cpp_$currentTime.xml"
Everytime I run gcovr, it generates the coverage for the entire repository, which is not ideal for my use case.
How do I make sure that only certain binaries (or gcda files) are covered in the coverage?
Note: I would love to avoid filter or exclude flags, looking at the shape and structure of the repo if that is an option.
--filter ...option not do what you want?lcovdoes what you want - if I understand what you want. In particular, if you don't use either of the--allor--initialflags during capture, then only the GCDA files will be processed. This does involve using a different tool, though. Perhaps not what you want.