Skip to content

Commit

Permalink
Switch tests over to the multi-threaded runtime to avoid deadlocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-F-Bryan committed Dec 8, 2023
1 parent b0f98f6 commit bbe7246
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
2 changes: 1 addition & 1 deletion lib/virtual-net/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ hyper = { version = "0.14", optional = true }
tokio-tungstenite = { version = "0.20", optional = true }

[dev-dependencies]
tokio = { version = "1", default_features = false, features = [ "macros" ] }
tokio = { version = "1", default_features = false, features = [ "macros", "rt-multi-thread" ] }
tracing-test = { version = "0.2" }

[features]
Expand Down
29 changes: 9 additions & 20 deletions lib/virtual-net/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,93 +123,83 @@ async fn test_tcp(client: RemoteNetworkingClient, _server: RemoteNetworkingServe
}

#[cfg(feature = "remote")]
#[cfg(target_os = "linux")]
#[traced_test]
#[tokio::test]
#[tokio::test(flavor = "multi_thread")]
async fn test_tcp_with_mpsc() {
let (client, server) = setup_mpsc().await;
test_tcp(client, server).await
}

#[cfg(feature = "remote")]
#[cfg(target_os = "linux")]
#[traced_test]
#[tokio::test]
#[tokio::test(flavor = "multi_thread")]
async fn test_tcp_with_small_pipe_using_bincode() {
let (client, server) = setup_pipe(10, FrameSerializationFormat::Bincode).await;
test_tcp(client, server).await
}

#[cfg(feature = "remote")]
#[cfg(target_os = "linux")]
#[traced_test]
#[tokio::test]
#[tokio::test(flavor = "multi_thread")]
async fn test_tcp_with_large_pipe_using_bincode() {
let (client, server) = setup_pipe(1024000, FrameSerializationFormat::Bincode).await;
test_tcp(client, server).await
}

#[cfg(feature = "remote")]
#[cfg(feature = "json")]
#[cfg(target_os = "linux")]
#[traced_test]
#[tokio::test]
#[tokio::test(flavor = "multi_thread")]
async fn test_tcp_with_small_pipe_using_json() {
let (client, server) = setup_pipe(10, FrameSerializationFormat::Json).await;
test_tcp(client, server).await
}

#[cfg(feature = "remote")]
#[cfg(feature = "json")]
#[cfg(target_os = "linux")]
#[traced_test]
#[tokio::test]
#[tokio::test(flavor = "multi_thread")]
async fn test_tcp_with_large_pipe_json_using_json() {
let (client, server) = setup_pipe(1024000, FrameSerializationFormat::Json).await;
test_tcp(client, server).await
}

#[cfg(feature = "remote")]
#[cfg(feature = "messagepack")]
#[cfg(target_os = "linux")]
#[traced_test]
#[tokio::test]
#[tokio::test(flavor = "multi_thread")]
async fn test_tcp_with_small_pipe_using_messagepack() {
let (client, server) = setup_pipe(10, FrameSerializationFormat::MessagePack).await;
test_tcp(client, server).await
}

#[cfg(feature = "remote")]
#[cfg(feature = "messagepack")]
#[cfg(target_os = "linux")]
#[traced_test]
#[tokio::test]
#[tokio::test(flavor = "multi_thread")]
async fn test_tcp_with_large_pipe_json_using_messagepack() {
let (client, server) = setup_pipe(1024000, FrameSerializationFormat::MessagePack).await;
test_tcp(client, server).await
}

#[cfg(feature = "remote")]
#[cfg(feature = "cbor")]
#[cfg(target_os = "linux")]
#[traced_test]
#[tokio::test]
#[tokio::test(flavor = "multi_thread")]
async fn test_tcp_with_small_pipe_using_cbor() {
let (client, server) = setup_pipe(10, FrameSerializationFormat::Cbor).await;
test_tcp(client, server).await
}

#[cfg(feature = "remote")]
#[cfg(feature = "cbor")]
#[cfg(target_os = "linux")]
#[traced_test]
#[tokio::test]
#[tokio::test(flavor = "multi_thread")]
async fn test_tcp_with_large_pipe_json_using_cbor() {
let (client, server) = setup_pipe(1024000, FrameSerializationFormat::Cbor).await;
test_tcp(client, server).await
}

#[cfg(target_os = "linux")]
#[traced_test]
#[tokio::test]
async fn test_google_poll() {
Expand Down Expand Up @@ -300,7 +290,6 @@ async fn test_google_poll() {
tracing::info!("done");
}

#[cfg(target_os = "linux")]
#[traced_test]
#[tokio::test]
async fn test_google_epoll() {
Expand Down

0 comments on commit bbe7246

Please sign in to comment.