]> Untitled Git - bdk/commitdiff
Merge bitcoindevkit/bdk#1986: ci: replace grcov by cargo-llvm-cov
authormerge-script <valuedmammal@protonmail.com>
Tue, 29 Jul 2025 23:51:06 +0000 (19:51 -0400)
committermerge-script <valuedmammal@protonmail.com>
Tue, 29 Jul 2025 23:51:06 +0000 (19:51 -0400)
066c4cd160f6d4c70409b299a173f31f93728fae ci: replace grcov by cargo-llvm-cov (nymius)

Pull request description:

  ### Description

  As explained in #1984 , I discovered some misreportings in the coverage information given by grcov.

  Fixes #1984

  ### Notes to the reviewers

  The discussion about the tool to use is open, but I'm adding this PR to showcase how a change from `grcov` to `cargo-llvm-cov` would look like and the improvements in reporting this change will bring. [Look the report in `coveralls`](https://coveralls.io/github/nymius/bdk?branch=ci/replace-grcov-by-cargo-llvm-cov) to get a better perspective of them.

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo +nightly fmt` and `cargo clippy` before committing

ACKs for top commit:
  ValuedMammal:
    ACK 066c4cd160f6d4c70409b299a173f31f93728fae
  oleonardolima:
    ACK 066c4cd160f6d4c70409b299a173f31f93728fae

Tree-SHA512: d237fcc36efb6a4d3ccfaa371c2c70fc18ee40b48ca48f1230c5df6dca093f57bc1096927ddb15f9cae59a4640d9e34bf3ef1a309037e21fe0e8348e132bf38d

1  2 
crates/bitcoind_rpc/src/lib.rs
crates/electrum/src/bdk_electrum_client.rs

index f516be6cacf05e3f6c236e52650beabaa871c091,8ab3a44826796299fb120956b5e115b525590581..eb58018e93c1239dd912eba34a0ae59292f0eea8
@@@ -7,14 -7,9 +7,15 @@@
  //! To only get block updates (exclude mempool transactions), the caller can use
  //! [`Emitter::next_block`] until it returns `Ok(None)` (which means the chain tip is reached). A
  //! separate method, [`Emitter::mempool`] can be used to emit the whole mempool.
+ #![cfg_attr(coverage_nightly, feature(coverage_attribute))]
  #![warn(missing_docs)]
  
 +#[allow(unused_imports)]
 +#[macro_use]
 +extern crate alloc;
 +
 +use alloc::sync::Arc;
 +use bdk_core::collections::{HashMap, HashSet};
  use bdk_core::{BlockId, CheckPoint};
  use bitcoin::{Block, BlockHash, Transaction, Txid};
  use bitcoincore_rpc::{bitcoincore_rpc_json, RpcApi};
@@@ -399,8 -445,9 +400,9 @@@ impl BitcoindRpcErrorExt for bitcoincor
  }
  
  #[cfg(test)]
+ #[cfg_attr(coverage_nightly, coverage(off))]
  mod test {
 -    use crate::{bitcoincore_rpc::RpcApi, Emitter, NO_EXPECTED_MEMPOOL_TXIDS};
 +    use crate::{bitcoincore_rpc::RpcApi, Emitter, NO_EXPECTED_MEMPOOL_TXS};
      use bdk_chain::local_chain::LocalChain;
      use bdk_testenv::{anyhow, TestEnv};
      use bitcoin::{hashes::Hash, Address, Amount, ScriptBuf, Txid, WScriptHash};
index d277c6f734f5dd77d2152ca5c62c0f3328aee4e9,8358cae830729236b0e45c36c49f1cba1a0dd631..6c87e3f1a8da62fb5e5e5658f67e5e990836880a
@@@ -688,13 -685,12 +688,14 @@@ fn chain_update
  }
  
  #[cfg(test)]
+ #[cfg_attr(coverage_nightly, coverage(off))]
  mod test {
      use crate::{bdk_electrum_client::TxUpdate, BdkElectrumClient};
 -    use bdk_chain::bitcoin::{OutPoint, Transaction, TxIn};
 -    use bdk_core::collections::BTreeMap;
 -    use bdk_testenv::{utils::new_tx, TestEnv};
 +    use bdk_chain::bitcoin::{constants, Network, OutPoint, ScriptBuf, Transaction, TxIn};
 +    use bdk_chain::{BlockId, CheckPoint};
 +    use bdk_core::{collections::BTreeMap, spk_client::SyncRequest};
 +    use bdk_testenv::{anyhow, utils::new_tx, TestEnv};
 +    use electrum_client::Error as ElectrumError;
      use std::sync::Arc;
  
      #[cfg(feature = "default")]