Closed LongXiangGuo closed 1 year ago
When processing LCOV coverage files, make sure that each invocation of lcov
/geninfo
/genhtml
is configured to keep branch coverage data. Otherwise it will be removed.
The easiest way to achieve this is by creating an lcovrc
file in either ~/.lcovrc
or /etc/lcovrc
with the following contents:
$ cat ~/.lcovrc
branch_coverage=1
Alternatively you need to specify --branch-coverage
on all invocations of lcov
. Also multiple remove patterns can be given to lcov
by simply listing them on the command line. For your example, the following should work:
$ lcov --branch-coverage --remove coverage/lcov.info '**/models/*.dart' '*_constants.dart' '*_wrapper.dart' '*.g.dart' -o coverage/lcov.info --ignore-errors=unused,empty
Thanks, I didn't realize that all the commands related to LCOV need to be tried with --branch-coverage
.
Thanks, I didn't realize that all the commands related to LCOV need to be tried with
--branch-coverage
.
Should say so in the man pages. I'll check and see if this is clear - though I suspect that it is not, as your problem seems to be a fairly common one.
Henry
I forgot to add to Peter's comment:
The easiest way to achieve this is by creating an lcovrc file in either ~/.lcovrc or /etc/lcovrc
If you always want to ignore 'unused' and 'empty' error categories, then you can add those directives to your lcovrc file as well. man page describes the syntax.
There is no man. page for lcov No manual entry for lcov for Mac OS 13.3.1 (a) (22E772610a)
man lcov
No manual entry for lcov
That sounds like an install issue. There are definitely man pages for the various lcov components. Where is your lcov script found, and what is your MANPATH?
$ which lcov $ echo $MANPATH
The other question is where you got your lcov version and how you installed it.
Thanks, I see, the lcov locate in the lcov git repo, refer to the master for the latest fix , and the $MAINPATH is not set locally, because I did't use run the make install command in the git repo, just export the bin path. After local installed the main page displayed.
ENV: Flutter version 3.7.12 LCOV version 2.1-beta
Expected result:
When remove the special file patterns from the generated lcvo.info, the branch coverage could generated by the
lcov --branch-coverage --summary
command. test data: coverage.zipActual Result:
Branch coverage could not generated by the
lcov --branch-coverage --summary
command when remove the special file patterns.When remove the special file patterns from the lcov.info, could not summary the branch coverage from the lcov.info
Attempting alternative solutions
The subcommand
--exclude PATTERN
oflcov
andgenhtml
only support single file pattens, how to exclude those file patterns with thelcov|genhtml --exclude
command? I have tried use the|
to connect them but it failed.