12

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?

user3033456
  • 121
  • 5
  • Same thing happens to me. A working script suddenly starts giving me "negative counts." – Vinnie Falco Jul 26 '17 at 01:02
  • 2
    How do you run lcov and is there a difference between folder and file checksum? @paercebal do you think it's a good idea to reopen a legacy thread like this with a bounty and probably an OP that won't answer questions anymore (Last seen Apr 11 '16)? – Daniel W. Mar 11 '19 at 13:59
  • @DanFromGermany : You're right. Our problem is probably the same as Vinnie Falco's, but not exactly the same as the OP. I reverted the question to its original state. On our side, we'll do further research, and will post a complete question, with command lines, logs, and info, taking into account your comment. – paercebal Mar 11 '19 at 15:14

2 Answers2

1

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:

-1

See this bug report : https://github.com/psycofdj/coverxygen/issues/6

Replacing all counts of -1 in the output with 0 (e.g. with sed -i -e 's/,-1$/,0/g' ) 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.

mkebri
  • 2,025
  • 1
  • 16
  • 14