Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ lldb target/debugging/forest
## Cargo Features

- **`default`** - `jemalloc`, `tokio-console`, `tracing-loki`, `tracing-chrome`
- **`test`** - Default feature set for unit tests
- **`slim`** - Minimal feature set (uses rustalloc)
- **`jemalloc`** - Use jemalloc allocator (production default)
- **`rustalloc`** - Use Rust standard allocator
Expand All @@ -366,6 +367,7 @@ lldb target/debugging/forest
- **`tracing-loki`** - Send telemetry to Loki
- **`tracing-chrome`** - Chrome tracing support
- **`no-f3-sidecar`** - Disable F3 sidecar build
- **`cargo-test`** - Group of tests that is recommended to run with `cargo test` instead of `nextest`
- **`doctest-private`** - Enable doctests for private items
- **`benchmark-private`** - Enable benchmark suite
- **`interop-tests-private`** - Enable interop tests
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,9 @@ lto = "fat"
# These should be refactored (probably removed) in #2984
[features]
default = ["jemalloc", "tokio-console", "tracing-loki", "tracing-chrome", "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
3 changes: 2 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ fn rpc_regression_tests_gen() {
writeln!(
w,
r#"
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
async fn rpc_snapshot_test_{ident}() {{
async fn cargo_test_rpc_snapshot_test_{ident}() {{
rpc_regression_test_run("{test}").await
}}
"#,
Expand Down
25 changes: 19 additions & 6 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,31 @@ arg "<profile>" help="Build profile (quick, release, etc.)" default="quick" {
}
'''
run = '''
cargo test --doc --profile ${usage_profile?} --features doctest-private --no-fail-fast
cargo test --doc --profile ${usage_profile?} --no-default-features --features "test doctest-private" --no-fail-fast
'''

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

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

[tasks.test]
Expand All @@ -180,14 +192,15 @@ arg "<profile>" help="Build profile (quick, release, etc.)" default="quick" {
}
'''
run = '''
mise task run test:rust ${usage_profile?}
mise task run test:nextest ${usage_profile?}
mise task run test:cargo ${usage_profile?}
mise task run test:docs ${usage_profile?}
'''

[tasks.codecov]
description = "Generate codecov report"
run = '''
cargo llvm-cov -p forest-filecoin --codecov --output-path lcov.info
cargo llvm-cov -p forest-filecoin --codecov --no-default-features --features "test cargo-test" --output-path lcov.info
'''

[tasks."docs:format-spellcheck-dictionary"]
Expand Down
43 changes: 29 additions & 14 deletions src/state_manager/utils.rs
Comment thread
LesnyRumcajs marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ pub mod state_compute {
//!

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

#[tokio::test(flavor = "multi_thread")]
Expand All @@ -366,124 +367,138 @@ pub mod state_compute {
}

// FVM@4
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
async fn state_compute_mainnet_5709604() {
async fn cargo_test_state_compute_mainnet_5709604() {
let chain = NetworkChain::Mainnet;
let snapshot = get_state_compute_snapshot(&chain, 5709604).await.unwrap();
let (sm, ts, ts_next) = prepare_state_compute(&chain, &snapshot).await.unwrap();
state_compute(&sm, ts, &ts_next).await.unwrap();
}

// FVM@4
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
async fn state_compute_calibnet_3408952() {
async fn cargo_test_state_compute_calibnet_3408952() {
let chain = NetworkChain::Calibnet;
let snapshot = get_state_compute_snapshot(&chain, 3408952).await.unwrap();
let (sm, ts, ts_next) = prepare_state_compute(&chain, &snapshot).await.unwrap();
state_compute(&sm, ts, &ts_next).await.unwrap();
}

// Shark state migration with FVM@2
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
async fn state_compute_calibnet_16801() {
async fn cargo_test_state_compute_calibnet_16801() {
let chain = NetworkChain::Calibnet;
let snapshot = get_state_compute_snapshot(&chain, 16801).await.unwrap();
let (sm, ts, ts_next) = prepare_state_compute(&chain, &snapshot).await.unwrap();
state_compute(&sm, ts, &ts_next).await.unwrap();
}

// Hygge state migration with FVM@2
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
async fn state_compute_calibnet_322355() {
async fn cargo_test_state_compute_calibnet_322355() {
let chain = NetworkChain::Calibnet;
let snapshot = get_state_compute_snapshot(&chain, 322355).await.unwrap();
let (sm, ts, ts_next) = prepare_state_compute(&chain, &snapshot).await.unwrap();
state_compute(&sm, ts, &ts_next).await.unwrap();
}

// Lightning state migration with FVM@3
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
async fn state_compute_calibnet_489095() {
async fn cargo_test_state_compute_calibnet_489095() {
let chain = NetworkChain::Calibnet;
let snapshot = get_state_compute_snapshot(&chain, 489095).await.unwrap();
let (sm, ts, ts_next) = prepare_state_compute(&chain, &snapshot).await.unwrap();
state_compute(&sm, ts, &ts_next).await.unwrap();
}

// Watermelon state migration with FVM@3
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
async fn state_compute_calibnet_1013135() {
async fn cargo_test_state_compute_calibnet_1013135() {
let chain = NetworkChain::Calibnet;
let snapshot = get_state_compute_snapshot(&chain, 1013135).await.unwrap();
let (sm, ts, ts_next) = prepare_state_compute(&chain, &snapshot).await.unwrap();
state_compute(&sm, ts, &ts_next).await.unwrap();
}

// Dragon state migration with FVM@4
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
async fn state_compute_calibnet_1427975() {
async fn cargo_test_state_compute_calibnet_1427975() {
let chain = NetworkChain::Calibnet;
let snapshot = get_state_compute_snapshot(&chain, 1427975).await.unwrap();
let (sm, ts, ts_next) = prepare_state_compute(&chain, &snapshot).await.unwrap();
state_compute(&sm, ts, &ts_next).await.unwrap();
}

// Waffle state migration with FVM@4
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
async fn state_compute_calibnet_1779095() {
async fn cargo_test_state_compute_calibnet_1779095() {
let chain = NetworkChain::Calibnet;
let snapshot = get_state_compute_snapshot(&chain, 1779095).await.unwrap();
let (sm, ts, ts_next) = prepare_state_compute(&chain, &snapshot).await.unwrap();
state_compute(&sm, ts, &ts_next).await.unwrap();
}

// TukTuk state migration with FVM@4
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
async fn state_compute_calibnet_2078795() {
async fn cargo_test_state_compute_calibnet_2078795() {
let chain = NetworkChain::Calibnet;
let snapshot = get_state_compute_snapshot(&chain, 2078795).await.unwrap();
let (sm, ts, ts_next) = prepare_state_compute(&chain, &snapshot).await.unwrap();
state_compute(&sm, ts, &ts_next).await.unwrap();
}

// Teep state migration with FVM@4
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
async fn state_compute_calibnet_2523455() {
async fn cargo_test_state_compute_calibnet_2523455() {
let chain = NetworkChain::Calibnet;
let snapshot = get_state_compute_snapshot(&chain, 2523455).await.unwrap();
let (sm, ts, ts_next) = prepare_state_compute(&chain, &snapshot).await.unwrap();
state_compute(&sm, ts, &ts_next).await.unwrap();
}

// GoldenWeek state migration with FVM@4
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
async fn state_compute_calibnet_3007295() {
async fn cargo_test_state_compute_calibnet_3007295() {
let chain = NetworkChain::Calibnet;
let snapshot = get_state_compute_snapshot(&chain, 3007295).await.unwrap();
let (sm, ts, ts_next) = prepare_state_compute(&chain, &snapshot).await.unwrap();
state_compute(&sm, ts, &ts_next).await.unwrap();
}

#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
async fn state_validate_mainnet_5688000() {
async fn cargo_test_state_validate_mainnet_5688000() {
let chain = NetworkChain::Mainnet;
let snapshot = get_state_validate_snapshot(&chain, 5688000).await.unwrap();
let (sm, fts) = prepare_state_validate(&chain, &snapshot).await.unwrap();
validate_tipset(&sm, fts, None).await.unwrap();
}

// Shark state migration
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
async fn state_validate_calibnet_16802() {
async fn cargo_test_state_validate_calibnet_16802() {
let chain = NetworkChain::Calibnet;
let snapshot = get_state_validate_snapshot(&chain, 16802).await.unwrap();
let (sm, fts) = prepare_state_validate(&chain, &snapshot).await.unwrap();
validate_tipset(&sm, fts, None).await.unwrap();
}

// Hygge state migration
#[cfg(feature = "cargo-test")]
#[tokio::test(flavor = "multi_thread")]
async fn state_validate_calibnet_322356() {
async fn cargo_test_state_validate_calibnet_322356() {
let chain = NetworkChain::Calibnet;
let snapshot = get_state_validate_snapshot(&chain, 322356).await.unwrap();
let (sm, fts) = prepare_state_validate(&chain, &snapshot).await.unwrap();
Expand Down
1 change: 1 addition & 0 deletions src/tool/subcommands/api_cmd/test_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ mod tests {
// To run a single test: cargo test --lib filecoin_multisig_statedecodeparams_1754230255631789 -- --nocapture
include!(concat!(env!("OUT_DIR"), "/__rpc_regression_tests_gen.rs"));

#[allow(dead_code)]
async fn rpc_regression_test_run(name: &str) {
// Set proof parameter data dir and make sure the proofs are available
{
Expand Down
Loading