Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing updates #193

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

mkdir cov

LLVM_PROFILE_FILE="cov/neli-%m.profraw" RUSTFLAGS="-C instrument-coverage" cargo test >/dev/null

cd cov

if [ -z "$1" ]; then
echo "Defaulting to summary"
llvm-profdata merge -sparse neli-*.profraw -o neli.profdata
llvm-cov report \
--object $(RUSTFLAGS="-C instrument-coverage" cargo test \
--tests \
--no-run \
--message-format=json \
| jq -r "select(.profile.test == true) | .filenames[]") \
--instr-profile=neli.profdata \
--summary-only \
--ignore-filename-regex="rustc|.cargo/registry"
elif [ "$1" = "full" ]; then
llvm-profdata merge -sparse neli-*.profraw -o neli.profdata
llvm-cov show \
-Xdemangler=rustfilt \
--show-line-counts-or-regions \
--object $(RUSTFLAGS="-C instrument-coverage" cargo test \
--tests \
--no-run \
--message-format=json \
| jq -r "select(.profile.test == true) | .filenames[]") \
--instr-profile=neli.profdata \
--ignore-filename-regex="rustc|.cargo/registry"
fi

cd - >/dev/null
rm -rf cov