Hello David,<br><br>Unfortunately there is no really good way for CTest to guess all the lines from the source code. We use GCov output, which contains the actual lines and their corresponding coverage. If the file is not used, then GCov will not contain any information and therefore it will be ignored.<br>
<br>So, as I said, we cannot just take the whole file, since the file will contain comments, empty lines, etc. I guess we could write a simple C++ parser (no such thing) that would parse files and remove comments and other useless things, but that would be way too complicated.<br>
<br>Hope that helps.<br><br>Andy<br><br><div class="gmail_quote">On Thu, Mar 5, 2009 at 11:28 AM, David Blado <span dir="ltr"><<a href="mailto:dblado@decarta.com">dblado@decarta.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Hi All,</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Some colleagues and myself are in the process of wiring in
coverage reports through CTest and CDash. We have noticed that the
percentage of code covered is not including source files for which no tests
exist. The percentage isn’t accurate because if our library has 8
source files and only 2 of those files contain functions that are hit by the
unit tests, the percentage is only calculated for those two files.</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">We have found our that using a CTestCustom.cmake (with CTEST_CUSTOM_COVERAGE_EXCLUDE)
we can exclude our test source code from the percentage, but not include
additional sources. Is there a solution to this other than to ensure that
at least one function / file is exercised by the unit tests?</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Cheers,</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">David</span></font></p>
</div>
</div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">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" target="_blank">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" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br><br clear="all"><br>-- <br>Lets bike the world together<br><a href="http://legoandy.com">http://legoandy.com</a><br>