45 lines
1.3 KiB
Bash
Executable File
45 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
rm -rf target
|
|
|
|
mkdir -p target/test-report
|
|
|
|
export RUSTFLAGS="-Cinstrument-coverage"
|
|
export LLVM_PROFILE_FILE="target/coverage/prof/%p-%m.profraw"
|
|
|
|
rustup override set nightly
|
|
|
|
echo "Running tests..."
|
|
cargo test --all-features --release --no-fail-fast -- -Z unstable-options --report-time --format json | tee target/test-report/test-report.json
|
|
|
|
echo "Generating test report..."
|
|
markdown-test-report target/test-report/test-report.json --output target/test-report/test-report.md
|
|
echo "Generating test report HTML..."
|
|
pandoc target/test-report/test-report.md -o target/test-report/test-report.html
|
|
|
|
# rustup override set stable
|
|
|
|
echo "Removing unused profraw files..."
|
|
for file in target/coverage/prof/*.profraw; do
|
|
~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata show "$file" 1>/dev/null 2>/dev/null || rm -f "$file"
|
|
done
|
|
|
|
echo "Generating coverage report..."
|
|
grcov \
|
|
--source-dir . \
|
|
--binary-path ./target/release/deps/ \
|
|
--excl-start 'mod test* \{' \
|
|
--ignore 'tests/*' \
|
|
--ignore "*test.rs" \
|
|
--ignore "*tests.rs" \
|
|
--ignore "*github.com*" \
|
|
--ignore "*libcore*" \
|
|
--ignore "*rustc*" \
|
|
--ignore "*liballoc*" \
|
|
--ignore "*cargo*" \
|
|
-t html \
|
|
-o ./target/coverage/html \
|
|
target/coverage/prof
|
|
|
|
rustup override set nightly
|