-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update code coverage approach (#5540)
Changing out the grcov approach with cargo-llvm-cov which is supposed to be much quicker. Allows us to easily run code coverage from command line: ``` ./scripts/source_coverage.sh ``` or in CI. We can easily manage the crates that are included by editing the `ignored_crates` array. In this PR only a small subset of crates are included. This is to check that everything is working. A follow up will add more crates to the coverage tests. Breaking Changes --- - [x] None - [ ] Requires data directory on base node to be deleted - [ ] Requires hard fork - [ ] Other - Please specify <!-- Does this include a breaking change? If so, include this line as a footer --> <!-- BREAKING CHANGE: Description what the user should do, e.g. delete a database, resync the chain -->
- Loading branch information
Showing
4 changed files
with
82 additions
and
33 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
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
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,70 @@ | ||
#!/bin/bash | ||
|
||
# When running in GHA, use lcov format | ||
if [[ "$CI" == "true" ]]; then | ||
output_opts="--lcov --output-path lcov.info" | ||
else | ||
export LLVM_COV_FLAGS="-coverage-watermark=90,66" | ||
output_opts="--html" | ||
fi | ||
|
||
ignored_crates=( | ||
deps_only | ||
tari_app_grpc | ||
tari_app_utilities | ||
tari_base_node | ||
tari_base_node_grpc_client | ||
tari_chat_client | ||
tari_chat_ffi | ||
tari_common_sqlite | ||
tari_common_types | ||
tari_comms | ||
tari_comms_dht | ||
tari_comms_rpc_macros | ||
tari_console_wallet | ||
tari_contacts | ||
tari_features | ||
tari_integration_tests | ||
tari_libtor | ||
tari_merge_mining_proxy | ||
tari_metrics | ||
tari_miner | ||
tari_mining_helper_ffi | ||
tari_p2p | ||
tari_service_framework | ||
tari_test_utils | ||
tari_wallet_ffi | ||
tari_wallet_grpc_client | ||
tari_common | ||
tari_comms | ||
tari_core | ||
tari_storage | ||
tari_wallet | ||
) | ||
|
||
echo "Check for cargo-llvm-cov" | ||
if [ "$(cargo llvm-cov --version)" ] | ||
then | ||
echo " + Already installed" | ||
else | ||
echo " + Installing.." | ||
cargo install cargo-llvm-cov | ||
fi | ||
|
||
echo "Source coverage environment parameters:" | ||
echo $(cargo llvm-cov show-env) | ||
echo "Output parameters: $output_opts" | ||
|
||
echo "Deleting old coverage files" | ||
cargo llvm-cov clean --workspace | ||
|
||
echo "Starting code coverage run" | ||
cargo llvm-cov test \ | ||
--all-features \ | ||
--verbose \ | ||
--workspace \ | ||
--ignore-run-fail \ | ||
--color auto \ | ||
${output_opts} \ | ||
${ignored_crates[@]/#/--exclude } \ | ||
|