Expand description
The coverage phase: an instrumented test run rendered into
web/static/doc/coverage.
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 single-threaded, each instrumented object is exported to lcov
on its own, 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.
StructsΒ§
- Section
Table π - Where an ELF64 little-endian object keeps its section headers.
ConstantsΒ§
- COVMAP_
SECTION π - The section every instrumented object carries.
- ELF_
HEADER_ πLEN - ELF_
IDENT π - ELF magic, 64-bit class, little-endian data: the only objects CI builds.
- E_
SHENTSIZE π - E_SHNUM π
- E_SHOFF π
- E_
SHSTRNDX π - LCOV_
DIR π - MAX_
TABLE_ πLEN - Real section and name tables are kilobytes; anything past this is corrupt.
- PROFDATA π
- PROFRAW_
DIR π - SHN_
XINDEX π - The name-table index an object with extended numbering stores in section 0.
- SH_LINK π
- SH_NAME π
- SH_
OFFSET π - SH_SIZE π
- TARGET_
DIR π
FunctionsΒ§
- collect_
objects π - copy_
workspace_ πrecords - Copies only the records of sources under
root, with their paths made relative. The report ignores every absolute path anyway, and dropping the registry and toolchain records here keeps gigabytes of lcov off the disk. Returns how many records were kept. - elf_
has_ πsection - Looks the name up in the ELF section table. Matching it anywhere in the file also accepts binaries that merely contain the string β xtask itself among them β and llvm-cov refuses to export those.
- export_
object π - Returns how many workspace source records were kept.
- export_
objects π - fill π
falsewhen the file ends first: a truncated file is not an object.- has_
coverage_ πmap - instrumented_
objects π - instrumented_
test_ πrun - is_
candidate π - Executables (tests, binaries, build scripts) and shared objects (proc macros, which run inside rustc) are what carry coverage maps.
- le_
bytes π - llvm_
bin π llvm-toolsinstalls its binaries beside the host targetβs libdir.- llvm_
bin_ πfor - merge_
profiles π - One thread: the default of one per CPU took 3 GiB for this merge, one thread takes 250 MiB.
- read_
region π - Reads
lenbytes atoffset;Nonewhen the region is implausibly large or runs past the end of the file. - render_
html π - require_
llvm_ πtools - resolve_
extended π - With 0xff00 or more sections the headerβs count is 0 and its name index is
SHN_XINDEX; the real values live in section 0βs
sh_sizeandsh_link. - run_
coverage - Instrumented test run, then the HTML report.
- section_
name π