1. In makefile, add build flags "-fprofile-arcs -ftest-coverage"
2. mmake debug to generate .gcno file for each .cpp file
3. Run ./testHello and exit normally
4. lcov --directory ./ --capture --output-file app.info
5. genhtml --legend -q -o coverage app.info
本文介绍了一种使用GCC进行代码覆盖度测试的方法。具体步骤包括:在Makefile中添加特定编译标志,编译生成调试文件,运行测试程序并正常退出,使用lcov工具收集覆盖率数据,最后通过genhtml生成HTML格式的覆盖率报告。
518

被折叠的 条评论
为什么被折叠?



