mrks
mrks

Reputation: 8343

gcovr does't generate reports for some branches on Jenkins

We found that for some of our Github branches that are automatically pulled into Jenkins, gcovr does not generate any coverage information. It claims that no files are found and returns a code coverage of 0%.

Other branches work fine. Once we pull the code into master, gcovr can generate code coverage files for the very same code.

Upvotes: 3

Views: 608

Answers (1)

mrks
mrks

Reputation: 8343

This happens because gcov creates files that hold the entire path, e.g. #usr#include#boost#numeric#conversion#detail#converter.hpp.gcov. If the branch name is part of Jenkins' workspace path, a long branch name may kick some of these generated file names over the filesystem's maximum file name length.

To fix this, set gcov to hash the filenames and run gcovr in two passes:

gcovr -r `pwd` --gcov-executable="gcov -s `pwd` -x" -k
gcovr -r `pwd` --gcov-executable="gcov -s `pwd` -x" -g --html --html-details -o coverage/index.html

Upvotes: 3

Related Questions