mirror of
https://github.com/ankitects/anki.git
synced 2026-06-10 07:22:47 -04:00
Rust coverage previously invoked cargo-llvm-cov's default test runner directly, while normal Rust tests run through cargo nextest via ninja check:rust_test. That created a gap where coverage could use different execution semantics and timing than the test path developers and CI rely on. Install the same pinned cargo-nextest binary into out/bin when coverage needs it, put that directory on PATH for cargo-llvm-cov's nextest integration, and pass through the same nextest reporter flags used by the normal Rust test target. This keeps coverage behavior aligned across Unix and Windows launchers while preserving the existing cargo-llvm-cov report generation.
22 lines
835 B
Bash
Executable File
22 lines
835 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
html="$1"
|
|
|
|
outdir="out/coverage/rust"
|
|
LLVMCOVPATH="out/bin"
|
|
|
|
mkdir -p $outdir $LLVMCOVPATH
|
|
test -x $LLVMCOVPATH/cargo-llvm-cov || cargo install cargo-llvm-cov --version 0.8.4 --locked --root out
|
|
test -x $LLVMCOVPATH/cargo-nextest || cargo install cargo-nextest --version 0.9.99 --locked --no-default-features --features default-no-update --root out
|
|
export PATH="$LLVMCOVPATH:$PATH"
|
|
ANKI_TEST_MODE=1 $LLVMCOVPATH/cargo-llvm-cov llvm-cov nextest --workspace --locked --json --summary-only \
|
|
--output-path $outdir/coverage-summary.json --fail-under-lines 60 \
|
|
--color=always --failure-output=final --status-level=none
|
|
|
|
if [ "$html" = "--html" ]; then
|
|
ANKI_TEST_MODE=1 $LLVMCOVPATH/cargo-llvm-cov llvm-cov report --html --output-dir $outdir/html
|
|
echo "Rust coverage report: $outdir/html/index.html"
|
|
fi
|