The cargo tests put web.rs at 17% and daemon.rs at 10%, because the browser suite, which drives the API, ran a daemon nobody measured. `sh scripts/coverage.sh api` builds an instrumented ipx and ipx-directory in the capped coverage container and runs the browser suite here against them (IPX_API_COVERAGE): web.rs is at 80% and daemon.rs at 77%. What it does not reach: access.rs (Cloudflare Access, 0%; its unit tests 73%) and the directory's public pages (site.rs, 4%). The coverage image is Ubuntu 24.04 now, as code-server is: built on Debian trixie, the binaries needed glibc 2.41 and code-server has 2.39. In that mode the suite starts those binaries rather than building its own, its tests' `ipx` commands too (global-setup's IPX_BIN), passes LLVM_PROFILE_FILE to both servers, and stops them with SIGTERM, since an instrumented binary writes its profile as it exits and Playwright otherwise kills them outright. Reports go to target/coverage/cargo, api and page. Each run ends with scripts/coverage-metrics.ts, which writes every suite's lines covered and in all, by crate, to node-exporter's textfile directory; the monitoring project's node-exporter now reads it (one flag, its compose file backed up beside it), so Prometheus keeps them as ipx_coverage_lines, and the iPX dashboard's Coverage row draws them: each suite now, over time, and by part. The cargo tests' totals hold their own code, which runs whole, so they read higher than the code alone; the panels say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
1.7 KiB
Docker
24 lines
1.7 KiB
Docker
# What scripts/coverage.sh runs the Rust tests in, to see which lines they reach (#390): the
|
|
# toolchain, LLVM's coverage tools and cargo-llvm-cov. No source: coverage.sh mounts the tree.
|
|
# Built and pushed like the services, by scripts/build-image.sh coverage, under its caps.
|
|
#
|
|
# Ubuntu 24.04, as code-server is (#394): `coverage.sh api` builds an instrumented ipx and
|
|
# ipx-directory here, under the cap, and the browser suite runs them in code-server, which a
|
|
# binary linked against Debian trixie's newer glibc (2.41 to Ubuntu's 2.39) would not start in.
|
|
# The same Rust as the tests are built with elsewhere: a newer one would rebuild everything with
|
|
# its own flags for nothing.
|
|
FROM ubuntu:24.04
|
|
ENV RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo PATH=/usr/local/cargo/bin:$PATH
|
|
# cc for rusqlite's bundled SQLite and librqbit, as Dockerfile's builder; ffmpeg for DeadAir's
|
|
# tests, as the image ipx runs in; curl and certificates to fetch rustup.
|
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
|
build-essential ca-certificates curl ffmpeg \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.98.1 --no-modify-path \
|
|
&& rustup component add llvm-tools-preview
|
|
# cargo-llvm-cov's own build, as its README gives it, rather than compiling it here.
|
|
ADD https://github.com/taiki-e/cargo-llvm-cov/releases/latest/download/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz /tmp/llvm-cov.tar.gz
|
|
RUN tar -xzf /tmp/llvm-cov.tar.gz -C /usr/local/cargo/bin && rm /tmp/llvm-cov.tar.gz \
|
|
&& cargo llvm-cov --version && rustc --version
|
|
WORKDIR /work
|