3

The gcov data files (*.gcda) accumulate the counts across multiple tests. That is a wonderful thing. The problem is, I can't figure out how to get the .gcov files to accumulate in the same way the .gcda files do.

I have a large project (53 header, 54 cpp) and some headers are used in multiple cpp files. The following example is radically simplified; the brute force approach will take days of manual, tedious work if that is required.

Say for example I have xyz.hpp that defines the xyz class. On line 24 it defines the build() method that builds xyz data, and on line 35 it defines the data() method that returns a reference to the data.

Say I run my test suite, then I execute gcov on abc.cpp. The xyz.hpp.gcov report has a count of 5 for line 24 (build) and a count of zero for line 35 (data). Now I run gcov on def.cpp, and the xyz.hpp.gcov report has a count of zero for line 24 and a count of 7 for line 35. So, instead of accumulating the report information and having a count of 5 for line 24 (build) and 7 for line 35 (data), it replaces the xyz.hpp.gcov each time so all counts are reset. I understand why that's the default behavior, but I can't seem to override it. If I'm unable to accumulate the .gcov reports programatically, I'll be forced to manually compare, say, a dozen different xyz.hpp.gcov in order to assess the coverage.

It looks like LCOV is able to do this accumulation, but it takes weeks to get new software installed in my current work culture.

Thanks in advance for any help.

Luv2code
  • 1,079
  • 8
  • 14

0 Answers0