lcov

processes gcov code coverage data

TLDR

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

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.

INSTALL

sudo dnf install lcov
sudo pacman -S lcov
sudo apk add lcov
sudo zypper install lcov
brew install lcov
nix profile install nixpkgs#lcov

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)