Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Download grcov binary instead of building it.
Browse files Browse the repository at this point in the history
  • Loading branch information
nullbitx8 committed Oct 26, 2023
1 parent 62bd381 commit c800142
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,23 @@ build:
maturin develop

test:
# install dependencies
rustup component add llvm-tools-preview
cargo install grcov

# clean test coverage directory
rm -rf ./target/test_coverage
mkdir -p ./target/test_coverage

# install dependencies
rustup component add llvm-tools-preview
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.10/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "./target/test_coverage"
chmod +x ./target/test_coverage/grcov

# run tests
CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='target/test_coverage/profraw/cargo-test-%p-%m.profraw' cargo test --verbose

# generate html coverage report
grcov . --binary-path ./target/debug/deps/ -s . -t html --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/test_coverage/html
./target/test_coverage/grcov . --binary-path ./target/debug/deps/ -s . -t html --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/test_coverage/html

# generate lcov coverage report
grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/test_coverage/tests.lcov
./target/test_coverage/grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/test_coverage/tests.lcov


.PHONY: precommit build test

0 comments on commit c800142

Please sign in to comment.