LinuxCommandLibrary

lcov

processes gcov code coverage data

TLDR

Capture coverage data

$ lcov --capture --directory [.] --output-file [coverage.info]
copy
Generate HTML report
$ genhtml [coverage.info] --output-directory [coverage/]
copy
Remove patterns
$ lcov --remove [coverage.info] '*/test/*' -o [filtered.info]
copy
Extract specific files
$ lcov --extract [coverage.info] '*/src/*' -o [src.info]
copy
Combine traces
$ lcov --add-tracefile [a.info] --add-tracefile [b.info] -o [combined.info]
copy
Zero counters
$ lcov --zerocounters --directory [.]
copy

SYNOPSIS

lcov [options]

DESCRIPTION

lcov processes gcov code coverage data. It collects and manipulates coverage information.
The tool generates coverage reports from gcc/gcov data. Use genhtml to create HTML reports.

PARAMETERS

--capture

Capture coverage data.
--directory DIR
Source directory.
--output-file FILE
Output trace file.
--remove FILE PATTERN
Remove matching files.
--extract FILE PATTERN
Extract matching files.
--add-tracefile FILE
Add trace file.
--help
Display help information.

CAVEATS

Requires gcc/gcov. C/C++ focused. Part of LCOV package.

HISTORY

lcov was created for the Linux Test Project to provide graphical code coverage analysis.

SEE ALSO

gcov(1), genhtml(1), gcovr(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard