[CMake] CTest w/ Coverage

alex gouaillard alexandre_gouaillard at hms.harvard.edu
Sun Apr 12 22:50:59 EDT 2009


if you using gcc, compile you code with the right options, and you re  
good.
http://www.cmake.org/Wiki/CTest:Coverage
Coverage With C++

Currently coverage is only supported on gcc compiler. To perform  
coverage test, make sure that your code is built with debug symbols,  
without optimization, and with special flags. These flags are:
-fprofile-arcs -ftest-coverage
Also make sure to pass these flags to C compiler, CXX compiler, and  
the linker. For example:
CXXFLAGS="-g -O0 -Wall -W -Wshadow -Wunused-variable \
  -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers \
  -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs - 
ftest-coverage"
CFLAGS="-g -O0 -Wall -W -fprofile-arcs -ftest-coverage"
LDFLAGS="-fprofile-arcs -ftest-coverage"
"
"

then just run ctest.

no need for special ctest script.

alex.

On Apr 12, 2009, at 10:36 PM, Ian Monroe wrote:

> On Sun, Apr 12, 2009 at 8:51 PM, Daniel Stonier  
> <d.stonier at gmail.com> wrote:
>> I'm having a few troubles understanding how to get CTest setup. The
>> wiki is a bit piecemeal and just need a pointer in the right
>> direction.
>>
>> Currently, the ctest results are passing for a simple hello world
>> project, but I can't get coverage working.
>
> I'm in pretty much the exact same position. I'm pretty sure I need to
> write a CTest script to do coverage testing, but the docs mostly seem
> to be innuendo on this subject, so I don't know where to start.
>
> Ian
> _______________________________________________
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090412/967ddbe7/attachment-0001.htm>


More information about the CMake mailing list