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

Daniel Blezek Blezek.Daniel at mayo.edu
Mon Apr 27 11:34:59 EDT 2009


Hi Bill,

  I bumped into this problem as well.  We had several classes that were
compiled, but no methods in them were run.  CTest ignored them and we didn't
have any coverage information on our dashboard.  I would second this
recommendation to accumulate coverage based on what is compiled.  As far as
I'm concerned code that is not executed is totally broken, but there is no
way to have CTest/CDash tell us.

-dan


On 4/27/09 10:01 AM, "Bill Hoffman" <bill.hoffman at kitware.com> wrote:

> Tom Vercauteren wrote:
>>>> 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.
>>>> 
>>> 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???
>> 
>> The reason I am looking at this is because I would like to get a
>> global coverage percentage that reflects the coverage of my project as
>> a whole as opposed to only the subset that has some unit tests.
>> 
>> So, it would be interesting for me to show on a cdash-dashboard this
>> compiled but untested code (at least not automatically by ctest). One
>> way to do that might be to use gcno files instead of gcda files in
>> ctest.
>> 
>> The coverage information that I would get form it is that when a gcno
>> file exists but has no gcda counterpart, there is no coverage at all.
>> Right now, this is silently discarded.
>> 
>> Tom
>> 
>> P.S.: Thanks for the lightning fast answer!
>> 
> CTest does that for you.  As you run tests ctest will accumulate the
> test code that is actually run.  I am not sure I understand the coverage
> information you are looking for?  What does compile time coverage mean?
> 
> 
> -Bill
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake

-- 
Daniel Blezek, PhD
Medical Imaging Informatics Innovation Center

P 127 or (77) 8 8886
T 507 538 8886
E blezek.daniel at mayo.edu

Mayo Clinic
200 First St. S.W.
Harwick SL-44
Rochester, MN 55905
mayoclinic.org




More information about the CMake mailing list