fastcov

raw JSON →
1.16 verified Fri May 01 auth: no python

fastcov is a massively parallel gcov wrapper for generating intermediate coverage formats (like lcov info) quickly. It processes .gcda/.gcno files in parallel using subprocesses and hashes source files to avoid re-processing. Current version is 1.16, requires Python >=3.5, and is maintained on GitHub.

pip install fastcov
error fastcov: error: unrecognized arguments: --branch-coverage
cause Older versions of fastcov did not support `--branch-coverage`; it was added later.
fix
Use --branch instead (alias) or upgrade fastcov to >=1.10.
error AttributeError: module 'fastcov' has no attribute 'main'
cause Trying to call `fastcov.main()` directly but the module is not designed that way; fastcov is intended to be run as a CLI tool.
fix
Use subprocess to invoke fastcov or import the internal modules directly (not recommended).
error KeyError: 'source_files'
cause Parsing fastcov's internal JSON output format yourself; the format changed in v1.5 to support test names.
fix
Use the lcov info output (--lcov -o output.info) or rely on the official fastcov JSON schema (if you must).
breaking Exit codes shifted in v1.7 to start at 3 (codes 1-2 reserved for shells). If you rely on exit codes, update your checks.
fix Check for exit codes 3+ for failures, or use `--version` to detect version.
deprecated gcov shortform flags like `-i` (for intermediate format) may cause issues with GCC 11+. fastcov 1.14+ uses longform flags, but older versions might break.
fix Upgrade to >=1.14 or set GCOV_PREFIX to include longform flags: `--gcov gcov --stdout --long-filename --preserve-paths`.
gotcha Using `--zerocounters` with `--process-gcno` simultaneously can delete .gcno files (fixed in v1.14). Always verify you have backups.
fix Upgrade to >=1.14, or avoid combining those flags.
gotcha If gcov crashes or is killed, fastcov may hang forever (fixed in v1.11). For older versions, set a timeout on the subprocess call.
fix Upgrade to >=1.11 or wrap subprocess with timeout.

Run fastcov as a subprocess to generate lcov info output with branch coverage, excluding test files.

import subprocess
subprocess.run(['fastcov', '--gcov', 'gcov', '--lcov', '-o', 'coverage.info', '--exclude', 'test', '--branch-coverage'], check=True)