Skip to content

Instantly share code, notes, and snippets.

@dermesser
Last active August 12, 2017 08:08
Show Gist options
  • Save dermesser/7a94229cc6bdfaae070e1ecd04ef6fdb to your computer and use it in GitHub Desktop.
Save dermesser/7a94229cc6bdfaae070e1ecd04ef6fdb to your computer and use it in GitHub Desktop.
generate coverage reports for Rust crates. This needs kcov installed.
#!/bin/bash
KCOV=kcov
KCOV_OPTS="--verify --exclude-pattern=/.cargo"
KCOV_OUT="./kcov-out/"
export RUSTFLAGS="-C link-dead-code"
TEST_BIN=$(cargo test --no-run 2>&1 >/dev/null | awk '/^ Running target\/debug\// { print $2 }')
${KCOV} ${KCOV_OPTS} ${KCOV_OUT} ${TEST_BIN} && xdg-open ${KCOV_OUT}/index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment