[CMake] Running coverage analysis

Bill Lorensen bill.lorensen at gmail.com
Tue Jan 3 14:50:21 EST 2012


There are ITK Utilities scripts that I plan to move into VTK. For the
time being, you can run them on VTK if you have an ITK checkout. I
have been doing this with some VTK classes I plan to add. The
computeCodeCoverageLocallyForOneTest.sh is especially useful if you
want to check coverage on a few classes.


http://itk.org/gitweb?p=ITK.git;a=blob;f=Utilities/Maintenance/computeCodeCoverageLocally.sh;h=539e6c62c2dc2ba9f7c16b915120915fe192f67a;hb=HEAD
http://itk.org/gitweb?p=ITK.git;a=blob;f=Utilities/Maintenance/computeCodeCoverageLocallyForOneTest.sh;h=e988504f2776ba562d19c812a4570a0d8d060e3a;hb=HEAD

They describe the flags you need.

On Tue, Jan 3, 2012 at 10:47 AM, David Cole <david.cole at kitware.com> wrote:
> The way I have always approached problems like this is to check out
> what existing scripts are doing that are already successfully
> submitting coverage results.
>
> This one is on the VTK dashboard:
> http://cdash.org/CDash/viewNotes.php?buildid=1880030
>
> This one on CMake:
> http://cdash.org/CDash/viewNotes.php?buildid=1879840
>
> This one on ITK:
> http://cdash.org/CDash/viewNotes.php?buildid=1879940
>
> A simplest minimal example script that works with your example project
> should be fairly easy to derive by distilling the coverage-related
> elements from those scripts.
>
> I think there's also a script in the ITK source tree that helps you
> run coverage on just your own test and inspect the results locally. I
> can't remember its whereabouts, but I bet you could find that too if
> you search the ITK list archives.
>
>
>> It'd be great if someone could add a simple example script that calls
>> ctest_coverage to this example, along with the procedure to run it and
>> inspect the result: http://www.cmake.org/Wiki/CTest/Coverage/Example
>
>
> I agree. That would be great.
>
>
> Hopefully, this is helpful, for now.
> David C.
>
>
> On Tue, Jan 3, 2012 at 10:18 AM, David Doria <daviddoria at gmail.com> wrote:
>> On Tue, Jan 3, 2012 at 9:52 AM, David Cole <david.cole at kitware.com> wrote:
>>>
>>> To actually run the coverage testing, you need to have tests added with
>>> add_test in your CMakeLists file, then you need to run a ctest -S script
>>> that calls ctest_coverage, or use one of the predefined coverage dashboard
>>> targets. (Use 'make help | grep Coverage' to see those.)
>>
>>
>> When I run 'make help' from that example project's build dir I just see
>>
>> doriad at david-lab:~/build/Examples/CTest/Coverage$ make help
>> The following are some of the valid targets for this Makefile:
>> ... all (the default if no target is provided)
>> ... clean
>> ... depend
>> ... Coverage
>> ... edit_cache
>> ... rebuild_cache
>> ... test
>> ... coverage.o
>> ... coverage.i
>> ... coverage.s
>>
>> I also ran 'make help | grep Coverage' in the VTK build dir (because I'd
>> assume the dashboard targets you're talking about would be in a big project
>> like VTK) but there is no output. Are these dashboard targets project
>> specific? That is, if I'm working on a project that does not have a
>> dashboard server, how would you see the coverage report?
>>
>> It'd be great if someone could add a simple example script that calls
>> ctest_coverage to this example, along with the procedure to run it and
>> inspect the result: http://www.cmake.org/Wiki/CTest/Coverage/Example
>>
>> David
> --
>
> 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



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the CMake mailing list