Lar*_*lke 7 c++ code-coverage cmake gcov lcov
我正在尝试在我的基于CMake的项目(包含几个目标)上获得代码覆盖率.
首先,我生成gcno文件:
lcov -b . -d . -o coverage.output --capture --initial
Run Code Online (Sandbox Code Playgroud)
在*.gcno在产生
build_dir/[target_dir]/CMakeFiles/[target_dir].dir
Run Code Online (Sandbox Code Playgroud)
然后我运行我的测试,生成*.gcna文件
build_dir/tests/CMakeFiles/[target_dir].dir
Run Code Online (Sandbox Code Playgroud)
当我现在再次运行lcov时:
lcov -b . -d . -o coverage.output --capture
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Scanning . for .gcda files ...
Found 23 data files in .
Processing Base.dir/DateTools.cpp.gcda
geninfo: ERROR: build_gcov/tests/CMakeFiles/Base.dir/DateTools.cpp.gcno: could not open file
Run Code Online (Sandbox Code Playgroud)
当我手动移动*.gcno文件到该目录*.gcda产生它似乎工作.
谢谢你的帮助!!!