From 8d814b3165239748e66c125c6e443e58809a8a09 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 25 Jan 2024 09:56:34 -0800 Subject: [PATCH] test: exclude test logic from coverage reports (#1927) That way, we actually get useful information. --- Cargo.lock | 8 ++++++++ Cargo.toml | 1 + fvm/Cargo.toml | 1 + fvm/src/lib.rs | 1 + shared/Cargo.toml | 1 + shared/src/lib.rs | 2 ++ 6 files changed, 14 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 226f9dad3..53a27538c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -808,6 +808,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "coverage-helper" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3036399e8abfc9d696c1ee94f7677f9704e903d96299b0026e339eed6055dcaf" + [[package]] name = "cpp_demangle" version = "0.3.5" @@ -2331,6 +2337,7 @@ dependencies = [ "blake2b_simd", "byteorder", "cid 0.10.1", + "coverage-helper", "derive_more", "filecoin-proofs-api", "fvm", @@ -2781,6 +2788,7 @@ dependencies = [ "blake2b_simd", "bls-signatures", "cid 0.10.1", + "coverage-helper", "data-encoding", "data-encoding-macro", "filecoin-proofs-api", diff --git a/Cargo.toml b/Cargo.toml index b6c9e6a5e..ed15caefb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -72,6 +72,7 @@ criterion = "0.5.1" quickcheck = "1.0.0" quickcheck_macros = "1.0.0" minstant = "0.1.3" +coverage-helper = "0.2.0" # workspace fvm = { path = "fvm", version = "~4.1.1", default-features = false } diff --git a/fvm/Cargo.toml b/fvm/Cargo.toml index ccdf62692..33b294c8a 100644 --- a/fvm/Cargo.toml +++ b/fvm/Cargo.toml @@ -49,6 +49,7 @@ static_assertions = "1.1.0" [dev-dependencies] pretty_assertions = "1.3.0" fvm = { path = ".", features = ["testing"], default-features = false } +coverage-helper = { workspace = true } [features] default = ["opencl"] diff --git a/fvm/src/lib.rs b/fvm/src/lib.rs index 435f4fe6f..4a0f98911 100644 --- a/fvm/src/lib.rs +++ b/fvm/src/lib.rs @@ -7,6 +7,7 @@ //! //! This package emits logs using the log façade. Configure the logging backend //! of your choice during the initialization of the consuming application. +#![cfg_attr(coverage_nightly, feature(coverage_attribute))] pub use kernel::default::DefaultKernel; pub use kernel::Kernel; diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 2601a8c26..6169fe8fa 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -41,6 +41,7 @@ rand = { workspace = true } serde_json = { workspace = true } multihash = { workspace = true, features = ["multihash-impl", "sha2", "sha3", "ripemd"] } quickcheck_macros = { workspace = true } +coverage-helper = { workspace = true } fvm_shared = { path = ".", features = ["arb"] } rand_chacha = { workspace = true } rusty-fork = { version = "0.3.0", default-features = false } diff --git a/shared/src/lib.rs b/shared/src/lib.rs index bcc758de6..a3cdbee72 100644 --- a/shared/src/lib.rs +++ b/shared/src/lib.rs @@ -2,6 +2,8 @@ // Copyright 2019-2022 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT +#![cfg_attr(coverage_nightly, feature(coverage_attribute))] + #[macro_use] extern crate lazy_static;