-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add code coverage measurements to test script (#535)
- Loading branch information
Showing
8 changed files
with
99 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
binary-path: ./target/debug/deps/ | ||
branch: true | ||
ignore: | ||
- "../*" | ||
- "/*" | ||
- "mobilecoin/*" | ||
- "target/*" | ||
- "*/e2e_tests/*" | ||
ignore-not-existing: true | ||
output-type: lcov | ||
output-path: ./tests.lcov | ||
source-dir: . |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,7 @@ brew 'cmake' | |
brew 'go' | ||
brew 'llvm' | ||
brew 'protobuf' | ||
brew 'openssl' | ||
brew 'openssl' | ||
|
||
# Test dependencies | ||
brew 'lcov' |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
coverage: | ||
status: | ||
project: | ||
default: false | ||
full-service: | ||
target: auto | ||
paths: "full-service/" | ||
mirror: | ||
target: auto | ||
paths: "mirror/" | ||
validator: | ||
target: auto | ||
paths: "validator/" |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (c) 2018-2020 MobileCoin Inc. | ||
|
||
# RUSTFLAGS="-C instrument-coverage" \ | ||
|
||
set -e | ||
|
||
if [[ ! -z "$1" ]]; then | ||
cd "$1" | ||
fi | ||
|
||
echo "Testing in $PWD" | ||
CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE="../target/profraw/json5format-%m.profraw" \ | ||
SGX_MODE=SW IAS_MODE=DEV CONSENSUS_ENCLAVE_CSS=$(pwd)/consensus-enclave.css \ | ||
cargo test | ||
echo "Testing in $PWD complete." | ||
|
||
echo "Building coverage report (lcov) html to target/coverage/results" | ||
mkdir -p ./target/coverage | ||
grcov . --binary-path ./target/debug/deps/ --source-dir . -t lcov --branch --ignore-not-existing \ | ||
--ignore "../*" --ignore "/*" --ignore "mobilecoin/*" --ignore "target/*" --ignore "*/e2e_tests/*" \ | ||
-o ./target/coverage/tests.lcov | ||
genhtml ./target/coverage/tests.lcov --show-details --prefix "$PWD" --output-directory ./target/coverage/results | ||
|
||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
open ./target/coverage/results/index.html | ||
#elif [[ "$OSTYPE" == "linux-gnu"* ]]; then | ||
# ... | ||
else | ||
echo "test output written to target/coverage/results/index.html" | ||
fi |
This file contains 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