Skip to content

Instantly share code, notes, and snippets.

@dermoumi
Created November 29, 2020 13:29
Show Gist options
  • Save dermoumi/8f31074204ab1d165c673f400600973f to your computer and use it in GitHub Desktop.
Save dermoumi/8f31074204ab1d165c673f400600973f to your computer and use it in GitHub Desktop.
# Defined in /home/sdrm/.config/fish/functions/covrun.fish @ line 2
function covrun
# Run coverage run for rust project using grcov
set -lx CARGO_INCREMENTAL 0
set -lx RUSTFLAGS "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
set -lx RUSTDOCFLAGS "-Cpanic=abort"
# rm -rf /tmp/covrun-*
set -l tempdir (mktemp -d -t covrun-XXXXXXXXXXXX)
and cargo +nightly test --target-dir "$tempdir" --lib $argv
and grcov "$tempdir/debug/" -s ./src --excl-line '// nocov' --excl-start "// nocov-start" --excl-stop "// nocov-stop" \
-t html --llvm --branch --ignore-not-existing -o "$tempdir/debug/coverage"
and wslview "$tempdir/debug/coverage/index.html"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment