Skip to content

Test Coverage

Coverage goals, local commands, CI thresholds, and artifact locations for Ferrocat.

Test Coverage

Ferrocat uses coverage reporting to keep regression work visible, especially in the parser, serializer, catalog API, and ICU parser crates. Coverage is not treated as the only quality signal, but it gives maintainers a concrete guardrail for day-to-day changes.

The repository exposes workspace-local Cargo aliases for coverage reporting through cargo-llvm-cov.

The long-term goal for the shipped library surface is:

  • 95%+ line coverage for ferrocat-po
  • 95%+ line coverage for ferrocat-icu
  • 95%+ line coverage for ferrocat once the umbrella crate contains measurable executable logic beyond re-exports

The coverage commands intentionally exclude:

  • ferrocat-bench, which is a benchmark harness rather than shipped library code
  • ferrocat-conformance, which is fixture data and expectations for the upstream snapshot

That keeps the report focused on the public and internal library crates that matter most in day-to-day development:

  • ferrocat
  • ferrocat-po
  • ferrocat-icu

Current Gate

Measured locally on 2026-05-12 with cargo coverage-lcov, a JSON summary export, and the crate-aware gate script:

  • ferrocat-po: 95.08% line coverage
  • ferrocat-icu: 96.00% line coverage
  • ferrocat: N/A in llvm-cov today because the umbrella crate is almost entirely re-exports and does not currently surface measurable executable lines in the report

The CI coverage job enforces these crate-level thresholds:

  • ferrocat-po >= 95%
  • ferrocat-icu >= 95%
  • ferrocat is still reported, but not percentage-gated until llvm-cov has measurable lines for the crate

The next high-yield test targets are:

  • ferrocat-po/src/api/catalog.rs
  • ferrocat-po/src/api/compile.rs
  • ferrocat-po/src/api/audit.rs
  • ferrocat-po/src/merge.rs
  • ferrocat-po/src/borrowed.rs
  • ferrocat-icu/src/parser.rs

Local Setup

Install the required tooling once:

rustup component add llvm-tools-preview
cargo install cargo-llvm-cov

Local Commands

Print a terminal summary:

cargo coverage-summary

Build an HTML report:

cargo coverage

The HTML output is written to:

target/coverage/html/index.html

Generate an LCOV file for external tooling:

cargo coverage-lcov

The LCOV output is written to:

target/lcov.info

CI

The GitHub Actions CI workflow runs a dedicated coverage job on Ubuntu, installs the required LLVM tooling, uploads the generated LCOV report to Codecov, and stores the same lcov.info file as a workflow artifact.

That same job now also exports target/coverage-summary.json and runs a small crate-aware gate script so the 95% thresholds are enforced per crate instead of through one global blended percentage.

For private repositories, add a GitHub Actions repository secret named CODECOV_TOKEN.

For public repositories, tokenless upload may also work with codecov/codecov-action@v5 if token authentication has been disabled in the Codecov organization settings. If you want the least surprising setup, keep the CODECOV_TOKEN secret configured either way.