perl2lcov - Translate Perl coverage data to lcov format.

Manual section:

1

Manual group:

LCOV Tools

NAME

perl2lcov

Translate Perl coverage data from Devel::Cover to lcov format

SYNOPSIS

perl2lcov [--output filename] [--testname name] [options] cover_db+

DESCRIPTION

perl2lcov traverses Perl coverage information in one or more coverage data directories (generated by the Perl Devel::Cover module) and translates it into LCOV .info format.

OPTIONS

In addition to common options supported by other tools in the LCOV suite (e.g., --comment, --version-script, --ignore-error, --substitute, --exclude, etc.), the tool options are:

--output filename, -o filename

The LCOV data will be written to the specified file. If this option is not used, data is written to perlcov.info in the current directory.

--testname name

Coverage info will be associated with the testcase name provided. It is not necessary to provide a name.

See lcov(1) and lcovrc(5) for details of other supported options and configuration settings.

EXAMPLES

Generate Perl coverage data and translate to LCOV format:

# Write Perl line, branch, condition, and subroutine coverage data
# to 'myPerlDB' in the current directory
$ perl -MDevel::Cover=-db,./myPerlDB,-coverage,statement,branch,condition,subroutine,-silent,1 myScript.pl

# OR: write all coverage types that Perl knows about to 'myPerlDB2'
# Note that perl2lcov will ignore types it does not understand
# (pod, time, and path)
$ perl -MDevel::Cover=-db,./myPerlDB2,-silent,1 myScript.pl

# Run 'cover' from the Devel::Cover installation to extract runtime
# data into a usable form. This will also generate an HTML report
# in 'myCoverDB'
$ cover myCoverDB -silent 1

# Run perl2lcov translator to produce LCOV format data:
$ perl2lcov -o perldata.info [--testname myTestName] myCoverDB

# Generate an HTML coverage report:
$ genhtml -o html_report perldata.info

NOTES

The data generated by Devel::Cover is not always internally consistent. For example:

  • Some functions which are never called do not appear in the coverage data.

  • Sometimes a line will appear to be executed (non-zero hit count) but none of its contained branch expressions have been evaluated. (If the line was executed, then at least one branch condition must have been evaluated.)

This can cause the various tools in the LCOV package to generate errors of type inconsistent.

In that case, you can:

  • Skip consistency checks entirely: see the skip_consistency_checks section in lcovrc(5).

  • Ignore the error: see the --ignore-error section in genhtml(1).

  • Exclude the offending code: see the --exclude, --filter, and --omit-lines sections in genhtml(1).

AUTHOR

Henry Cox <henry.cox@mediatek.com>

SEE ALSO

lcov(1), genhtml(1), lcovrc(5)

  • Devel::Cover module documentation

https://metacpan.org/pod/Devel::Cover