Created
January 24, 2020 08:58
-
-
Save jmjoy/90f29dfdd3e991b1f9fb78c22873d627 to your computer and use it in GitHub Desktop.
Rust related scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Rust: Generate the test coverage html files and open it in explorer. | |
| set -xe | |
| OUTPUT_DIR=/tmp/<YOUR_CRATE_NAME> | |
| FIND_PREFIX=<YOUR_CRATE_NAME> | |
| CARGO_INCREMENTAL=0 RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads" cargo +nightly test | |
| mkdir -p ${OUTPUT_DIR} | |
| zip -0 ${OUTPUT_DIR}/ccov.zip `find . \( -name "$FIND_PREFIX*.gc*" \) -print` | |
| grcov ${OUTPUT_DIR}/ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore "/*" -o ${OUTPUT_DIR}/lcov.info | |
| genhtml -o ${OUTPUT_DIR}/report/ --show-details --highlight --ignore-errors source --legend ${OUTPUT_DIR}/lcov.info | |
| xdg-open ${OUTPUT_DIR}/report/index.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment