我尝试将Codecov添加到我的library CI构建系统中。travis script如下所示:
lcov --directory . --capture --output-file coverage.info --gcov-tool gcov-8 # capture coverage info
lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system
lcov --list coverage.info # debug info
# Uploading report to CodeCov
bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"当我在本地Linux Mint机器上运行这些命令时,一切工作正常。但在Travis上却并非如此。Report看起来是这样的:
Capturing coverage data from .
Found gcov version: 8.1.0
Scanning . for .gcda files ...
geninfo: WARNING: /home/travis/build/AMS21/Andres-Standard-Library/CMakeFiles/unittest.dir/test/src/cstddef/offsetof_test.cpp.gcno: Overlong record at end of file!
Found 132 data files in .
Processing unittest.dir/test/src/cstddef/offsetof_test.cpp.gcda
geninfo: WARNING: cannot find an entry for #home#travis#build#AMS21#Andres-Standard-Library#test#include#doctest.h.gcov in .gcno file, skipping file!
geninfo: WARNING: cannot find an entry for #home#travis#build#AMS21#Andres-Standard-Library#test#src#cstddef#offsetof_test.cpp.gcov in .gcno file, skipping file!
(...)
Finished .info-file creation
lcov: ERROR: no valid records found in tracefile coverage.info
Reading tracefile coverage.info
Reading tracefile coverage.info
lcov: ERROR: no valid records found in tracefile coverage.info所以很明显这里有一个问题,但我不明白是什么。我不能在我的本地机器上复制它,在网上搜索我也找不到解决方案。
travis和我的本地机器都使用gcov 8.1.0。在travis上,我使用lcov 1.13,在我的本地机器上使用1.12版。我使用下面的flags进行编译
-Wall (... various warning flags) -m32 -g -O0 -fprofile-arcs -ftest-coverage --coverage我将非常感谢任何解决方案或想法。
编辑:修复问题。看起来是gcc 8造成了一些问题。使用gcc 7就可以了。
发布于 2018-11-08 22:27:08
我遇到了类似的问题,我通过将LCOV更新到1.13-4版本来解决它(在ubuntu 18.04 LTS上,apt可用的版本是1.13-3)
https://stackoverflow.com/questions/51455904
复制相似问题