<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">if you using gcc, compile you code with the right options, and you re good.<div><a href="http://www.cmake.org/Wiki/CTest:Coverage">http://www.cmake.org/Wiki/CTest:Coverage</a></div><div><span class="Apple-style-span" style="font-family: -webkit-sans-serif; font-size: 13px; line-height: 19px; "><h2 style="color: black; background-image: none; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: initial; font-weight: normal; margin-top: 0px; margin-right: 0px; margin-left: 0px; padding-top: 0.5em; padding-bottom: 0.17em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(170, 170, 170); font-size: 150%; margin-bottom: 0.6em; background-position: initial initial; "><span class="mw-headline">Coverage With C++</span></h2><div style="margin-top: 0.4em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; line-height: 1.5em; ">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:</div><pre style="padding-top: 1em; padding-right: 1em; padding-bottom: 1em; padding-left: 1em; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(47, 111, 171); border-right-color: rgb(47, 111, 171); border-bottom-color: rgb(47, 111, 171); border-left-color: rgb(47, 111, 171); color: black; background-color: rgb(249, 249, 249); line-height: 1.1em; ">-fprofile-arcs -ftest-coverage
</pre><div style="margin-top: 0.4em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; line-height: 1.5em; ">Also make sure to pass these flags to C compiler, CXX compiler, and the linker. For example:</div><pre style="padding-top: 1em; padding-right: 1em; padding-bottom: 1em; padding-left: 1em; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(47, 111, 171); border-right-color: rgb(47, 111, 171); border-bottom-color: rgb(47, 111, 171); border-left-color: rgb(47, 111, 171); color: black; background-color: rgb(249, 249, 249); line-height: 1.1em; position: static; z-index: auto; ">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"</pre></span></div><div>"</div><div>"</div><div><br></div><div>then just run ctest.</div><div><br></div><div>no need for special ctest script.</div><div><br></div><div>alex.</div><div><br><div><div>On Apr 12, 2009, at 10:36 PM, Ian Monroe wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On Sun, Apr 12, 2009 at 8:51 PM, Daniel Stonier <<a href="mailto:d.stonier@gmail.com">d.stonier@gmail.com</a>> wrote:<br><blockquote type="cite">I'm having a few troubles understanding how to get CTest setup. The<br></blockquote><blockquote type="cite">wiki is a bit piecemeal and just need a pointer in the right<br></blockquote><blockquote type="cite">direction.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Currently, the ctest results are passing for a simple hello world<br></blockquote><blockquote type="cite">project, but I can't get coverage working.<br></blockquote><br>I'm in pretty much the exact same position. I'm pretty sure I need to<br>write a CTest script to do coverage testing, but the docs mostly seem<br>to be innuendo on this subject, so I don't know where to start.<br><br>Ian<br>_______________________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a><br></div></blockquote></div><br></div></body></html>