Skip to content

Commit 042c484

Browse files
committed
test: skip coverage of the test code itself
1 parent 7a2eba4 commit 042c484

File tree

12 files changed

+31
-4
lines changed

12 files changed

+31
-4
lines changed

.github/workflows/codecov.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ jobs:
2727
- uses: taiki-e/install-action@nextest
2828
- name: Collect coverage data (including doctests)
2929
run: |
30-
cargo +nightly llvm-cov --no-report nextest --workspace --all-features
31-
cargo +nightly llvm-cov --no-report --doc --workspace --all-features
32-
cargo +nightly llvm-cov report --doctests --lcov --output-path lcov.info
30+
RUSTFLAGS="--cfg=coverage_nightly" cargo +nightly llvm-cov --no-report nextest --workspace --all-features
31+
RUSTFLAGS="--cfg=coverage_nightly" cargo +nightly llvm-cov --no-report --doc --workspace --all-features
32+
RUSTFLAGS="--cfg=coverage_nightly" cargo +nightly llvm-cov report --doctests --lcov --output-path lcov.info
3333
- name: Upload coverage data to codecov
3434
uses: codecov/codecov-action@v4
3535
with:

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,6 @@ serde = ["dep:serde", "commit_verify/serde"]
6161

6262
[package.metadata.docs.rs]
6363
features = ["all"]
64+
65+
[lints.rust]
66+
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(coverage_nightly)'] }

commit_verify/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,6 @@ wasm-bindgen-test = "0.3"
5353

5454
[package.metadata.docs.rs]
5555
features = ["all"]
56+
57+
[lints.rust]
58+
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(coverage_nightly)'] }

commit_verify/src/commit.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ where Self: Eq + Sized
8484
/// Helpers for writing test functions working with commit-verify scheme
8585
#[cfg(test)]
8686
pub(crate) mod test_helpers {
87+
#![cfg_attr(coverage_nightly, coverage(off))]
88+
8789
use core::fmt::Debug;
8890
use core::hash::Hash;
8991
use std::collections::HashSet;

commit_verify/src/embed.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ where
197197
#[cfg(test)]
198198
pub(crate) mod test_helpers {
199199
#![allow(missing_docs)]
200+
#![cfg_attr(coverage_nightly, coverage(off))]
200201

201202
use core::fmt::Debug;
202203
use core::hash::Hash;
@@ -305,6 +306,8 @@ pub(crate) mod test_helpers {
305306

306307
#[cfg(test)]
307308
mod test {
309+
#![cfg_attr(coverage_nightly, coverage(off))]
310+
308311
use core::fmt::Debug;
309312

310313
use amplify::confinement::{SmallBlob, SmallVec, U32};

commit_verify/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ mod _reserved {
194194
/// Helpers for writing test functions working with commit schemes
195195
#[cfg(test)]
196196
pub mod test_helpers {
197+
#![cfg_attr(coverage_nightly, coverage(off))]
198+
197199
use amplify::confinement::SmallVec;
198200
use amplify::hex::FromHex;
199201

commit_verify/src/mpc/block.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,8 @@ impl MerkleProof {
765765

766766
#[cfg(test)]
767767
mod test {
768+
#![cfg_attr(coverage_nightly, coverage(off))]
769+
768770
use super::*;
769771
use crate::mpc::tree::test_helpers::{
770772
make_det_messages, make_random_messages, make_random_tree,

commit_verify/src/mpc/test.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#[cfg(test)]
22
mod test {
3+
#![cfg_attr(coverage_nightly, coverage(off))]
4+
35
use std::str::FromStr;
46

57
use super::*;

commit_verify/src/mpc/tree.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ impl MerkleTree {
225225

226226
#[cfg(test)]
227227
pub(crate) mod test_helpers {
228+
#![cfg_attr(coverage_nightly, coverage(off))]
229+
228230
use std::collections::BTreeMap;
229231

230232
use amplify::confinement::Confined;
@@ -275,6 +277,8 @@ pub(crate) mod test_helpers {
275277

276278
#[cfg(test)]
277279
mod test {
280+
#![cfg_attr(coverage_nightly, coverage(off))]
281+
278282
use std::collections::BTreeSet;
279283

280284
use amplify::num::u5;

commit_verify/src/stl.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ pub fn commit_verify_stl() -> TypeLib {
9090

9191
#[cfg(test)]
9292
mod test {
93+
#![cfg_attr(coverage_nightly, coverage(off))]
94+
9395
use super::*;
9496

9597
#[test]

0 commit comments

Comments
 (0)