code-coverage - 源和对象位于不同目录时的覆盖率报告
问题描述
我正在尝试为我的项目生成覆盖率报告并遇到问题。
我知道要获得覆盖信息,我需要 .gcno、.gcda 和源文件。我当前的项目目录结构是
/root/proj/src --> top level Makefile and main.c
/root/proj/src/module1
/root/proj/src/module2
..... -> contains all .c/.h ,makefile
/root/proj/build/obj -> contains all .o,.gcno,.gcda files after compilation
/root/proj/build/exe -> contains the executable
(复制下面的最少行以显示问题)
cd /root/proj/build/obj
当我跑步时
lcov -b ../../src/ --directory . --capture --output-file app.info
Processing module1.gcda
module1.c:cannot open source file
......
Finished .info-file creation
然后 :
genhtml --legend -o ./latest_code_cov/ app.info
Reading data file app.info
Found 5 entries.
Found common filename prefix "/root/proj/src"
Writing .css and .png files.
Generating output.
Processing file src/module1.c
genhtml: ERROR: cannot read /root/proj/src/module1.c
bash-4.1$
1) 我是否需要更改我的 makefile 以将文件转储.gcno/.gcda
到与源相同的文件夹中?
2)有没有办法(一些标志)在文件中设置源文件路径.gcno/.gcda
?
有什么建议么?
gcc 版本 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
lcov:LCOV 1.13 版
解决方案
推荐阅读
- c++ - 找不到函数的c ++错误标识符?
- protractor - 在量角器的 BeforeAll 函数中执行 2 个查询时无法获取正确的数据
- java - 嵌套类@Configuration @Bean 创建中的spring Bean Overriding 2.1.x 失败,并显示“已经定义了具有该名称的bean”
- python - QTableView点击信号从未发出?
- visual-studio - 原生可视化器能否根据其集合的参数名称修改项目的显示?
- sdk - gsutil 路径名未从命令行传递到目标存储桶
- php - 从选择选项 html 中读取多个值
- ios - 如何找到按下的子层?
- ios - 谷歌地图在iOS Swift中按纬度和经度放置信息
- neo4j - graphaware 是否支持 neo4j 中的荷兰语 nlp?