Skip to content

Commit

Permalink
Disable libparsec_client's async stateful tests on web
Browse files Browse the repository at this point in the history
Async stateful tests manages their own Tokio runtime, which is not
possible on web where Tokio runtime is not supported.
  • Loading branch information
touilleMan committed Jan 9, 2025
1 parent 7d23479 commit 1db3d00
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions libparsec/crates/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,10 @@ proptest-state-machine = { workspace = true }
libparsec_platform_storage = { workspace = true, features = ["expose-test-methods"] }
libparsec_client = { workspace = true, features = ["expose-test-methods"] }

# Async stateful test currently relies on Tokio runtime, which is not available on web.
# This is no big deal though, since the tested code is supposed to be platform agnostic.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { workspace = true, features = ["rt"] }

[features]
expose-test-methods = []
6 changes: 4 additions & 2 deletions libparsec/crates/client/tests/unit/workspace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ mod store;
mod utils;
mod watch_entry;

#[cfg(unix)]
#[cfg(unix)] // Test uses UNIX filesystem as oracle
#[cfg(not(target_arch = "wasm32"))] // Async stateful requires Tokio runtime
mod file_transactions_stateful;

#[cfg(unix)]
#[allow(dead_code)]
pub trait AsyncStateMachineTest {
/// The concrete state, that is the system under test (SUT).
type SystemUnderTest;
Expand Down Expand Up @@ -90,6 +91,7 @@ pub trait AsyncStateMachineTest {
}
}

#[allow(dead_code)]
#[macro_export]
macro_rules! impl_async_state_machine {
($t:ty) => {
Expand Down

0 comments on commit 1db3d00

Please sign in to comment.