標籤:style class c tar ext http
最近在做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