Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code coverage tooling #448

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ Cargo.lock
Session.vim

.env

# grcov outputs
*.profraw
20 changes: 20 additions & 0 deletions server/run-tests-with-grcov.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh -e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the -e needed here?


# cleanly run the following commands in their own session
bash -c "
# tell Rust to run with coverage instrumentation
RUSTFLAGS="-Cinstrument-coverage"
# give grcov a profile name template for output files
LLVM_PROFILE_FILE="svix-webhooks-%p-%m.profraw"
# put the compiler in nightly mode
RUSTC_BOOTSTRAP=1
svix-dylan marked this conversation as resolved.
Show resolved Hide resolved

# run tests
./run-tests.sh
" || true

# generate and open report output
grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage/

LOCATION="coverage HTML file at $(pwd)/target/debug/coverage/index.html"
echo "$LOCATION"
svix-dylan marked this conversation as resolved.
Show resolved Hide resolved