Skip to main content

Module coverage

Module coverage 

Source
Expand description

The coverage phase: an instrumented test run rendered into web/static/doc/coverage.

Only the workspace’s crates are instrumented (see wrapper), so wasmtime and cranelift run at full speed and leave no profiles to merge or export.

grcov can read the raw profiles itself, but it then holds every binary’s results at once and runs one llvm-cov per CPU — about 13 GiB for this workspace, enough to OOM-kill the job on an 8 GiB CI node. So the profiles are merged here, each test executable and binary is exported to lcov on its own, a few at a time, and grcov only renders. Exporting per object keeps grcov’s numbers: one export over every object discards the counters of functions compiled differently in different binaries.

Unlike grcov, which skips an object llvm-cov cannot export, a failed export fails the phase: every exported object carries a real coverage map, so a failure means a broken build, and a quietly lower percentage would hide it.

Modules§

elf 🔒
Reading the section table of an ELF object, to tell instrumented ones from the rest.
export 🔒
Exporting each instrumented object to lcov, several at a time, keeping only the workspace’s own source records.
objects 🔒
Finding the objects whose coverage is exported: the test executables and binaries of the workspace, each exactly once.
wrapper
The RUSTC_WRAPPER of the instrumented build.

Constants§

DEBUG_LEVEL 🔒
Coverage mapping needs only line tables, and full debuginfo made the instrumented build and its test binaries much larger.
INSTRUMENTED_RUSTFLAGS 🔒
Runtime checks of every anodized #[spec]; the macros read it when they compile, so it must reach every crate, not just the instrumented ones.
LCOV_DIR 🔒
NEXTEST_ARGS 🔒
PROFDATA 🔒
PROFRAW_DIR 🔒
TARGET_DIR 🔒

Functions§

instrumented_env 🔒
instrumented_test_run 🔒
llvm_bin 🔒
llvm-tools installs its binaries beside the host target’s libdir.
llvm_bin_for 🔒
merge_profiles 🔒
profile_pattern 🔒
render_html 🔒
require_llvm_tools 🔒
run_coverage
Instrumented test run, then the HTML report.