我开始使用 lcov
大约一个月后。覆盖计数似乎不一致。第一次运行报告了大约 75% 的线路覆盖率,而第二次运行仅报告了 19%。两次运行都使用了一些测试套件。我在 lcov --remove
期间看到以下警告.有什么建议吗?
lcov: WARNING: negative counts found in tracefile all.info
这是需要担心的吗?
最佳答案
同知 issue在 GitHub 上报告了这里。
Replacing all counts of
-1
in the output with0
(e.g. withsed -i -e 's/,-1$/,0/g' <outputfile>
) causes the warning to disappear from thelcov
andgenhtml
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
tocodecov.io
results in the results being parsed correctly and the coverage information being available throughcodecov.io
.
Codecov还处理这种值错误:
# Fix negative counts
$count = $2 < 0 ? 0 : $2;
if ($2 < 0)
{
$negative = 1;
}
遵循一些其他修复:
关于code-coverage - Lcov 不一致的覆盖范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25585895/