LCOV 如何過濾iostream等系統函數的覆蓋率信息

最近在作cppunit test相關工做,用gcov和lcov工具來查看每行代碼的覆蓋率,我的感受lcov真棒,看起來很舒服,點起來也很爽!~~php

閒聊至此,如題:ios

我使用的是lcov的 --remove命令shell

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命令貌似也能夠,不過我沒試。this

 -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.27spa

lcov manual:http://ltp.sourceforge.net/coverage/lcov/lcov.1.php.net

相關文章
相關標籤/搜索