首页 > 代码库 > LCOV 如何过滤iostream等系统函数的覆盖率信息
LCOV 如何过滤iostream等系统函数的覆盖率信息
最近在做cppunit test相关工作,用gcov和lcov工具来查看每行代码的覆盖率,个人感觉lcov真棒,看起来很舒服,点起来也很爽!~~
闲聊至此,如题:
我使用的是lcov的 --remove命令
Remove / filter out remaining unwanted stuff from tracefile
Now we can remove the (remaining) stuff that we aren‘t interested in from the tracefile.
lcov --remove /tmp/libreoffice_total.info ‘/usr/include/*‘ ‘/usr/lib/*‘ ‘/usr/local/src/libreoffice/*/UnpackedTarball/*‘ ‘/usr/local/src/libreoffice/workdir/*‘ ‘/usr/local/src/libreoffice/instdir/*‘ ‘/usr/local/src/libreoffice/external/*‘ -o /tmp/libreoffice_filtered.info
/usr/include/*和/usr/lib/*这两个路径加上就可以过滤掉那些系统函数的覆盖信息了(iostream等),如果想过滤其他路径,那就自己加吧!~~
PS: 手册中说--extract命令貌似也可以,不过我没试。
-e tracefile pattern --extract tracefile pattern Extract data from tracefile. Use this switch if you want to extract coverage data for only a particular set of files from a tracefile. Additional command line parameters will be interpreted as shell wildcard patterns (note that they may need to be escaped accordingly to prevent the shell from expanding them first). Every file entry in tracefile which matches at least one of those patterns will be extracted.
参考链接:https://wiki.documentfoundation.org/Development/Lcov#patch_.27geninfo.27
lcov manual:http://ltp.sourceforge.net/coverage/lcov/lcov.1.php
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。