[CMake] CTest w/ Coverage

Daniel Stonier d.stonier at gmail.com
Sun Apr 12 23:06:03 EDT 2009


Ian, are you using ccache?

Just found that buggers the process up completely. If you're using a
ccache link to the compiler, then the two-step compile-link process
fails to build the gcno coverage file (or misplaces it). I removed my
ccache links and did it again manually and presto, the coverage file
appeared.

Then went back to cmake, didn't change any of the files I listed in
the earlier email, no CTestConfig.cmake etc etc and it worked fine.

I'm not sure if there's a fix for getting it to work with ccache or
not, will keep digging around.

Cheers,
Daniel Stonier.


2009/4/13 alex gouaillard <alexandre_gouaillard at hms.harvard.edu>:
> 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
>
>


More information about the CMake mailing list