LCOV 如何過濾iostream等系統函數的覆蓋率資訊

來源:互聯網
上載者:User

標籤: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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.