g++ (Ubuntu 9.4.0-1ubuntu1~18.04) 9.4.0
gcov (Ubuntu 9.4.0-1ubuntu1~18.04) 9.4.0
lcov: LCOV version 1.13main
产出:
Capturing coverage data from .
Found gcov version: 9.4.0
Scanning . for .gcda files ...
Found 1 data files in .
Processing main.gcda
geninfo: WARNING: /home/home/main.gcno: Overlong record at end of file!
geninfo: WARNING: cannot find an entry for main.cpp.gcov in .gcno file, skipping file!
Finished .info-file creation产出:
genhtml: ERROR: no valid records found in tracefile main.info发布于 2021-10-19 18:27:05
到目前为止,我还没有设法利用lcov。但我找到了一个对我有用的解决方案。
使用https://github.com/gcovr/gcovr
-fprofile-arcs -ftest-coverage -g -O0
-lgcov)
gcovr。(如果使用cmake,则需要通过所有CMakeFiles/{all子文件夹}..dir/src/* directories)gcovr {rootDir} -r {sourceDir} -g -k --html --html-details -o tp.html递归运行此命令。
rootDir -您可以从其中访问.gcov的目录。sourceDir - tp.html报告中的资料来源
https://stackoverflow.com/questions/69619050
复制相似问题