Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lcov inconsistent coverage

I started using lcov about a month back. The coverage count seems inconsistent. The first run reported about 75% line coverage where as second run reported only 19%. The test suite used was some for both the runs. I see following warning during lcov --remove. Any suggestions?

lcov: WARNING: negative counts found in tracefile all.info

Is this something to worry about?

like image 894
user3033456 Avatar asked Aug 30 '14 19:08

user3033456


1 Answers

Same known issue is reported here on GitHub.

Replacing all counts of -1 in the output with 0 (e.g. with sed -i -e 's/,-1$/,0/g' <outputfile>) causes the warning to disappear from the lcov and genhtml output while still producing the correct coverage report.

More importantly (at least for me), submitting the file with the counts set to 0 instead of -1 to codecov.io results in the results being parsed correctly and the coverage information being available through codecov.io.

Codecov also handle this kind of value error:

# Fix negative counts
$count = $2 < 0 ? 0 : $2;
if ($2 < 0)
{
  $negative = 1;
}

Follow some other fixes:

  • Fix Undocumented Value
  • Remove fix for negative coverage counts
like image 90
stefan Avatar answered Sep 29 '22 10:09

stefan