关于gcov获取代码覆盖率的问题
各位好:
我现在做的项目是Linux下的C\C++项目,现在想在其中添加获取自动测试的覆盖率信息;我在编译和连接时添加了-fprofile-arcs -ftest-coverage选项,并且也生产了.gcno文件。但是,我运行自动测试程序后,只有一个目录下生成了.gcda文件。其他的都没有生产;有没有知道为什么的,能否指教指教;
还有用LCOV工具收集覆盖率信息时,包括了像iostream这样的系统提供的函数的覆盖率信息,能否将它删除,要怎么做??
希望大家能够多多指教,非常感谢!
[解决办法]
How to do gcov and lcov code coverage
To enable collection of coverage information the following GCC options
are used to compile code:
-g -fprofile-arcs -ftest-coverage
Re: gcc, gcov and STL
If you use the lcov (http://ltp.sourceforge.net/coverage/lcov.php)
backend, then "man lcov" says "--extract tracefile pattern:
Extract data from tracefile.