Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[profile.default]
slow-timeout = { period = "10s", terminate-after = 3 }
# The `cargo_test_` group does expensive initialization (WASM engine) and is meant to share one
# process; nextest's process-per-test model makes it prohibitively expensive.
# Run it via `mise test:cargo`.
default-filter = 'not test(/cargo_test_/)'

[profile.default.junit]
path = "junit.xml"
Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ debug = "line-tables-only"
default = ["jemalloc", "tracing-loki", "sqlite"]
test = [] # default feature set for unit tests
slim = ["rustalloc"]
cargo-test = [] # group of tests that is recommended to run with `cargo test` instead of `nextest`
doctest-private = [] # see lib.rs::doctest_private
benchmark-private = ["dep:criterion"] # see lib.rs::benchmark_private
interop-tests-private = [] # see lib.rs::interop_tests_private
Expand Down
2 changes: 0 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ fn rpc_regression_tests_gen() {
writeln!(
w,
r#"
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
#[fickle::fickle]
async fn cargo_test_rpc_snapshot_test_{ident}() {{
Expand All @@ -110,7 +109,6 @@ fn state_compute_tests_gen() {
writeln!(
w,
r#"
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
#[fickle::fickle]
async fn cargo_test_state_compute_{chain}_{epoch}() {{
Expand Down
12 changes: 7 additions & 5 deletions interop-tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ fn main() {
}
rust2go::Builder::default()
.with_go_src("./src/tests/go_app")
.with_regen_arg(rust2go::RegenArgs {
src: "./src/tests/go_ffi.rs".into(),
dst: "./src/tests/go_app/ffi_gen.go".into(),
..Default::default()
})
// the generated Go file has been committed to the git repository,
// uncomment to regenerate the code locally
// .with_regen_arg(rust2go::RegenArgs {
// src: "./src/tests/go_ffi.rs".into(),
// dst: "./src/tests/go_app/ffi_gen.go".into(),
// ..Default::default()
// })
.build();
}
18 changes: 9 additions & 9 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -172,35 +172,35 @@ rm -rf node_modules
# We need to run them separately.
description = "Run doctests."
run = '''
cargo test --doc --no-default-features --features "test doctest-private cargo-test" --no-fail-fast
cargo test --doc --no-default-features --features "test doctest-private" --no-fail-fast
'''

[tasks."test:nextest"]
description = "Run Rust unit and integration tests except `cargo-test` group with nextest."
description = "Run Rust unit and integration tests except the `cargo_test_` group with nextest."
usage = '''
arg "<profile>" help="Build profile (quick-test, dev, etc.)" default="quick-test" {
choices "quick" "quick-test" "release" "dev"
}
'''
run = '''
echo "Running tests with profile: ${usage_profile?}"
cargo nextest run --cargo-profile ${usage_profile?} --workspace --no-default-features --features "test" --no-fail-fast
cargo nextest run --cargo-profile ${usage_profile?} --workspace --no-default-features --features "test doctest-private" --no-fail-fast
'''

[tasks."test:cargo"]
description = "Run Rust unit, integration and doc tests of `cargo-test` group with cargo test."
description = "Run the `cargo_test_` group (snapshot tests that share one process) with cargo test."
Comment thread
LesnyRumcajs marked this conversation as resolved.
Resolved
usage = '''
arg "<profile>" help="Build profile (quick-test, dev, etc.)" default="quick-test" {
choices "quick" "quick-test" "release" "dev"
}
'''
run = '''
echo "Running tests with profile: ${usage_profile?}"
cargo test --lib --profile ${usage_profile?} --no-default-features --features "test doctest-private cargo-test" --no-fail-fast -- --test "cargo_test_"
cargo test --lib --workspace --profile ${usage_profile?} --no-default-features --features "test doctest-private" --no-fail-fast -- --test "cargo_test_"
Comment thread
LesnyRumcajs marked this conversation as resolved.
Resolved
'''

[tasks.test]
description = "Run nextest and cargo-test groups (doctests run via `test:docs`)."
description = "Run nextest and `cargo_test_` groups (doctests run via `test:docs`)."
usage = '''
arg "<profile>" help="Build profile (quick-test, dev, etc.)" default="quick-test" {
choices "quick" "quick-test" "release" "dev"
Expand Down Expand Up @@ -243,13 +243,13 @@ forest-dev tests wallet
[tasks."codecov:nextest"]
description = "Run codecov with nextest"
run = '''
cargo llvm-cov --no-report nextest --cargo-profile codecov --workspace --no-default-features --features "test" --no-fail-fast
cargo llvm-cov --no-report nextest --cargo-profile codecov --workspace --no-default-features --features "test doctest-private" --no-fail-fast
'''

[tasks."codecov:cargo"]
description = "Run codecov with cargo-test"
description = "Run codecov for the `cargo_test_` group"
run = '''
cargo llvm-cov --no-report test -p forest-filecoin --profile codecov --lib --no-default-features --features "test cargo-test" --no-fail-fast -- "cargo_test_"
cargo llvm-cov --no-report test --workspace --profile codecov --lib --no-default-features --features "test doctest-private" --no-fail-fast -- "cargo_test_"
'''

[tasks."codecov:report"]
Expand Down
6 changes: 0 additions & 6 deletions src/state_manager/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,7 @@ pub mod state_compute {
//!

use super::*;
#[cfg(feature = "cargo-test")]
use crate::chain_sync::tipset_syncer::validate_tipset;
#[cfg(feature = "cargo-test")]
use crate::rpc::eth::types::CallSource;

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -379,7 +377,6 @@ pub mod state_compute {
state_compute(&sm, ts, &ts_next).await.unwrap();
}

#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
#[fickle::fickle]
async fn cargo_test_state_validate_mainnet_5688000() {
Expand All @@ -389,7 +386,6 @@ pub mod state_compute {
validate_tipset(&sm, fts, None).await.unwrap();
}

#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
#[fickle::fickle]
async fn cargo_test_state_replay_uses_trace_cache_calibnet_3408952() {
Expand Down Expand Up @@ -431,7 +427,6 @@ pub mod state_compute {
}

// Shark state migration
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
#[fickle::fickle]
async fn cargo_test_state_validate_calibnet_16802() {
Expand All @@ -442,7 +437,6 @@ pub mod state_compute {
}

// Hygge state migration
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
#[fickle::fickle]
async fn cargo_test_state_validate_calibnet_322356() {
Expand Down
Loading