我想使用 gcov 和 lcov 生成覆盖率报告。
到目前为止我所做的:-
1. I compiled my code using --fprofile-arcs and -fprofile-coverage in
g++.
2. I have linked using lcov.
3. I have .gcno files with th e.o location.
4. When I execute binary, it is resulting into .gcda files.
Run Code Online (Sandbox Code Playgroud)
我必须做什么:-
我必须使用这些数据文件 (.gcda),并希望使用 lcov 创建一个干净的报告。
问题:-
有多个目录,其中有源文件,并且在每个目录中我创建一个 obj/ARCH 目录来保存目标文件。
因此最终的目录结构将是:-
proto ----> MJ1 ----> MJ2 ----> MJ3 ----> MJ4 ----> MJ5
MJ1 ----> .cpp
----> obj/linux/*.o *.gcno *.gcda
MJ2 ----> .cpp
----> obj/linux/*.o *.gcno *.gcda
Run Code Online (Sandbox Code Playgroud)
与M3、M4、M5相同。
我正在从原型级别执行 lcov,它找到 .gcda 文件,但在查找 .h 和 .C 文件时出现一些错误。知道如何使该流程路径独立吗?
Error:-
../MjUtil/glob.h:cannot open source file
../MjUtil/MJError.h:cannot open source file
../MjUtil/OsStatisticsFile.h:cannot open source file
Run Code Online (Sandbox Code Playgroud)
提前致谢。