[CMake] Coverage information overestimated? Globbing for *.gcno instead of *.gcda?

Bill Hoffman bill.hoffman at kitware.com
Mon Apr 27 10:16:19 EDT 2009


Tom Vercauteren wrote:
> Hi All,
> 
> I just saw that when ctest is used to generate coverage information,
> it looks for (gc)da files in the build directory - cf.
> cmCTestCoverageHandler::FindGCovFiles in cmCTestCoverageHandler.cxx.
> 
> If I understand it correctly, when everything is setup correctly for a
> coverage build:
>   - gcc generates (gc)no files at compile time
>   - (gc)da files are generated at run time - i.e. when the unit tests are run
> 
> So, it seems to me that for each (gc)da file we are sure that a (gc)no
> file exists but not the other way round.
> 
> Since ctest is looking for (gc)da files, it seems to me that it will
> lead to over-estimating the coverage information. Indeed, some code
> can be compiled but never executed by the unit tests.
> 
> Am I missing something here?
> 
> If not the patch should be straightforward, in
> cmCTestCoverageHandler::FindGCovFiles, we only to replace
>   daGlob += "/*.da";
> by
>   noGlob += "/*.no";
> and
>   daGlob += "/*.gcda";
> by
>   noGlob += "/*.gcno";
> 
> I'll be happy to submit a bug report and a patch if someone more
> knowledgeable than I am in gcov and ctest could confirm this issue.
> 

I don't think this is a problem.   Do you have an example that shows the 
problem?  If the code is not run, it does not produce any coverage 
information in any file for ctest to find???

-Bill


More information about the CMake mailing list