diff --git a/.cirrus.yml b/.cirrus.yml index 416ad879fc4..7772fea2c78 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -4,7 +4,7 @@ freebsd_instance: image_family: freebsd-12-4 env: RUST_STABLE: stable - RUST_NIGHTLY: nightly-2022-10-25 + RUST_NIGHTLY: nightly-2023-02-13 RUSTFLAGS: -D warnings # Test FreeBSD in a full VM on cirrus-ci.com. Test the i686 target too, in the diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 704f7b4e56f..2edf7cb82ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ env: RUST_BACKTRACE: 1 # Change to specific Rust release to pin rust_stable: stable - rust_nightly: nightly-2022-11-03 + rust_nightly: nightly-2023-02-13 rust_clippy: 1.65.0 # When updating this, also update: # - README.md @@ -202,10 +202,14 @@ jobs: toolchain: ${{ env.rust_nightly }} components: miri - uses: Swatinem/rust-cache@v2 + - run: | + echo '[patch.crates-io]' >>Cargo.toml + echo 'parking_lot_core = { git = "https://github.com/taiki-e/parking_lot.git", branch = "strict-provenance" }' >>Cargo.toml + git diff + cargo update - name: miri - # Many of tests in tokio/tests and doctests use #[tokio::test] or - # #[tokio::main] that calls epoll_create1 that Miri does not support. - run: cargo miri test --features full --lib --no-fail-fast + # Ignore doctest because many features don't work with Miri yet. + run: cargo miri test --features full --no-fail-fast --tests working-directory: tokio env: MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields diff --git a/tokio/src/process/unix/orphan.rs b/tokio/src/process/unix/orphan.rs index 340719603be..f73937cb9a4 100644 --- a/tokio/src/process/unix/orphan.rs +++ b/tokio/src/process/unix/orphan.rs @@ -291,8 +291,8 @@ pub(crate) mod test { drop(signal_guard); } - #[cfg_attr(miri, ignore)] // Miri does not support epoll. #[test] + #[cfg_attr(miri, ignore)] // Miri doesn't support sigaction fn does_not_register_signal_if_queue_empty() { let (io_driver, io_handle) = IoDriver::new(1024).unwrap(); let signal_driver = SignalDriver::new(io_driver, &io_handle).unwrap(); diff --git a/tokio/tests/buffered.rs b/tokio/tests/buffered.rs index 4251c3fcc0b..0ad7816cf70 100644 --- a/tokio/tests/buffered.rs +++ b/tokio/tests/buffered.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support bind() +#![cfg(not(miri))] // Miri doesn't support socket use tokio::net::TcpListener; use tokio_test::assert_ok; diff --git a/tokio/tests/fs.rs b/tokio/tests/fs.rs index ba38b719f2c..1849b745e4b 100644 --- a/tokio/tests/fs.rs +++ b/tokio/tests/fs.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support file operations +#![cfg(not(miri))] // Miri doesn't support epoll_wait use tokio::fs; use tokio_test::assert_ok; diff --git a/tokio/tests/fs_copy.rs b/tokio/tests/fs_copy.rs index 04678cf05b4..e96b5bdaa6f 100644 --- a/tokio/tests/fs_copy.rs +++ b/tokio/tests/fs_copy.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support file operations +#![cfg(not(miri))] // Miri doesn't support epoll_wait use tempfile::tempdir; use tokio::fs; diff --git a/tokio/tests/fs_dir.rs b/tokio/tests/fs_dir.rs index f197a40ac95..a93016da79a 100644 --- a/tokio/tests/fs_dir.rs +++ b/tokio/tests/fs_dir.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support directory operations +#![cfg(not(miri))] // Miri doesn't support epoll_wait use tokio::fs; use tokio_test::{assert_err, assert_ok}; diff --git a/tokio/tests/fs_file.rs b/tokio/tests/fs_file.rs index 603ccad3802..e86e42a3055 100644 --- a/tokio/tests/fs_file.rs +++ b/tokio/tests/fs_file.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support file operations +#![cfg(not(miri))] // Miri doesn't support creating file with non-default mode (inside NamedTempFile::new): https://github.com/rust-lang/miri/pull/2720 use std::io::prelude::*; use tempfile::NamedTempFile; diff --git a/tokio/tests/fs_link.rs b/tokio/tests/fs_link.rs index d198abc5182..be16ebaa901 100644 --- a/tokio/tests/fs_link.rs +++ b/tokio/tests/fs_link.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support file operations +#![cfg(not(miri))] // Miri doesn't support epoll_wait use tokio::fs; diff --git a/tokio/tests/io_async_fd.rs b/tokio/tests/io_async_fd.rs index 5a6875e3c2e..36545c78720 100644 --- a/tokio/tests/io_async_fd.rs +++ b/tokio/tests/io_async_fd.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(unix, feature = "full"))] +#![cfg(not(miri))] // Miri doesn't support 0x3 command for fcntl use std::os::unix::io::{AsRawFd, RawFd}; use std::sync::{ diff --git a/tokio/tests/io_buf_reader.rs b/tokio/tests/io_buf_reader.rs index 0d3f6bafc20..8e98c41ad35 100644 --- a/tokio/tests/io_buf_reader.rs +++ b/tokio/tests/io_buf_reader.rs @@ -223,6 +223,7 @@ async fn test_short_reads() { } #[tokio::test] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn maybe_pending() { let inner: &[u8] = &[5, 6, 7, 0, 1, 2, 3, 4]; let mut reader = BufReader::with_capacity(2, MaybePending::new(inner)); @@ -260,6 +261,7 @@ async fn maybe_pending() { } #[tokio::test] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn maybe_pending_buf_read() { let inner = MaybePending::new(&[0, 1, 2, 3, 1, 0]); let mut reader = BufReader::with_capacity(2, inner); @@ -279,6 +281,7 @@ async fn maybe_pending_buf_read() { // https://github.com/rust-lang/futures-rs/pull/1573#discussion_r281162309 #[tokio::test] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn maybe_pending_seek() { struct MaybePendingSeek<'a> { inner: Cursor<&'a [u8]>, diff --git a/tokio/tests/io_buf_writer.rs b/tokio/tests/io_buf_writer.rs index d3acf62c784..1b586ffff69 100644 --- a/tokio/tests/io_buf_writer.rs +++ b/tokio/tests/io_buf_writer.rs @@ -132,6 +132,7 @@ async fn buf_writer_seek() { } #[tokio::test] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn maybe_pending_buf_writer() { let mut writer = BufWriter::with_capacity(2, MaybePending::new(Vec::new())); @@ -180,6 +181,7 @@ async fn maybe_pending_buf_writer() { } #[tokio::test] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn maybe_pending_buf_writer_inner_flushes() { let mut w = BufWriter::with_capacity(3, MaybePending::new(Vec::new())); assert_eq!(w.write(&[0, 1]).await.unwrap(), 2); @@ -190,6 +192,7 @@ async fn maybe_pending_buf_writer_inner_flushes() { } #[tokio::test] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn maybe_pending_buf_writer_seek() { struct MaybePendingSeek { inner: Cursor>, diff --git a/tokio/tests/io_copy.rs b/tokio/tests/io_copy.rs index 005e1701191..42a72489161 100644 --- a/tokio/tests/io_copy.rs +++ b/tokio/tests/io_copy.rs @@ -38,6 +38,7 @@ async fn copy() { } #[tokio::test] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn proxy() { struct BufferedWd { buf: BytesMut, diff --git a/tokio/tests/io_copy_bidirectional.rs b/tokio/tests/io_copy_bidirectional.rs index c5496759550..1b68399ca4a 100644 --- a/tokio/tests/io_copy_bidirectional.rs +++ b/tokio/tests/io_copy_bidirectional.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support bind() +#![cfg(not(miri))] // Miri doesn't support socket use std::time::Duration; use tokio::io::{self, copy_bidirectional, AsyncReadExt, AsyncWriteExt}; diff --git a/tokio/tests/io_driver.rs b/tokio/tests/io_driver.rs index 97018e0f967..e4243c12e9b 100644 --- a/tokio/tests/io_driver.rs +++ b/tokio/tests/io_driver.rs @@ -1,6 +1,7 @@ #![warn(rust_2018_idioms)] // Wasi does not support panic recovery or threading #![cfg(all(feature = "full", not(tokio_wasi)))] +#![cfg(not(miri))] // Miri doesn't support socket use tokio::net::TcpListener; use tokio::runtime; diff --git a/tokio/tests/io_driver_drop.rs b/tokio/tests/io_driver_drop.rs index 0a384d4196d..46b00a8df27 100644 --- a/tokio/tests/io_driver_drop.rs +++ b/tokio/tests/io_driver_drop.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support bind +#![cfg(not(miri))] // Miri doesn't support socket use tokio::net::TcpListener; use tokio::runtime; diff --git a/tokio/tests/io_fill_buf.rs b/tokio/tests/io_fill_buf.rs index 62c3f1b370d..16e351165aa 100644 --- a/tokio/tests/io_fill_buf.rs +++ b/tokio/tests/io_fill_buf.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support file operations +#![cfg(not(miri))] // Miri doesn't support creating file with non-default mode (inside NamedTempFile::new): https://github.com/rust-lang/miri/pull/2720 use tempfile::NamedTempFile; use tokio::fs::File; diff --git a/tokio/tests/io_mem_stream.rs b/tokio/tests/io_mem_stream.rs index e79ec4e9d77..c8c24dcd2fc 100644 --- a/tokio/tests/io_mem_stream.rs +++ b/tokio/tests/io_mem_stream.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] +#![cfg(not(miri))] // Miri doesn't support write to event (inside mio::waker::Waker::wake) use tokio::io::{duplex, AsyncReadExt, AsyncWriteExt}; diff --git a/tokio/tests/io_util_empty.rs b/tokio/tests/io_util_empty.rs index e49cd17fcd5..f002e6eff6f 100644 --- a/tokio/tests/io_util_empty.rs +++ b/tokio/tests/io_util_empty.rs @@ -1,7 +1,9 @@ #![cfg(feature = "full")] + use tokio::io::{AsyncBufReadExt, AsyncReadExt}; #[tokio::test] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn empty_read_is_cooperative() { tokio::select! { biased; @@ -17,6 +19,7 @@ async fn empty_read_is_cooperative() { } #[tokio::test] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn empty_buf_reads_are_cooperative() { tokio::select! { biased; diff --git a/tokio/tests/join_handle_panic.rs b/tokio/tests/join_handle_panic.rs index bc34fd0ea59..82606e24540 100644 --- a/tokio/tests/join_handle_panic.rs +++ b/tokio/tests/join_handle_panic.rs @@ -10,6 +10,7 @@ impl Drop for PanicsOnDrop { } #[tokio::test] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn test_panics_do_not_propagate_when_dropping_join_handle() { let join_handle = tokio::spawn(async move { PanicsOnDrop }); diff --git a/tokio/tests/macros_join.rs b/tokio/tests/macros_join.rs index a87c6a6f86e..f4ea4853f74 100644 --- a/tokio/tests/macros_join.rs +++ b/tokio/tests/macros_join.rs @@ -111,6 +111,7 @@ async fn poor_little_task(permits: Arc) -> usize { } #[tokio::test] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn join_does_not_allow_tasks_to_starve() { let permits = Arc::new(Semaphore::new(1)); @@ -125,6 +126,7 @@ async fn join_does_not_allow_tasks_to_starve() { } #[tokio::test] +#[cfg_attr(miri, ignore)] // Miri doesn't support epoll_wait async fn a_different_future_is_polled_first_every_time_poll_fn_is_polled() { let poll_order = Arc::new(std::sync::Mutex::new(vec![])); diff --git a/tokio/tests/macros_rename_test.rs b/tokio/tests/macros_rename_test.rs index 90a86f9722b..2bf7944860f 100644 --- a/tokio/tests/macros_rename_test.rs +++ b/tokio/tests/macros_rename_test.rs @@ -1,4 +1,5 @@ #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support threading +#![cfg(not(miri))] // Miri doesn't support write to event (inside mio::waker::Waker::wake) #[allow(unused_imports)] use std as tokio; diff --git a/tokio/tests/macros_select.rs b/tokio/tests/macros_select.rs index 26d6fec874b..be0c38e16d5 100644 --- a/tokio/tests/macros_select.rs +++ b/tokio/tests/macros_select.rs @@ -127,6 +127,7 @@ async fn one_ready() { #[maybe_tokio_test] #[cfg(feature = "full")] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn select_streams() { use tokio::sync::mpsc; diff --git a/tokio/tests/macros_test.rs b/tokio/tests/macros_test.rs index 85279b7edc0..ed9499b6d8b 100644 --- a/tokio/tests/macros_test.rs +++ b/tokio/tests/macros_test.rs @@ -3,11 +3,13 @@ use tokio::test; #[test] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn test_macro_can_be_used_via_use() { tokio::spawn(async {}).await.unwrap(); } #[tokio::test] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn test_macro_is_resilient_to_shadowing() { tokio::spawn(async {}).await.unwrap(); } diff --git a/tokio/tests/macros_try_join.rs b/tokio/tests/macros_try_join.rs index 6c432221df1..572501a548e 100644 --- a/tokio/tests/macros_try_join.rs +++ b/tokio/tests/macros_try_join.rs @@ -139,6 +139,7 @@ async fn poor_little_task(permits: Arc) -> Result { } #[tokio::test] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn try_join_does_not_allow_tasks_to_starve() { let permits = Arc::new(Semaphore::new(10)); @@ -155,6 +156,7 @@ async fn try_join_does_not_allow_tasks_to_starve() { } #[tokio::test] +#[cfg_attr(miri, ignore)] // Miri doesn't support epoll_wait async fn a_different_future_is_polled_first_every_time_poll_fn_is_polled() { let poll_order = Arc::new(std::sync::Mutex::new(vec![])); diff --git a/tokio/tests/net_bind_resource.rs b/tokio/tests/net_bind_resource.rs index 1c604aa534c..2aa8e5ab6fd 100644 --- a/tokio/tests/net_bind_resource.rs +++ b/tokio/tests/net_bind_resource.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support panic recovery or bind +#![cfg(not(miri))] // Miri doesn't support socket use tokio::net::TcpListener; diff --git a/tokio/tests/net_lookup_host.rs b/tokio/tests/net_lookup_host.rs index 2b346e65e37..6bc08c1627a 100644 --- a/tokio/tests/net_lookup_host.rs +++ b/tokio/tests/net_lookup_host.rs @@ -23,6 +23,7 @@ async fn lookup_str_socket_addr() { } #[tokio::test] +#[cfg_attr(miri, ignore)] // Miri doesn't support getaddrinfo async fn resolve_dns() -> io::Result<()> { let mut hosts = net::lookup_host("localhost:3000").await?; let host = hosts.next().unwrap(); diff --git a/tokio/tests/net_panic.rs b/tokio/tests/net_panic.rs index fc2209ad4b0..b3c22afaa8c 100644 --- a/tokio/tests/net_panic.rs +++ b/tokio/tests/net_panic.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] +#![cfg(not(miri))] // Miri doesn't support socket use std::error::Error; use tokio::net::{TcpListener, TcpStream}; diff --git a/tokio/tests/no_rt.rs b/tokio/tests/no_rt.rs index 747fab6af7d..a4f4af719a7 100644 --- a/tokio/tests/no_rt.rs +++ b/tokio/tests/no_rt.rs @@ -1,4 +1,5 @@ #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support panic recovery +#![cfg(not(miri))] // Miri doesn't support socket use tokio::net::TcpStream; use tokio::sync::oneshot; diff --git a/tokio/tests/process_arg0.rs b/tokio/tests/process_arg0.rs index 4fabea0fe1f..c5d7255ecc3 100644 --- a/tokio/tests/process_arg0.rs +++ b/tokio/tests/process_arg0.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", unix))] +#![cfg(not(miri))] // Miri doesn't support pipe2 use tokio::process::Command; diff --git a/tokio/tests/process_issue_2174.rs b/tokio/tests/process_issue_2174.rs index 5ee9dc0a4b4..d4102e0666a 100644 --- a/tokio/tests/process_issue_2174.rs +++ b/tokio/tests/process_issue_2174.rs @@ -8,6 +8,7 @@ // `EV_EOF` or `EV_ERROR` flag set. If either flag is set a write would be // attempted, but that does not seem to occur. #![cfg(all(unix, not(target_os = "freebsd")))] +#![cfg(not(miri))] // Miri doesn't support pipe2 use std::process::Stdio; use std::time::Duration; diff --git a/tokio/tests/process_issue_42.rs b/tokio/tests/process_issue_42.rs index 569c122e36a..065a2b71baa 100644 --- a/tokio/tests/process_issue_42.rs +++ b/tokio/tests/process_issue_42.rs @@ -1,6 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] +#![cfg(not(miri))] // Miri doesn't support gnu_get_libc_version use futures::future::join_all; use std::process::Stdio; diff --git a/tokio/tests/process_kill_on_drop.rs b/tokio/tests/process_kill_on_drop.rs index 658e4addd61..412150ea0fb 100644 --- a/tokio/tests/process_kill_on_drop.rs +++ b/tokio/tests/process_kill_on_drop.rs @@ -1,5 +1,6 @@ #![cfg(all(unix, feature = "process"))] #![warn(rust_2018_idioms)] +#![cfg(not(miri))] // Miri doesn't support pipe2 use std::io::ErrorKind; use std::process::Stdio; diff --git a/tokio/tests/process_smoke.rs b/tokio/tests/process_smoke.rs index 81d2020a079..8a94510ae4c 100644 --- a/tokio/tests/process_smoke.rs +++ b/tokio/tests/process_smoke.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi cannot run system commands +#![cfg(not(miri))] // Miri doesn't support gnu_get_libc_version use tokio::process::Command; use tokio_test::assert_ok; diff --git a/tokio/tests/rt_basic.rs b/tokio/tests/rt_basic.rs index 6caf0a44bf8..d38c4191b56 100644 --- a/tokio/tests/rt_basic.rs +++ b/tokio/tests/rt_basic.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] +#![cfg(not(miri))] // Miri doesn't support write to event (inside mio::waker::Waker::wake) use tokio::runtime::Runtime; use tokio::sync::oneshot; diff --git a/tokio/tests/rt_common.rs b/tokio/tests/rt_common.rs index 22d821fa1ad..9850f28a0b9 100644 --- a/tokio/tests/rt_common.rs +++ b/tokio/tests/rt_common.rs @@ -1,6 +1,7 @@ #![allow(clippy::needless_range_loop)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] +#![cfg(not(miri))] // Miri doesn't support epoll_wait // Tests to run on both current-thread & multi-thread runtime variants. diff --git a/tokio/tests/rt_handle_block_on.rs b/tokio/tests/rt_handle_block_on.rs index 5ec783e5588..2fc6685b8ca 100644 --- a/tokio/tests/rt_handle_block_on.rs +++ b/tokio/tests/rt_handle_block_on.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] +#![cfg(not(miri))] // Miri doesn't support epoll_wait // All io tests that deal with shutdown is currently ignored because there are known bugs in with // shutting down the io driver while concurrently registering new resources. See diff --git a/tokio/tests/rt_panic.rs b/tokio/tests/rt_panic.rs index f9a684fdada..f687fb32f0e 100644 --- a/tokio/tests/rt_panic.rs +++ b/tokio/tests/rt_panic.rs @@ -24,6 +24,7 @@ fn current_handle_panic_caller() -> Result<(), Box> { } #[test] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) fn into_panic_panic_caller() -> Result<(), Box> { let panic_location_file = test_panic(move || { let rt = current_thread(); diff --git a/tokio/tests/rt_threaded.rs b/tokio/tests/rt_threaded.rs index c5984182cec..e8009174e0b 100644 --- a/tokio/tests/rt_threaded.rs +++ b/tokio/tests/rt_threaded.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] +#![cfg(not(miri))] // Miri doesn't support epoll_wait use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpListener, TcpStream}; diff --git a/tokio/tests/signal_ctrl_c.rs b/tokio/tests/signal_ctrl_c.rs index 4b057ee7e14..22a25a32094 100644 --- a/tokio/tests/signal_ctrl_c.rs +++ b/tokio/tests/signal_ctrl_c.rs @@ -1,6 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] +#![cfg(not(miri))] // Miri doesn't support sigaction mod support { pub mod signal; diff --git a/tokio/tests/signal_drop_recv.rs b/tokio/tests/signal_drop_recv.rs index b0d9213e618..7c61564d58a 100644 --- a/tokio/tests/signal_drop_recv.rs +++ b/tokio/tests/signal_drop_recv.rs @@ -1,6 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] +#![cfg(not(miri))] // Miri doesn't support sigaction mod support { pub mod signal; diff --git a/tokio/tests/signal_drop_rt.rs b/tokio/tests/signal_drop_rt.rs index b931d7a9033..e56f45b55c9 100644 --- a/tokio/tests/signal_drop_rt.rs +++ b/tokio/tests/signal_drop_rt.rs @@ -1,6 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] +#![cfg(not(miri))] // Miri doesn't support sigaction mod support { pub mod signal; diff --git a/tokio/tests/signal_drop_signal.rs b/tokio/tests/signal_drop_signal.rs index 92ac4050d57..e95633dfa33 100644 --- a/tokio/tests/signal_drop_signal.rs +++ b/tokio/tests/signal_drop_signal.rs @@ -1,6 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] +#![cfg(not(miri))] // Miri doesn't support sigaction mod support { pub mod signal; diff --git a/tokio/tests/signal_multi_rt.rs b/tokio/tests/signal_multi_rt.rs index 1e0402c4794..5278c57f733 100644 --- a/tokio/tests/signal_multi_rt.rs +++ b/tokio/tests/signal_multi_rt.rs @@ -1,6 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] +#![cfg(not(miri))] // Miri doesn't support sigaction mod support { pub mod signal; diff --git a/tokio/tests/signal_notify_both.rs b/tokio/tests/signal_notify_both.rs index 3481f808b36..dfcd0934ccb 100644 --- a/tokio/tests/signal_notify_both.rs +++ b/tokio/tests/signal_notify_both.rs @@ -1,6 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] +#![cfg(not(miri))] // Miri doesn't support sigaction mod support { pub mod signal; diff --git a/tokio/tests/signal_twice.rs b/tokio/tests/signal_twice.rs index 8f33d22a82d..01c9b8cc515 100644 --- a/tokio/tests/signal_twice.rs +++ b/tokio/tests/signal_twice.rs @@ -1,6 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] +#![cfg(not(miri))] // Miri doesn't support sigaction mod support { pub mod signal; diff --git a/tokio/tests/signal_usr1.rs b/tokio/tests/signal_usr1.rs index d74c7d31ab5..2c0f98f5b3a 100644 --- a/tokio/tests/signal_usr1.rs +++ b/tokio/tests/signal_usr1.rs @@ -1,6 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] +#![cfg(not(miri))] // Miri doesn't support sigaction mod support { pub mod signal; diff --git a/tokio/tests/sync_mpsc.rs b/tokio/tests/sync_mpsc.rs index 6e870964113..7eca5e7ff8f 100644 --- a/tokio/tests/sync_mpsc.rs +++ b/tokio/tests/sync_mpsc.rs @@ -1,6 +1,7 @@ #![allow(clippy::redundant_clone)] #![warn(rust_2018_idioms)] #![cfg(feature = "sync")] +#![cfg(not(miri))] // Miri doesn't support write to event (inside mio::waker::Waker::wake) #[cfg(tokio_wasm_not_wasi)] use wasm_bindgen_test::wasm_bindgen_test as test; diff --git a/tokio/tests/sync_mutex.rs b/tokio/tests/sync_mutex.rs index 1e35a558c1d..c2739a91745 100644 --- a/tokio/tests/sync_mutex.rs +++ b/tokio/tests/sync_mutex.rs @@ -92,6 +92,7 @@ fn lock() { /// is aborted prematurely. #[tokio::test] #[cfg(feature = "full")] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn aborted_future_1() { use std::time::Duration; use tokio::time::{interval, timeout}; @@ -122,6 +123,7 @@ async fn aborted_future_1() { /// aborted future is waiting for the lock. #[tokio::test] #[cfg(feature = "full")] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn aborted_future_2() { use std::time::Duration; use tokio::time::timeout; diff --git a/tokio/tests/sync_mutex_owned.rs b/tokio/tests/sync_mutex_owned.rs index ba472fee78e..17a7bb235f6 100644 --- a/tokio/tests/sync_mutex_owned.rs +++ b/tokio/tests/sync_mutex_owned.rs @@ -59,6 +59,7 @@ fn readiness() { /// is aborted prematurely. #[tokio::test] #[cfg(feature = "full")] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn aborted_future_1() { use std::time::Duration; use tokio::time::{interval, timeout}; @@ -89,6 +90,7 @@ async fn aborted_future_1() { /// aborted future is waiting for the lock. #[tokio::test] #[cfg(feature = "full")] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn aborted_future_2() { use std::time::Duration; use tokio::time::timeout; diff --git a/tokio/tests/sync_oneshot.rs b/tokio/tests/sync_oneshot.rs index 15b6923701f..cb17c55fa2d 100644 --- a/tokio/tests/sync_oneshot.rs +++ b/tokio/tests/sync_oneshot.rs @@ -95,6 +95,7 @@ fn close_rx() { #[tokio::test] #[cfg(feature = "full")] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn async_rx_closed() { let (mut tx, rx) = oneshot::channel::<()>(); diff --git a/tokio/tests/sync_rwlock.rs b/tokio/tests/sync_rwlock.rs index 948ec131ed1..52db532549e 100644 --- a/tokio/tests/sync_rwlock.rs +++ b/tokio/tests/sync_rwlock.rs @@ -174,6 +174,7 @@ async fn write_order() { // A single RwLock is contested by tasks in multiple threads #[cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support threads #[tokio::test(flavor = "multi_thread", worker_threads = 8)] +#[cfg_attr(miri, ignore)] // Miri doesn't support epoll_wait async fn multithreaded() { use futures::stream::{self, StreamExt}; use std::sync::Arc; diff --git a/tokio/tests/sync_semaphore.rs b/tokio/tests/sync_semaphore.rs index 3d47ed0ed73..0fbbf51abbc 100644 --- a/tokio/tests/sync_semaphore.rs +++ b/tokio/tests/sync_semaphore.rs @@ -27,6 +27,7 @@ fn try_acquire() { #[tokio::test] #[cfg(feature = "full")] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn acquire() { let sem = Arc::new(Semaphore::new(1)); let p1 = sem.try_acquire().unwrap(); @@ -40,6 +41,7 @@ async fn acquire() { #[tokio::test] #[cfg(feature = "full")] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn add_permits() { let sem = Arc::new(Semaphore::new(0)); let sem_clone = sem.clone(); @@ -90,6 +92,7 @@ fn merge_unrelated_permits() { #[tokio::test] #[cfg(feature = "full")] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn stress_test() { let sem = Arc::new(Semaphore::new(5)); let mut join_handles = Vec::new(); diff --git a/tokio/tests/sync_semaphore_owned.rs b/tokio/tests/sync_semaphore_owned.rs index f6945764786..05f59cf4d53 100644 --- a/tokio/tests/sync_semaphore_owned.rs +++ b/tokio/tests/sync_semaphore_owned.rs @@ -37,6 +37,7 @@ fn try_acquire_many() { #[tokio::test] #[cfg(feature = "full")] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn acquire() { let sem = Arc::new(Semaphore::new(1)); let p1 = sem.clone().try_acquire_owned().unwrap(); @@ -50,6 +51,7 @@ async fn acquire() { #[tokio::test] #[cfg(feature = "full")] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn acquire_many() { let semaphore = Arc::new(Semaphore::new(42)); let permit32 = semaphore.clone().try_acquire_many_owned(32).unwrap(); @@ -66,6 +68,7 @@ async fn acquire_many() { #[tokio::test] #[cfg(feature = "full")] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn add_permits() { let sem = Arc::new(Semaphore::new(0)); let sem_clone = sem.clone(); @@ -116,6 +119,7 @@ fn merge_unrelated_permits() { #[tokio::test] #[cfg(feature = "full")] +#[cfg_attr(miri, ignore)] // Miri doesn't support write to event (inside mio::waker::Waker::wake) async fn stress_test() { let sem = Arc::new(Semaphore::new(5)); let mut join_handles = Vec::new(); diff --git a/tokio/tests/task_abort.rs b/tokio/tests/task_abort.rs index 492f8b551a3..58d7a910a47 100644 --- a/tokio/tests/task_abort.rs +++ b/tokio/tests/task_abort.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support panic recovery +#![cfg(not(miri))] // Miri doesn't support epoll_wait use std::sync::Arc; use std::thread::sleep; diff --git a/tokio/tests/task_blocking.rs b/tokio/tests/task_blocking.rs index 2999758ff36..f7ed1aa7143 100644 --- a/tokio/tests/task_blocking.rs +++ b/tokio/tests/task_blocking.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support threads +#![cfg(not(miri))] // Miri doesn't support epoll_wait use tokio::{runtime, task, time}; use tokio_test::assert_ok; diff --git a/tokio/tests/task_join_set.rs b/tokio/tests/task_join_set.rs index b1b6cf9665f..19b7eb3b2a5 100644 --- a/tokio/tests/task_join_set.rs +++ b/tokio/tests/task_join_set.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full"))] +#![cfg(not(miri))] // Miri doesn't support write to event (inside mio::waker::Waker::wake) use tokio::sync::oneshot; use tokio::task::JoinSet; diff --git a/tokio/tests/task_local.rs b/tokio/tests/task_local.rs index 949a40c2a4d..874d1336311 100644 --- a/tokio/tests/task_local.rs +++ b/tokio/tests/task_local.rs @@ -1,5 +1,7 @@ #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support threads #![allow(clippy::declare_interior_mutable_const)] +#![cfg(not(miri))] // Miri doesn't support write to event (inside mio::waker::Waker::wake) + use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; diff --git a/tokio/tests/task_local_set.rs b/tokio/tests/task_local_set.rs index 2da87f5aed2..541a90c1af6 100644 --- a/tokio/tests/task_local_set.rs +++ b/tokio/tests/task_local_set.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] +#![cfg(not(miri))] // Miri doesn't support epoll_wait use futures::{ future::{pending, ready}, diff --git a/tokio/tests/tcp_accept.rs b/tokio/tests/tcp_accept.rs index ba4a498d1a5..38258c392c4 100644 --- a/tokio/tests/tcp_accept.rs +++ b/tokio/tests/tcp_accept.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support bind +#![cfg(not(miri))] // Miri doesn't support socket use tokio::net::{TcpListener, TcpStream}; use tokio::sync::{mpsc, oneshot}; diff --git a/tokio/tests/tcp_connect.rs b/tokio/tests/tcp_connect.rs index f2384420ed3..a49796d9606 100644 --- a/tokio/tests/tcp_connect.rs +++ b/tokio/tests/tcp_connect.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support bind +#![cfg(not(miri))] // Miri doesn't support socket use tokio::net::{TcpListener, TcpStream}; use tokio::sync::oneshot; diff --git a/tokio/tests/tcp_echo.rs b/tokio/tests/tcp_echo.rs index f47d4ac185a..36808fff2e2 100644 --- a/tokio/tests/tcp_echo.rs +++ b/tokio/tests/tcp_echo.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support bind +#![cfg(not(miri))] // Miri doesn't support socket use tokio::io::{self, AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpListener, TcpStream}; diff --git a/tokio/tests/tcp_into_split.rs b/tokio/tests/tcp_into_split.rs index 010984af8cc..b0352ea3ea6 100644 --- a/tokio/tests/tcp_into_split.rs +++ b/tokio/tests/tcp_into_split.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support bind +#![cfg(not(miri))] // Miri doesn't support socket use std::io::{Error, ErrorKind, Result}; use std::io::{Read, Write}; diff --git a/tokio/tests/tcp_into_std.rs b/tokio/tests/tcp_into_std.rs index 320d9946e81..6739becfdcb 100644 --- a/tokio/tests/tcp_into_std.rs +++ b/tokio/tests/tcp_into_std.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support bind +#![cfg(not(miri))] // Miri doesn't support socket use std::io::Read; use std::io::Result; diff --git a/tokio/tests/tcp_peek.rs b/tokio/tests/tcp_peek.rs index b7120232ca4..03265fb8b2f 100644 --- a/tokio/tests/tcp_peek.rs +++ b/tokio/tests/tcp_peek.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support bind +#![cfg(not(miri))] // Miri doesn't support socket use tokio::io::AsyncReadExt; use tokio::net::TcpStream; diff --git a/tokio/tests/tcp_shutdown.rs b/tokio/tests/tcp_shutdown.rs index 1d477f37c22..ec7ef1d7982 100644 --- a/tokio/tests/tcp_shutdown.rs +++ b/tokio/tests/tcp_shutdown.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support bind +#![cfg(not(miri))] // Miri doesn't support socket use tokio::io::{self, AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpListener, TcpStream}; diff --git a/tokio/tests/tcp_socket.rs b/tokio/tests/tcp_socket.rs index 66309d30411..c8f9b8a8596 100644 --- a/tokio/tests/tcp_socket.rs +++ b/tokio/tests/tcp_socket.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support bind +#![cfg(not(miri))] // Miri doesn't support socket use std::time::Duration; use tokio::net::TcpSocket; diff --git a/tokio/tests/tcp_split.rs b/tokio/tests/tcp_split.rs index 335b21f2940..f455ec73224 100644 --- a/tokio/tests/tcp_split.rs +++ b/tokio/tests/tcp_split.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support bind +#![cfg(not(miri))] // Miri doesn't support socket use std::io::Result; use std::io::{Read, Write}; diff --git a/tokio/tests/tcp_stream.rs b/tokio/tests/tcp_stream.rs index 31fe3baa296..a775bbbc85e 100644 --- a/tokio/tests/tcp_stream.rs +++ b/tokio/tests/tcp_stream.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support bind +#![cfg(not(miri))] // Miri doesn't support socket use tokio::io::{AsyncReadExt, AsyncWriteExt, Interest}; use tokio::net::{TcpListener, TcpStream}; diff --git a/tokio/tests/test_clock.rs b/tokio/tests/test_clock.rs index 891636fdb28..d3a0783a513 100644 --- a/tokio/tests/test_clock.rs +++ b/tokio/tests/test_clock.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] +#![cfg(not(miri))] // Miri doesn't support epoll_wait use tokio::time::{self, Duration, Instant}; diff --git a/tokio/tests/time_interval.rs b/tokio/tests/time_interval.rs index 186582e2e52..9ad8f6f2920 100644 --- a/tokio/tests/time_interval.rs +++ b/tokio/tests/time_interval.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] +#![cfg(not(miri))] // Miri doesn't support epoll_wait use tokio::time::{self, Duration, Instant, MissedTickBehavior}; use tokio_test::{assert_pending, assert_ready_eq, task}; diff --git a/tokio/tests/time_pause.rs b/tokio/tests/time_pause.rs index c772e387384..261c70299c1 100644 --- a/tokio/tests/time_pause.rs +++ b/tokio/tests/time_pause.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] +#![cfg(not(miri))] // Miri doesn't support write to event (inside mio::waker::Waker::wake) use rand::SeedableRng; use rand::{rngs::StdRng, Rng}; diff --git a/tokio/tests/time_rt.rs b/tokio/tests/time_rt.rs index 20f9e181b4b..d77ae8d037c 100644 --- a/tokio/tests/time_rt.rs +++ b/tokio/tests/time_rt.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] +#![cfg(not(miri))] // Miri doesn't support write to event (inside mio::waker::Waker::wake) use tokio::time::*; diff --git a/tokio/tests/time_sleep.rs b/tokio/tests/time_sleep.rs index 4174a73b1f6..e3ffc983521 100644 --- a/tokio/tests/time_sleep.rs +++ b/tokio/tests/time_sleep.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] +#![cfg(not(miri))] // Miri doesn't support write to event (inside mio::waker::Waker::wake) use std::future::Future; use std::task::Context; diff --git a/tokio/tests/time_timeout.rs b/tokio/tests/time_timeout.rs index be6b8fb4462..59a90303efb 100644 --- a/tokio/tests/time_timeout.rs +++ b/tokio/tests/time_timeout.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] +#![cfg(not(miri))] // Miri doesn't support epoll_wait use tokio::sync::oneshot; use tokio::time::{self, timeout, timeout_at, Instant}; diff --git a/tokio/tests/udp.rs b/tokio/tests/udp.rs index 2b6ab4d2ad2..0a9f9d1880c 100644 --- a/tokio/tests/udp.rs +++ b/tokio/tests/udp.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support bind or UDP +#![cfg(not(miri))] // Miri doesn't support socket use futures::future::poll_fn; use std::io; diff --git a/tokio/tests/uds_cred.rs b/tokio/tests/uds_cred.rs index c2b3914dfe7..786eb47211c 100644 --- a/tokio/tests/uds_cred.rs +++ b/tokio/tests/uds_cred.rs @@ -1,6 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(all(unix, not(target_os = "dragonfly")))] +#![cfg(not(miri))] // Miri doesn't support getsockopt use tokio::net::UnixStream; diff --git a/tokio/tests/uds_datagram.rs b/tokio/tests/uds_datagram.rs index c08bd450dc2..698594a537b 100644 --- a/tokio/tests/uds_datagram.rs +++ b/tokio/tests/uds_datagram.rs @@ -1,6 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] +#![cfg(not(miri))] // Miri doesn't support socket use futures::future::poll_fn; use tokio::io::ReadBuf; diff --git a/tokio/tests/uds_split.rs b/tokio/tests/uds_split.rs index 81614237eca..c00d19077c4 100644 --- a/tokio/tests/uds_split.rs +++ b/tokio/tests/uds_split.rs @@ -1,6 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] +#![cfg(not(miri))] // Miri doesn't support epoll_wait use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; use tokio::net::UnixStream; diff --git a/tokio/tests/uds_stream.rs b/tokio/tests/uds_stream.rs index b8c4e6a8eed..9ce81e3a2d8 100644 --- a/tokio/tests/uds_stream.rs +++ b/tokio/tests/uds_stream.rs @@ -1,6 +1,7 @@ #![cfg(feature = "full")] #![warn(rust_2018_idioms)] #![cfg(unix)] +#![cfg(not(miri))] // Miri doesn't support socket use std::io; use std::task::Poll;