[CMake] gcov results not accurate

Bill Lorensen bill.lorensen at gmail.com
Thu Mar 5 14:34:43 EST 2009


In itk, we have header smoke tests that include each header file. The
test main just returns success. This will cause non-templated code to
be compiled and it will show up in the coverage reoptrs. There is
still a problem if you use templated code and do not instantiate at
least one copy of the template.

BTW, this include smoke test often uncovers problems like missing or
misnamed #ifndef blockers.

Bill

On Thu, Mar 5, 2009 at 11:28 AM, David Blado <dblado at decarta.com> wrote:
> Hi All,
>
>
>
> 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.
>
>
>
> 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?
>
>
>
> Cheers,
>
> 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
>


More information about the CMake mailing list