LCOV to exclude entire packages from code coverage analysis

回眸只為那壹抹淺笑 提交于 2019-12-11 04:43:39

问题


I'm using LCOV as my graphical means of code coverage to tell me how much of my code I've tested, however it's including folders of code which I do not care about and it's making my coverage lower than it should actually be.

Is there a way exclude entire directories where I can ignore a bunch of cpp files which I don't care about? I know about --remove but this doesn't seem to work for this purpose. I want to exclude all folders following this pattern:

Src/GeneralSubSystems/GA/ except for Iterators

Here is the directories I want to ignore

**Src/GeneralSubSystems/GA/Iterators**  I want to include this but exclude everything else
Src/GeneralSubSystems/GA/Converters 
Src/GeneralSubSystems/GA/Utils  
Src/GeneralSubSystems/GA/Models 
Src/GeneralSubSystems/GA/Collapse   
Src/GeneralSubSystems/GA/Interview  
Src/GeneralSubSystems/GA/Misc1  
Src/GeneralSubSystems/GA/Misc2
Src/GeneralSubSystems/GA/Misc3
Src/GeneralSubSystems/GA/Misc4
Src/GeneralSubSystems/GA/Misc5

Here is my current usage:

lcov --gcov-tool /usr/bin/gcov --capture --no-checksum --directory /jenkins/workspace/TCONVENGINE-INSTRUMENTED-BUILD/TCONV/Main/targs/Src --directory /jenkins/workspace/TCONVENGINE-INSTRUMENTED-BUILD/TCONV/Main/targs/Component --output-file ${WORKSPACE}/tps_coverage.info

lcov --remove ${WORKSPACE}/tconv_coverage.info '*/ThrdPrty/*' '*/Src/Low/*' '*/Src/TCCP-C/*' '*/Src/Tool/*' '*/zinAttInterviewDisassembler.*' '/usr/*' -o ${WORKSPACE}/tconv_coverage.info

genhtml --prefix /jenkins/workspace/TCONVENGINE-INSTRUMENTED-BUILD/TCONV/Main --title "TCONV Engine Coverage Analysis" --output-directory ${WORKSPACE}/lcov --num-spaces 3 ${WORKSPACE}/tps_coverage.info

Any help or assistance would be much appreciated, thanks in advance everyone


回答1:


It might help to add two backslashes before * in the remove list. E.g. instead of

'Src/GeneralSubSystems/GA/Utils/*'

use

'Src/GeneralSubSystems/GA/Utils/\\*'


来源:https://stackoverflow.com/questions/39858691/lcov-to-exclude-entire-packages-from-code-coverage-analysis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!