Skip to content

feat: add Rust test coverage#4842

Merged
fernandolins merged 13 commits into
mainfrom
feat/rust-test-coverage-4839
May 18, 2026
Merged

feat: add Rust test coverage#4842
fernandolins merged 13 commits into
mainfrom
feat/rust-test-coverage-4839

Conversation

@fernandolins
Copy link
Copy Markdown
Contributor

Linked issue

Closes #4839

Summary / motivation

Adds cargo-llvm-cov-based test coverage for the full Rust workspace. Introduces just test-rust --coverage and just test-rust --coverage --html, and wires Rust into the just test --coverage umbrella.

cargo-llvm-cov is installed on demand into out/bin/ to avoid polluting the global cargo install. The llvm-tools-preview rustup component is now installed in CI so the tool can instrument binaries.

How to test (required)

# Existing behavior unchanged
just test-rust

# Terminal summary
just test-rust --coverage

# Terminal summary + HTML report under out/coverage/rust/html/
just test-rust --coverage --html

# Umbrella (Rust + Python)
just test --coverage
just test --coverage --html

Note: first run of --coverage will install cargo-llvm-cov into
out/bin/ (~30s). Subsequent runs skip the install step.

Checklist

  • I ran ./ninja check or an equivalent relevant check locally.

Details

  • cargo-llvm-cov pinned at 0.8.4, installed into out/bin/ via cargo install --root out.
  • --workspace --locked measures all crates and respects the lockfile.
  • llvm-tools-preview added to setup-anki action so CI can instrument Rust binaries.
  • Coverage runs are slower than plain just test-rust because cargo-llvm-cov rebuilds with instrumentation — this is expected.

Before / after behavior

Before: no just test-rust, no Rust coverage support.

After: just test-rust runs Rust tests via ninja; just test-rust --coverage runs them with cargo-llvm-cov

@fernandolins fernandolins changed the title Feat/rust test coverage 4839 Feat/rust test coverage May 14, 2026
@fernandolins fernandolins changed the title Feat/rust test coverage fest: add Rust test coverage May 14, 2026
@fernandolins fernandolins changed the title fest: add Rust test coverage feat: add Rust test coverage May 14, 2026
@fernandolins fernandolins force-pushed the feat/rust-test-coverage-4839 branch from 0b7db14 to 2bff590 Compare May 15, 2026 13:17
Copy link
Copy Markdown
Collaborator

@abdnh abdnh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Windows support (see my commit in the Python PR).

Copy link
Copy Markdown
Contributor Author

@abdnh I saw it. I'm working into it! Thanks!

fernandolins and others added 10 commits May 15, 2026 21:28
Add just test-py with --coverage and --html flag support, backed by
coverage.py. Runs pylib and qt test suites separately, writes data to
out/coverage/, and enforces minimum line thresholds (65% pylib, 20% qt).

Closes #4838
Update just test to accept --coverage and --html, delegating to a new
coverage recipe. Currently covers Python only.
Add just test-rust with --coverage and --html flag support, backed by
cargo-llvm-cov. Installs the tool on demand into out/bin/ to avoid
polluting the global cargo install.
Install llvm-tools-preview in CI so cargo-llvm-cov can instrument
binaries. Extend the coverage umbrella to run Rust coverage ahead
of Python.
…rust

Extract cargo-llvm-cov invocation into tools/coverage-rust (bash) and
tools/coverage-rust.bat (Windows), mirroring the tools/coverage-py
pattern. Simplifies _coverage-rust in the justfile.
cargo-llvm-cov's llvm-profdata uses the host toolchain, which cannot
merge profraw files produced on aarch64-pc-windows-msvc. Refs:
rust-lang/rust#150123, taiki-e/cargo-llvm-cov#436.
@fernandolins fernandolins force-pushed the feat/rust-test-coverage-4839 branch from 173f712 to ace294a Compare May 16, 2026 00:30
@fernandolins fernandolins force-pushed the feat/python-test-coverage-4838 branch from d422c9e to 37186c6 Compare May 16, 2026 00:30
Base automatically changed from feat/python-test-coverage-4838 to main May 16, 2026 00:34
@fernandolins
Copy link
Copy Markdown
Contributor Author

@abdnh I added the windows support!

@fernandolins fernandolins requested a review from abdnh May 18, 2026 14:21
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented May 18, 2026

Documentation build overview

📚 Anki | 🛠️ Build #32738953 | 📁 Comparing 8d0209f against latest (cc1605a)

  🔍 Preview build  

2 files changed
± genindex.html
± autoapi/aqt/import_export/exporting/index.html

@fernandolins fernandolins merged commit f76fcec into main May 18, 2026
6 checks passed
@fernandolins fernandolins deleted the feat/rust-test-coverage-4839 branch May 18, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add Rust test coverage

2 participants