aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2021-04-02 10:43:29 -0700
committerElliott Hughes <enh@google.com>2021-04-02 10:43:29 -0700
commit9dcb441be395f7813076071376abb977eb9917bf (patch)
treec592f49e894fa1e0ddda753c68fdeb73e93c378e
parent20c4ee4df792238618cc7b453c728afdf68a19f5 (diff)
downloadtokio-test-9dcb441be395f7813076071376abb977eb9917bf.tar.gz
Upgrade rust/crates/tokio-test to 0.4.1
Test: make Change-Id: I82bcd74a0e87533697d4834e6bae93db554f9b06
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp29
-rw-r--r--CHANGELOG.md6
-rw-r--r--Cargo.toml8
-rw-r--r--Cargo.toml.orig9
-rw-r--r--METADATA8
-rw-r--r--TEST_MAPPING259
-rw-r--r--src/io.rs12
-rw-r--r--src/lib.rs5
9 files changed, 297 insertions, 41 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 888a4fb..9388b50 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "a66017f04985f5e7b7cb981e370e78a7291a5537"
+ "sha1": "e40ec3e4243f95b39a42bcc9049551b62c3058a0"
}
}
diff --git a/Android.bp b/Android.bp
index b800424..ef76cb6 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,4 +1,5 @@
// This file is generated by cargo2android.py --run --dependencies --device --tests.
+// Do not modify this file as changes will be overridden on upgrade.
package {
default_applicable_licenses: ["external_rust_crates_tokio-test_license"],
@@ -130,32 +131,32 @@ rust_test {
// autocfg-1.0.1
// bytes-1.0.1 "default,std"
// cfg-if-1.0.0
-// futures-core-0.3.12 "alloc,default,std"
-// futures-macro-0.3.12
-// futures-task-0.3.12 "alloc,once_cell,std"
-// futures-util-0.3.12 "alloc,async-await,async-await-macro,default,futures-macro,proc-macro-hack,proc-macro-nested,slab,std"
+// futures-core-0.3.13 "alloc,default,std"
+// futures-macro-0.3.13
+// futures-task-0.3.13 "alloc,std"
+// futures-util-0.3.13 "alloc,async-await,async-await-macro,default,futures-macro,proc-macro-hack,proc-macro-nested,slab,std"
// instant-0.1.9
-// libc-0.2.86 "align,default,std"
+// libc-0.2.92 "default,std"
// lock_api-0.4.2
// log-0.4.14
// memchr-2.3.4 "default,std"
-// mio-0.7.7 "default,net,os-ext,os-poll,os-util,tcp,udp,uds"
+// mio-0.7.11 "default,net,os-ext,os-poll,os-util,tcp,udp,uds"
// num_cpus-1.13.0
-// once_cell-1.5.2 "alloc,default,std"
+// once_cell-1.7.2 "alloc,default,race,std"
// parking_lot-0.11.1 "default"
-// parking_lot_core-0.8.2
-// pin-project-lite-0.2.4
+// parking_lot_core-0.8.3
+// pin-project-lite-0.2.6
// pin-utils-0.1.0
// proc-macro-hack-0.5.19
// proc-macro-nested-0.1.7
-// proc-macro2-1.0.24 "default,proc-macro"
-// quote-1.0.8 "default,proc-macro"
+// proc-macro2-1.0.26 "default,proc-macro"
+// quote-1.0.9 "default,proc-macro"
// scopeguard-1.1.0
// signal-hook-registry-1.3.0
// slab-0.4.2
// smallvec-1.6.1
-// syn-1.0.60 "clone-impls,default,derive,extra-traits,full,parsing,printing,proc-macro,quote,visit-mut"
-// tokio-1.2.0 "bytes,default,fs,full,io-std,io-util,libc,macros,memchr,mio,net,num_cpus,once_cell,parking_lot,process,rt,rt-multi-thread,signal,signal-hook-registry,sync,test-util,time,tokio-macros,winapi"
+// syn-1.0.68 "clone-impls,default,derive,extra-traits,full,parsing,printing,proc-macro,quote,visit-mut"
+// tokio-1.4.0 "bytes,default,fs,full,io-std,io-util,libc,macros,memchr,mio,net,num_cpus,once_cell,parking_lot,process,rt,rt-multi-thread,signal,signal-hook-registry,sync,test-util,time,tokio-macros,winapi"
// tokio-macros-1.1.0
-// tokio-stream-0.1.3 "default,time"
+// tokio-stream-0.1.5 "default,time"
// unicode-xid-0.2.1 "default"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0094de6..3fba3ce 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+# 0.4.1 (March 10, 2021)
+
+- Fix `io::Mock` to be `Send` and `Sync` ([#3594])
+
+[#3594]: https://github.com/tokio-rs/tokio/pull/3594
+
# 0.4.0 (December 23, 2020)
- Track `tokio` 1.0 release.
diff --git a/Cargo.toml b/Cargo.toml
index 0f78a92..6dc1d0c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,11 +13,11 @@
[package]
edition = "2018"
name = "tokio-test"
-version = "0.4.0"
+version = "0.4.1"
authors = ["Tokio Contributors <team@tokio.rs>"]
description = "Testing utilities for Tokio- and futures-based code\n"
homepage = "https://tokio.rs"
-documentation = "https://docs.rs/tokio-test/0.4.0/tokio_test"
+documentation = "https://docs.rs/tokio-test/0.4.1/tokio_test"
categories = ["asynchronous", "testing"]
license = "MIT"
repository = "https://github.com/tokio-rs/tokio"
@@ -33,7 +33,7 @@ version = "1.0.0"
version = "0.3.0"
[dependencies.tokio]
-version = "1.0.0"
+version = "1.2.0"
features = ["rt", "sync", "time", "test-util"]
[dependencies.tokio-stream]
@@ -42,5 +42,5 @@ version = "0.1"
version = "0.3.0"
[dev-dependencies.tokio]
-version = "1.0.0"
+version = "1.2.0"
features = ["full"]
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 52e48e1..2691c89 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -2,25 +2,24 @@
name = "tokio-test"
# When releasing to crates.io:
# - Remove path dependencies
-# - Update html_root_url.
# - Update doc url
# - Cargo.toml
# - Update CHANGELOG.md.
# - Create "tokio-test-0.4.x" git tag.
-version = "0.4.0"
+version = "0.4.1"
edition = "2018"
authors = ["Tokio Contributors <team@tokio.rs>"]
license = "MIT"
repository = "https://github.com/tokio-rs/tokio"
homepage = "https://tokio.rs"
-documentation = "https://docs.rs/tokio-test/0.4.0/tokio_test"
+documentation = "https://docs.rs/tokio-test/0.4.1/tokio_test"
description = """
Testing utilities for Tokio- and futures-based code
"""
categories = ["asynchronous", "testing"]
[dependencies]
-tokio = { version = "1.0.0", path = "../tokio", features = ["rt", "sync", "time", "test-util"] }
+tokio = { version = "1.2.0", path = "../tokio", features = ["rt", "sync", "time", "test-util"] }
tokio-stream = { version = "0.1", path = "../tokio-stream" }
async-stream = "0.3"
@@ -28,7 +27,7 @@ bytes = "1.0.0"
futures-core = "0.3.0"
[dev-dependencies]
-tokio = { version = "1.0.0", path = "../tokio", features = ["full"] }
+tokio = { version = "1.2.0", path = "../tokio", features = ["full"] }
futures-util = "0.3.0"
[package.metadata.docs.rs]
diff --git a/METADATA b/METADATA
index 5d9ec54..22032a7 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/tokio-test/tokio-test-0.4.0.crate"
+ value: "https://static.crates.io/crates/tokio-test/tokio-test-0.4.1.crate"
}
- version: "0.4.0"
+ version: "0.4.1"
license_type: NOTICE
last_upgrade_date {
year: 2021
- month: 2
- day: 8
+ month: 4
+ day: 2
}
}
diff --git a/TEST_MAPPING b/TEST_MAPPING
index f89e407..c5c9409 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -2,16 +2,271 @@
{
"presubmit": [
{
- "name": "tokio-test_device_test_tests_io"
+ "name": "tokio_device_test_tests_io_async_fd"
},
{
- "name": "tokio-test_device_test_src_lib"
+ "name": "tokio_device_test_tests_process_issue_2174"
+ },
+ {
+ "name": "tokio_device_test_tests_io_read"
+ },
+ {
+ "name": "tokio_device_test_tests_buffered"
+ },
+ {
+ "name": "tokio_device_test_tests_io_write_buf"
+ },
+ {
+ "name": "tokio_device_test_tests_uds_cred"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_notify"
+ },
+ {
+ "name": "tokio_device_test_tests_rt_common"
+ },
+ {
+ "name": "tokio_device_test_tests_task_abort"
+ },
+ {
+ "name": "tokio_device_test_tests_macros_select"
+ },
+ {
+ "name": "tokio_device_test_tests_io_write"
+ },
+ {
+ "name": "tokio_device_test_tests_fs_file_mocked"
+ },
+ {
+ "name": "tokio_device_test_tests_process_smoke"
+ },
+ {
+ "name": "tokio_device_test_tests_fs"
+ },
+ {
+ "name": "tokio_device_test_tests_process_kill_on_drop"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_stream"
+ },
+ {
+ "name": "tokio_device_test_tests_task_local_set"
+ },
+ {
+ "name": "tokio_device_test_tests_net_bind_resource"
},
{
"name": "tokio-test_device_test_tests_block_on"
},
{
+ "name": "tokio_device_test_tests_io_read_exact"
+ },
+ {
+ "name": "tokio_device_test_tests_io_async_read"
+ },
+ {
+ "name": "tokio_device_test_tests_io_write_all"
+ },
+ {
+ "name": "tokio_device_test_tests_io_write_int"
+ },
+ {
+ "name": "tokio_device_test_tests_fs_dir"
+ },
+ {
+ "name": "tokio_device_test_tests_async_send_sync"
+ },
+ {
+ "name": "tokio_device_test_tests_io_read_buf"
+ },
+ {
+ "name": "tokio_device_test_tests_net_lookup_host"
+ },
+ {
+ "name": "tokio_device_test_tests_signal_multi_rt"
+ },
+ {
+ "name": "tokio_device_test_tests_signal_no_rt"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_rwlock"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_broadcast"
+ },
+ {
+ "name": "tokio_device_test_tests_io_read_line"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_into_split"
+ },
+ {
+ "name": "tokio_device_test_tests_signal_twice"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_into_std"
+ },
+ {
+ "name": "tokio_device_test_tests_fs_link"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_connect"
+ },
+ {
+ "name": "tokio_device_test_tests_io_take"
+ },
+ {
+ "name": "tokio_device_test_tests_signal_drop_signal"
+ },
+ {
+ "name": "tokio_device_test_tests_io_split"
+ },
+ {
+ "name": "tokio_device_test_tests_uds_datagram"
+ },
+ {
+ "name": "tokio_device_test_tests_no_rt"
+ },
+ {
+ "name": "tokio_device_test_tests_fs_copy"
+ },
+ {
+ "name": "tokio_device_test_tests_signal_drop_recv"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_watch"
+ },
+ {
+ "name": "tokio_device_test_tests_uds_split"
+ },
+ {
+ "name": "tokio-test_device_test_src_lib"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_semaphore_owned"
+ },
+ {
+ "name": "tokio_device_test_tests_io_read_until"
+ },
+ {
"name": "tokio-test_device_test_tests_macros"
+ },
+ {
+ "name": "tokio-test_device_test_tests_io"
+ },
+ {
+ "name": "tokio_device_test_tests_io_chain"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_echo"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_accept"
+ },
+ {
+ "name": "tokio_device_test_tests_io_read_to_string"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_mutex"
+ },
+ {
+ "name": "tokio_device_test_tests_rt_basic"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_mpsc"
+ },
+ {
+ "name": "tokio_device_test_tests_signal_notify_both"
+ },
+ {
+ "name": "tokio_device_test_tests_process_issue_42"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_oneshot"
+ },
+ {
+ "name": "tokio_device_test_tests_macros_try_join"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_barrier"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_socket"
+ },
+ {
+ "name": "tokio_device_test_tests_signal_drop_rt"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_split"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_semaphore"
+ },
+ {
+ "name": "tokio_device_test_tests_udp"
+ },
+ {
+ "name": "tokio_device_test_tests_io_driver_drop"
+ },
+ {
+ "name": "tokio_device_test_tests_io_read_to_end"
+ },
+ {
+ "name": "tokio_device_test_tests_macros_join"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_errors"
+ },
+ {
+ "name": "tokio_device_test_tests_task_local"
+ },
+ {
+ "name": "tokio_device_test_tests_test_clock"
+ },
+ {
+ "name": "tokio_device_test_tests_rt_threaded"
+ },
+ {
+ "name": "tokio_device_test_tests_signal_ctrl_c"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_peek"
+ },
+ {
+ "name": "tokio_device_test_tests_macros_test"
+ },
+ {
+ "name": "tokio_device_test_tests_io_mem_stream"
+ },
+ {
+ "name": "tokio_device_test_tests_macros_pin"
+ },
+ {
+ "name": "tokio_device_test_tests_io_lines"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_mutex_owned"
+ },
+ {
+ "name": "tokio_device_test_tests_signal_usr1"
+ },
+ {
+ "name": "tokio_device_test_tests_task_blocking"
+ },
+ {
+ "name": "tokio_device_test_tests_uds_stream"
+ },
+ {
+ "name": "tokio_device_test_tests_io_copy"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_shutdown"
+ },
+ {
+ "name": "tokio_device_test_tests_fs_file"
+ },
+ {
+ "name": "tokio_device_test_tests_io_driver"
}
]
}
diff --git a/src/io.rs b/src/io.rs
index 77adfc3..4ec66a4 100644
--- a/src/io.rs
+++ b/src/io.rs
@@ -21,6 +21,7 @@
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use tokio::sync::mpsc;
use tokio::time::{self, Duration, Instant, Sleep};
+use tokio_stream::wrappers::UnboundedReceiverStream;
use futures_core::{ready, Stream};
use std::collections::VecDeque;
@@ -69,8 +70,7 @@ struct Inner {
waiting: Option<Instant>,
sleep: Option<Pin<Box<Sleep>>>,
read_wait: Option<Waker>,
- // rx: mpsc::UnboundedReceiver<Action>,
- rx: Pin<Box<dyn Stream<Item = Action> + Send>>,
+ rx: UnboundedReceiverStream<Action>,
}
impl Builder {
@@ -185,13 +185,9 @@ impl Handle {
impl Inner {
fn new(actions: VecDeque<Action>) -> (Inner, Handle) {
- let (tx, mut rx) = mpsc::unbounded_channel();
+ let (tx, rx) = mpsc::unbounded_channel();
- let rx = Box::pin(async_stream::stream! {
- while let Some(item) = rx.recv().await {
- yield item;
- }
- });
+ let rx = UnboundedReceiverStream::new(rx);
let inner = Inner {
actions,
diff --git a/src/lib.rs b/src/lib.rs
index 47e2b03..c510454 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,3 @@
-#![doc(html_root_url = "https://docs.rs/tokio-test/0.4.0")]
#![warn(
missing_debug_implementations,
missing_docs,
@@ -22,9 +21,9 @@ pub mod task;
/// future completes.
///
/// For more information, see the documentation for
-/// [`tokio::runtime::current_thread::Runtime::block_on`][runtime-block-on].
+/// [`tokio::runtime::Runtime::block_on`][runtime-block-on].
///
-/// [runtime-block-on]: https://docs.rs/tokio/0.2.0-alpha.2/tokio/runtime/current_thread/struct.Runtime.html#method.block_on
+/// [runtime-block-on]: https://docs.rs/tokio/1.3.0/tokio/runtime/struct.Runtime.html#method.block_on
pub fn block_on<F: std::future::Future>(future: F) -> F::Output {
use tokio::runtime;