From a0ba23b2a4c52f3c0c06d71af244390e54d8ef46 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Thu, 3 Nov 2022 11:24:21 +1100 Subject: [PATCH] Create workspace This allows us to have a proper place for our test-harness. --- Cargo.toml | 35 ++------------------- test-harness/Cargo.toml | 19 +++++++++++ tests/harness.rs => test-harness/src/lib.rs | 0 {tests => test-harness/tests}/concurrent.rs | 5 +-- {tests => test-harness/tests}/poll_api.rs | 5 +-- {tests => test-harness/tests}/tests.rs | 6 +--- yamux/Cargo.toml | 33 +++++++++++++++++++ {benches => yamux/benches}/concurrent.rs | 0 {src => yamux/src}/chunks.rs | 0 {src => yamux/src}/connection.rs | 0 {src => yamux/src}/connection/cleanup.rs | 0 {src => yamux/src}/connection/closing.rs | 0 {src => yamux/src}/connection/stream.rs | 0 {src => yamux/src}/control.rs | 0 {src => yamux/src}/error.rs | 0 {src => yamux/src}/frame.rs | 0 {src => yamux/src}/frame/header.rs | 0 {src => yamux/src}/frame/io.rs | 0 {src => yamux/src}/lib.rs | 0 19 files changed, 57 insertions(+), 46 deletions(-) create mode 100644 test-harness/Cargo.toml rename tests/harness.rs => test-harness/src/lib.rs (100%) rename {tests => test-harness/tests}/concurrent.rs (99%) rename {tests => test-harness/tests}/poll_api.rs (99%) rename {tests => test-harness/tests}/tests.rs (99%) create mode 100644 yamux/Cargo.toml rename {benches => yamux/benches}/concurrent.rs (100%) rename {src => yamux/src}/chunks.rs (100%) rename {src => yamux/src}/connection.rs (100%) rename {src => yamux/src}/connection/cleanup.rs (100%) rename {src => yamux/src}/connection/closing.rs (100%) rename {src => yamux/src}/connection/stream.rs (100%) rename {src => yamux/src}/control.rs (100%) rename {src => yamux/src}/error.rs (100%) rename {src => yamux/src}/frame.rs (100%) rename {src => yamux/src}/frame/header.rs (100%) rename {src => yamux/src}/frame/io.rs (100%) rename {src => yamux/src}/lib.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 6933a0bf..4ffffeb6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,33 +1,2 @@ -[package] -name = "yamux" -version = "0.10.2" -authors = ["Parity Technologies "] -license = "Apache-2.0 OR MIT" -description = "Multiplexer over reliable, ordered connections" -keywords = ["network", "protocol"] -categories = ["network-programming"] -repository = "https://github.com/paritytech/yamux" -readme = "README.md" -edition = "2018" - -[dependencies] -futures = { version = "0.3.12", default-features = false, features = ["std"] } -log = "0.4.8" -nohash-hasher = "0.2" -parking_lot = "0.12" -rand = "0.8.3" -static_assertions = "1" - -[dev-dependencies] -anyhow = "1" -criterion = "0.4" -env_logger = "0.9" -futures = "0.3.4" -quickcheck = "1.0" -tokio = { version = "1.0", features = ["net", "rt-multi-thread", "macros", "time"] } -tokio-util = { version = "0.7", features = ["compat"] } -constrained-connection = "0.1" - -[[bench]] -name = "concurrent" -harness = false +[workspace] +members = ["yamux", "test-harness"] diff --git a/test-harness/Cargo.toml b/test-harness/Cargo.toml new file mode 100644 index 00000000..5830a393 --- /dev/null +++ b/test-harness/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "test-harness" +version = "0.1.0" +edition = "2018" +publish = false + +[dependencies] +yamux = { path = "../yamux" } +futures = "0.3.4" +quickcheck = "1.0" +tokio = { version = "1.0", features = ["net", "rt-multi-thread", "macros", "time"] } +tokio-util = { version = "0.7", features = ["compat"] } +anyhow = "1" +log = "0.4.17" + +[dev-dependencies] +env_logger = "0.9" +constrained-connection = "0.1" + diff --git a/tests/harness.rs b/test-harness/src/lib.rs similarity index 100% rename from tests/harness.rs rename to test-harness/src/lib.rs diff --git a/tests/concurrent.rs b/test-harness/tests/concurrent.rs similarity index 99% rename from tests/concurrent.rs rename to test-harness/tests/concurrent.rs index 4122441d..46501158 100644 --- a/tests/concurrent.rs +++ b/test-harness/tests/concurrent.rs @@ -8,17 +8,14 @@ // at https://www.apache.org/licenses/LICENSE-2.0 and a copy of the MIT license // at https://opensource.org/licenses/MIT. -#[allow(dead_code)] -mod harness; - use futures::prelude::*; use futures::stream::FuturesUnordered; -use harness::*; use quickcheck::{Arbitrary, Gen, QuickCheck}; use std::{ io, net::{Ipv4Addr, SocketAddr, SocketAddrV4}, }; +use test_harness::*; use tokio::net::{TcpListener, TcpStream}; use tokio::{net::TcpSocket, runtime::Runtime, task}; use tokio_util::compat::{Compat, TokioAsyncReadCompatExt}; diff --git a/tests/poll_api.rs b/test-harness/tests/poll_api.rs similarity index 99% rename from tests/poll_api.rs rename to test-harness/tests/poll_api.rs index d9466406..0cbf3a9f 100644 --- a/tests/poll_api.rs +++ b/test-harness/tests/poll_api.rs @@ -1,14 +1,11 @@ -#[allow(dead_code)] -mod harness; - use futures::future::BoxFuture; use futures::stream::FuturesUnordered; use futures::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, FutureExt, StreamExt}; -use harness::*; use quickcheck::QuickCheck; use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; +use test_harness::*; use tokio::net::TcpStream; use tokio::runtime::Runtime; use tokio_util::compat::TokioAsyncReadCompatExt; diff --git a/tests/tests.rs b/test-harness/tests/tests.rs similarity index 99% rename from tests/tests.rs rename to test-harness/tests/tests.rs index bf00fdb5..9add5b69 100644 --- a/tests/tests.rs +++ b/test-harness/tests/tests.rs @@ -8,22 +8,18 @@ // at https://www.apache.org/licenses/LICENSE-2.0 and a copy of the MIT license // at https://opensource.org/licenses/MIT. -#[allow(dead_code)] -mod harness; - use futures::channel::mpsc::{unbounded, UnboundedReceiver, UnboundedSender}; use futures::executor::LocalPool; use futures::future::join; use futures::io::AsyncReadExt; use futures::prelude::*; use futures::task::{Spawn, SpawnExt}; -use harness::*; -use harness::{Msg, TestConfig}; use quickcheck::{QuickCheck, TestResult}; use std::panic::panic_any; use std::pin::Pin; use std::sync::{Arc, Mutex}; use std::task::{Context, Poll, Waker}; +use test_harness::*; use tokio::{runtime::Runtime, task}; use yamux::{Config, Connection, ConnectionError, Control, Mode}; diff --git a/yamux/Cargo.toml b/yamux/Cargo.toml new file mode 100644 index 00000000..6933a0bf --- /dev/null +++ b/yamux/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "yamux" +version = "0.10.2" +authors = ["Parity Technologies "] +license = "Apache-2.0 OR MIT" +description = "Multiplexer over reliable, ordered connections" +keywords = ["network", "protocol"] +categories = ["network-programming"] +repository = "https://github.com/paritytech/yamux" +readme = "README.md" +edition = "2018" + +[dependencies] +futures = { version = "0.3.12", default-features = false, features = ["std"] } +log = "0.4.8" +nohash-hasher = "0.2" +parking_lot = "0.12" +rand = "0.8.3" +static_assertions = "1" + +[dev-dependencies] +anyhow = "1" +criterion = "0.4" +env_logger = "0.9" +futures = "0.3.4" +quickcheck = "1.0" +tokio = { version = "1.0", features = ["net", "rt-multi-thread", "macros", "time"] } +tokio-util = { version = "0.7", features = ["compat"] } +constrained-connection = "0.1" + +[[bench]] +name = "concurrent" +harness = false diff --git a/benches/concurrent.rs b/yamux/benches/concurrent.rs similarity index 100% rename from benches/concurrent.rs rename to yamux/benches/concurrent.rs diff --git a/src/chunks.rs b/yamux/src/chunks.rs similarity index 100% rename from src/chunks.rs rename to yamux/src/chunks.rs diff --git a/src/connection.rs b/yamux/src/connection.rs similarity index 100% rename from src/connection.rs rename to yamux/src/connection.rs diff --git a/src/connection/cleanup.rs b/yamux/src/connection/cleanup.rs similarity index 100% rename from src/connection/cleanup.rs rename to yamux/src/connection/cleanup.rs diff --git a/src/connection/closing.rs b/yamux/src/connection/closing.rs similarity index 100% rename from src/connection/closing.rs rename to yamux/src/connection/closing.rs diff --git a/src/connection/stream.rs b/yamux/src/connection/stream.rs similarity index 100% rename from src/connection/stream.rs rename to yamux/src/connection/stream.rs diff --git a/src/control.rs b/yamux/src/control.rs similarity index 100% rename from src/control.rs rename to yamux/src/control.rs diff --git a/src/error.rs b/yamux/src/error.rs similarity index 100% rename from src/error.rs rename to yamux/src/error.rs diff --git a/src/frame.rs b/yamux/src/frame.rs similarity index 100% rename from src/frame.rs rename to yamux/src/frame.rs diff --git a/src/frame/header.rs b/yamux/src/frame/header.rs similarity index 100% rename from src/frame/header.rs rename to yamux/src/frame/header.rs diff --git a/src/frame/io.rs b/yamux/src/frame/io.rs similarity index 100% rename from src/frame/io.rs rename to yamux/src/frame/io.rs diff --git a/src/lib.rs b/yamux/src/lib.rs similarity index 100% rename from src/lib.rs rename to yamux/src/lib.rs