问题
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