4

I am looking for a solution to have a code coverage statistics among all C source file compiled in one cmake project and published under Jenkins.

I use CMake 2.8.9, gcovr 3.1, Jenkins 1.564 and tried many different version of gcc/gcov (4.7.2 and >= 4.8.0).

As far as I know I have two different solution :

On one hand using gcovr leads to a cobertura xml file publishable under jenkins but I have failed taking in account uncovered file in coverage stats. This is because untested file are not taken in account by gcov despite .gcno exist (but not .gcda) indeed no .gcov file is generated for .gcno only files, instead gcov print a "Removing ..." message. I suspect gcov to have change its behavior so that gcovr doesn't wrok with untested file anymore (but I never saw it work), however I am unable to find the correct version of gcc/gcov and I tried many (4.7.2 and >= 4.8.0).

On the other hand Cmake computes a correct statistics taking in account untested file but cannot generate cobertura report to be published in jenkins ...

I'm in need of a workaround in gcovr or a cmake coverage to cobertura xslt or every other option that would answer this problem.

Thanks a lot for your suggestions

Pierre

  • Related bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35568 – tauran Jun 24 '14 at 08:42
  • 1
    Though not entirely related to your question, I faced a similar issue when using lcov for generation coverage reports for untested files. lcov has an option ( --initial ) with with the help of which we can generate 0% coverage report for all compiled sources ( so you need to get all the files you want coverage report to be compiled.I did this by adding dependency to the production library in cmake when building my test executables ).Then run the tests,get the actual coverage , merge with the 0% report and we have the correct report which shows 0% for untested files. – k0n3ru Jul 07 '15 at 05:20

0 Answers0