diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6295d9c4..3a9d579e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,8 @@ env: # Change to specific Rust release to pin rust_stable: stable rust_nightly: nightly-2024-05-05 + # Pin a specific miri version + rust_miri_nightly: nightly-2024-09-19 rust_clippy: '1.77' # When updating this, also update: # - README.md @@ -413,17 +415,19 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Install Rust ${{ env.rust_nightly }} + - name: Install Rust ${{ env.rust_miri_nightly }} uses: dtolnay/rust-toolchain@stable with: - toolchain: ${{ env.rust_nightly }} + toolchain: ${{ env.rust_miri_nightly }} components: miri + - name: Install cargo-nextest + uses: taiki-e/install-action@v2 + with: + tool: cargo-nextest - uses: Swatinem/rust-cache@v2 - 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 + cargo miri nextest run --features full --lib --tests --no-fail-fast working-directory: tokio env: MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields diff --git a/tests-build/tests/macros.rs b/tests-build/tests/macros.rs index 0a180dfb7..8de08125d 100644 --- a/tests-build/tests/macros.rs +++ b/tests-build/tests/macros.rs @@ -1,4 +1,5 @@ #[test] +#[cfg_attr(miri, ignore)] fn compile_fail_full() { let t = trybuild::TestCases::new(); diff --git a/tests-integration/tests/process_stdio.rs b/tests-integration/tests/process_stdio.rs index df883ef76..a0c211a43 100644 --- a/tests-integration/tests/process_stdio.rs +++ b/tests-integration/tests/process_stdio.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] use tokio::io::{AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader}; use tokio::join; diff --git a/tokio-util/tests/spawn_pinned.rs b/tokio-util/tests/spawn_pinned.rs index e05b4095e..110fdab0a 100644 --- a/tokio-util/tests/spawn_pinned.rs +++ b/tokio-util/tests/spawn_pinned.rs @@ -1,5 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(not(target_os = "wasi"))] // Wasi doesn't support threads +// Blocked on https://github.com/rust-lang/miri/issues/3911 +#![cfg(not(miri))] use std::rc::Rc; use std::sync::Arc; diff --git a/tokio-util/tests/time_delay_queue.rs b/tokio-util/tests/time_delay_queue.rs index 9915b11b5..855b82dd4 100644 --- a/tokio-util/tests/time_delay_queue.rs +++ b/tokio-util/tests/time_delay_queue.rs @@ -92,6 +92,7 @@ async fn single_short_delay() { } #[tokio::test] +#[cfg_attr(miri, ignore)] // Too slow on miri. async fn multi_delay_at_start() { time::pause(); diff --git a/tokio-util/tests/udp.rs b/tokio-util/tests/udp.rs index 8a70289c2..6e31b3a53 100644 --- a/tokio-util/tests/udp.rs +++ b/tokio-util/tests/udp.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(not(target_os = "wasi"))] // Wasi doesn't support UDP +#![cfg(not(miri))] // No `socket` in Miri. use tokio::net::UdpSocket; use tokio_stream::StreamExt; diff --git a/tokio/tests/buffered.rs b/tokio/tests/buffered.rs index 27e75d10d..bb67255f5 100644 --- a/tokio/tests/buffered.rs +++ b/tokio/tests/buffered.rs @@ -9,6 +9,7 @@ use std::net::TcpStream; use std::thread; #[tokio::test] +#[cfg_attr(miri, ignore)] async fn echo_server() { const N: usize = 1024; diff --git a/tokio/tests/coop_budget.rs b/tokio/tests/coop_budget.rs index 0c4cc7e64..2400187d0 100644 --- a/tokio/tests/coop_budget.rs +++ b/tokio/tests/coop_budget.rs @@ -22,6 +22,7 @@ use tokio::net::UdpSocket; /// Since we are both sending and receiving, that should happen once per 64 packets, because budgets are of size 128 /// and there are two budget events per packet, a send and a recv. #[tokio::test] +#[cfg_attr(miri, ignore)] async fn coop_budget_udp_send_recv() { const BUDGET: usize = 128; const N_ITERATIONS: usize = 1024; diff --git a/tokio/tests/fs_copy.rs b/tokio/tests/fs_copy.rs index 3311710e9..4f8daadf2 100644 --- a/tokio/tests/fs_copy.rs +++ b/tokio/tests/fs_copy.rs @@ -5,6 +5,7 @@ use tempfile::tempdir; use tokio::fs; #[tokio::test] +#[cfg_attr(miri, ignore)] async fn copy() { let dir = tempdir().unwrap(); @@ -21,6 +22,7 @@ async fn copy() { } #[tokio::test] +#[cfg_attr(miri, ignore)] async fn copy_permissions() { let dir = tempdir().unwrap(); let from_path = dir.path().join("foo.txt"); diff --git a/tokio/tests/fs_file.rs b/tokio/tests/fs_file.rs index 520c4ec84..5eb43265e 100644 --- a/tokio/tests/fs_file.rs +++ b/tokio/tests/fs_file.rs @@ -203,6 +203,7 @@ async fn set_max_buf_size_write() { } #[tokio::test] +#[cfg_attr(miri, ignore)] #[cfg(unix)] async fn file_debug_fmt() { let tempfile = tempfile(); diff --git a/tokio/tests/fs_link.rs b/tokio/tests/fs_link.rs index 48da5f67d..36cd1fe0d 100644 --- a/tokio/tests/fs_link.rs +++ b/tokio/tests/fs_link.rs @@ -7,6 +7,7 @@ use std::io::Write; use tempfile::tempdir; #[tokio::test] +#[cfg_attr(miri, ignore)] async fn test_hard_link() { let dir = tempdir().unwrap(); let src = dir.path().join("src.txt"); diff --git a/tokio/tests/fs_try_exists.rs b/tokio/tests/fs_try_exists.rs index dca554dda..56d4bca18 100644 --- a/tokio/tests/fs_try_exists.rs +++ b/tokio/tests/fs_try_exists.rs @@ -5,6 +5,7 @@ use tempfile::tempdir; use tokio::fs; #[tokio::test] +#[cfg_attr(miri, ignore)] async fn try_exists() { let dir = tempdir().unwrap(); diff --git a/tokio/tests/io_async_fd.rs b/tokio/tests/io_async_fd.rs index 856ac6db1..469d2a4ac 100644 --- a/tokio/tests/io_async_fd.rs +++ b/tokio/tests/io_async_fd.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(unix, feature = "full"))] +#![cfg(all(unix, feature = "full", not(miri)))] use std::os::unix::io::{AsRawFd, RawFd}; use std::sync::{ @@ -655,6 +655,7 @@ fn send_oob_data(stream: &S, data: &[u8]) -> io::Result { } #[tokio::test] +#[cfg_attr(miri, ignore)] async fn clear_ready_matching_clears_ready() { use tokio::io::{Interest, Ready}; @@ -678,6 +679,7 @@ async fn clear_ready_matching_clears_ready() { } #[tokio::test] +#[cfg_attr(miri, ignore)] async fn clear_ready_matching_clears_ready_mut() { use tokio::io::{Interest, Ready}; @@ -702,6 +704,7 @@ async fn clear_ready_matching_clears_ready_mut() { #[tokio::test] #[cfg(target_os = "linux")] +#[cfg_attr(miri, ignore)] async fn await_error_readiness_timestamping() { use std::net::{Ipv4Addr, SocketAddr}; @@ -758,6 +761,7 @@ fn configure_timestamping_socket(udp_socket: &std::net::UdpSocket) -> std::io::R #[tokio::test] #[cfg(target_os = "linux")] +#[cfg_attr(miri, ignore)] async fn await_error_readiness_invalid_address() { use std::net::{Ipv4Addr, SocketAddr}; use tokio::io::{Interest, Ready}; diff --git a/tokio/tests/io_copy_bidirectional.rs b/tokio/tests/io_copy_bidirectional.rs index 3cdce32d0..44ba6ecdf 100644 --- a/tokio/tests/io_copy_bidirectional.rs +++ b/tokio/tests/io_copy_bidirectional.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support bind() +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi does not support bind() 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 2e2c84746..5fa1fd1da 100644 --- a/tokio/tests/io_driver.rs +++ b/tokio/tests/io_driver.rs @@ -1,6 +1,6 @@ #![warn(rust_2018_idioms)] // Wasi does not support panic recovery or threading -#![cfg(all(feature = "full", not(target_os = "wasi")))] +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] use tokio::net::TcpListener; use tokio::runtime; diff --git a/tokio/tests/io_driver_drop.rs b/tokio/tests/io_driver_drop.rs index c31826379..85c83c7ba 100644 --- a/tokio/tests/io_driver_drop.rs +++ b/tokio/tests/io_driver_drop.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support bind +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi does not support bind use tokio::net::TcpListener; use tokio::runtime; diff --git a/tokio/tests/io_read_to_end.rs b/tokio/tests/io_read_to_end.rs index 29b60bece..6573f8b68 100644 --- a/tokio/tests/io_read_to_end.rs +++ b/tokio/tests/io_read_to_end.rs @@ -79,6 +79,7 @@ async fn read_to_end_uninit() { } #[tokio::test] +#[cfg_attr(miri, ignore)] // too slow with miri async fn read_to_end_doesnt_grow_with_capacity() { let arr: Vec = (0..100).collect(); diff --git a/tokio/tests/io_repeat.rs b/tokio/tests/io_repeat.rs index b3745877c..5a48817b1 100644 --- a/tokio/tests/io_repeat.rs +++ b/tokio/tests/io_repeat.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(feature = "full")] +#![cfg(all(feature = "full", not(miri)))] use tokio::io::AsyncReadExt; diff --git a/tokio/tests/net_bind_resource.rs b/tokio/tests/net_bind_resource.rs index 05fd1604b..b29e09762 100644 --- a/tokio/tests/net_bind_resource.rs +++ b/tokio/tests/net_bind_resource.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support panic recovery or bind +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support panic recovery or bind use tokio::net::TcpListener; diff --git a/tokio/tests/net_lookup_host.rs b/tokio/tests/net_lookup_host.rs index 667030c7e..6adce83ec 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)] 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 9d6e87d9a..fc1777c0e 100644 --- a/tokio/tests/net_panic.rs +++ b/tokio/tests/net_panic.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] #![cfg(panic = "unwind")] use std::error::Error; diff --git a/tokio/tests/net_unix_pipe.rs b/tokio/tests/net_unix_pipe.rs index 37b8b41bd..c6d2ab342 100644 --- a/tokio/tests/net_unix_pipe.rs +++ b/tokio/tests/net_unix_pipe.rs @@ -1,5 +1,6 @@ #![cfg(feature = "full")] #![cfg(unix)] +#![cfg(not(miri))] use tokio::io::{AsyncReadExt, AsyncWriteExt, Interest}; use tokio::net::unix::pipe; diff --git a/tokio/tests/no_rt.rs b/tokio/tests/no_rt.rs index 89c7ce0aa..22cf17f6d 100644 --- a/tokio/tests/no_rt.rs +++ b/tokio/tests/no_rt.rs @@ -1,4 +1,4 @@ -#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support panic recovery +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi does not support panic recovery use tokio::net::TcpStream; use tokio::sync::oneshot; diff --git a/tokio/tests/process_arg0.rs b/tokio/tests/process_arg0.rs index 4fabea0fe..b966d4e76 100644 --- a/tokio/tests/process_arg0.rs +++ b/tokio/tests/process_arg0.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", unix))] +#![cfg(all(feature = "full", unix, not(miri)))] use tokio::process::Command; diff --git a/tokio/tests/process_change_of_runtime.rs b/tokio/tests/process_change_of_runtime.rs index 94efe35b1..968463fdd 100644 --- a/tokio/tests/process_change_of_runtime.rs +++ b/tokio/tests/process_change_of_runtime.rs @@ -3,7 +3,7 @@ // This tests test the behavior of `process::Command::spawn` when it is used // outside runtime, and when `process::Child::wait ` is used in a different // runtime from which `process::Command::spawn` is used. -#![cfg(all(unix, not(target_os = "freebsd")))] +#![cfg(all(unix, not(target_os = "freebsd"), not(miri)))] use std::process::Stdio; use tokio::{process::Command, runtime::Runtime}; diff --git a/tokio/tests/process_issue_2174.rs b/tokio/tests/process_issue_2174.rs index 2f8c73a58..7627a57db 100644 --- a/tokio/tests/process_issue_2174.rs +++ b/tokio/tests/process_issue_2174.rs @@ -7,7 +7,7 @@ // It is expected that `EVFILT_WRITE` would be returned with either the // `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(all(unix, not(target_os = "freebsd"), not(miri)))] 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 569c122e3..536feee34 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))] 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 d919b1a27..2f2e2b36d 100644 --- a/tokio/tests/process_kill_on_drop.rs +++ b/tokio/tests/process_kill_on_drop.rs @@ -1,4 +1,4 @@ -#![cfg(all(unix, feature = "process"))] +#![cfg(all(unix, feature = "process", not(miri)))] #![warn(rust_2018_idioms)] use std::io::ErrorKind; diff --git a/tokio/tests/process_raw_handle.rs b/tokio/tests/process_raw_handle.rs index fbe22b07c..8d08c7f74 100644 --- a/tokio/tests/process_raw_handle.rs +++ b/tokio/tests/process_raw_handle.rs @@ -1,6 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(windows)] +#![cfg(not(miri))] use tokio::process::Command; use windows_sys::Win32::System::Threading::GetProcessId; diff --git a/tokio/tests/process_smoke.rs b/tokio/tests/process_smoke.rs index 635b951a0..e7fec6d61 100644 --- a/tokio/tests/process_smoke.rs +++ b/tokio/tests/process_smoke.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi cannot run system commands +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi cannot run system commands use tokio::process::Command; use tokio_test::assert_ok; diff --git a/tokio/tests/rt_basic.rs b/tokio/tests/rt_basic.rs index 4c558c90e..f2ec0df9f 100644 --- a/tokio/tests/rt_basic.rs +++ b/tokio/tests/rt_basic.rs @@ -1,6 +1,7 @@ #![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] +#![cfg(not(miri))] // Possible bug on Miri. use tokio::runtime::Runtime; use tokio::sync::oneshot; diff --git a/tokio/tests/rt_common.rs b/tokio/tests/rt_common.rs index 12f9e1659..ecf283886 100644 --- a/tokio/tests/rt_common.rs +++ b/tokio/tests/rt_common.rs @@ -2,6 +2,7 @@ #![allow(clippy::needless_range_loop)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] +#![cfg(not(miri))] // 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 95365ec52..81656bd81 100644 --- a/tokio/tests/rt_handle_block_on.rs +++ b/tokio/tests/rt_handle_block_on.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(feature = "full")] +#![cfg(all(feature = "full", not(miri)))] // 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_threaded.rs b/tokio/tests/rt_threaded.rs index b6666616f..b32ab3195 100644 --- a/tokio/tests/rt_threaded.rs +++ b/tokio/tests/rt_threaded.rs @@ -1,6 +1,7 @@ #![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] +// Too slow on miri. +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpListener, TcpStream}; @@ -321,6 +322,8 @@ fn start_stop_callbacks_called() { } #[test] +// too slow on miri +#[cfg_attr(miri, ignore)] fn blocking() { // used for notifying the main thread const NUM: usize = 1_000; diff --git a/tokio/tests/signal_ctrl_c.rs b/tokio/tests/signal_ctrl_c.rs index 4b057ee7e..ebeee4d9e 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))] // No `sigaction` on Miri mod support { pub mod signal; diff --git a/tokio/tests/signal_drop_recv.rs b/tokio/tests/signal_drop_recv.rs index b0d9213e6..f1da899b0 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))] mod support { pub mod signal; diff --git a/tokio/tests/signal_drop_rt.rs b/tokio/tests/signal_drop_rt.rs index b931d7a90..24fd72865 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))] mod support { pub mod signal; diff --git a/tokio/tests/signal_drop_signal.rs b/tokio/tests/signal_drop_signal.rs index 92ac4050d..9eedd3f46 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))] mod support { pub mod signal; diff --git a/tokio/tests/signal_multi_rt.rs b/tokio/tests/signal_multi_rt.rs index 1e0402c47..ca0d76a6f 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))] // No `sigaction` on Miri. mod support { pub mod signal; diff --git a/tokio/tests/signal_no_rt.rs b/tokio/tests/signal_no_rt.rs index db284e165..c8e381da8 100644 --- a/tokio/tests/signal_no_rt.rs +++ b/tokio/tests/signal_no_rt.rs @@ -1,6 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] +#![cfg(not(miri))] // No `sigaction` on Miri. use tokio::signal::unix::{signal, SignalKind}; diff --git a/tokio/tests/signal_notify_both.rs b/tokio/tests/signal_notify_both.rs index 3481f808b..141cccfba 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))] // No `sigaction` on Miri. mod support { pub mod signal; diff --git a/tokio/tests/signal_panic.rs b/tokio/tests/signal_panic.rs index 6b662e54b..64c427d1f 100644 --- a/tokio/tests/signal_panic.rs +++ b/tokio/tests/signal_panic.rs @@ -2,6 +2,7 @@ #![cfg(feature = "full")] #![cfg(unix)] #![cfg(panic = "unwind")] +#![cfg(not(miri))] // No `sigaction` on Miri. use std::error::Error; use tokio::runtime::Builder; diff --git a/tokio/tests/signal_twice.rs b/tokio/tests/signal_twice.rs index 8f33d22a8..d74e897f4 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))] // No `sigaction` on Miri. mod support { pub mod signal; diff --git a/tokio/tests/signal_usr1.rs b/tokio/tests/signal_usr1.rs index d74c7d31a..853c72de4 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))] // No `sigaction` in Miri. mod support { pub mod signal; diff --git a/tokio/tests/sync_mpsc.rs b/tokio/tests/sync_mpsc.rs index 3d91c5cf3..638ced588 100644 --- a/tokio/tests/sync_mpsc.rs +++ b/tokio/tests/sync_mpsc.rs @@ -680,6 +680,7 @@ async fn try_reserve_many_on_closed_channel() { } #[maybe_tokio_test] +#[cfg_attr(miri, ignore)] // Too slow on miri. async fn try_reserve_many_full() { // Reserve n capacity and send k messages for n in 1..100 { diff --git a/tokio/tests/sync_mutex_owned.rs b/tokio/tests/sync_mutex_owned.rs index badcef3d0..d890c5327 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)] async fn aborted_future_1() { use std::time::Duration; use tokio::time::{interval, timeout}; diff --git a/tokio/tests/sync_rwlock.rs b/tokio/tests/sync_rwlock.rs index f711804ce..5a58b4971 100644 --- a/tokio/tests/sync_rwlock.rs +++ b/tokio/tests/sync_rwlock.rs @@ -173,6 +173,7 @@ async fn write_order() { // A single RwLock is contested by tasks in multiple threads #[cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support threads +#[cfg_attr(miri, ignore)] // Too slow on miri. #[tokio::test(flavor = "multi_thread", worker_threads = 8)] async fn multithreaded() { use futures::stream::{self, StreamExt}; diff --git a/tokio/tests/task_blocking.rs b/tokio/tests/task_blocking.rs index b9cce9a4a..b0e6e62ef 100644 --- a/tokio/tests/task_blocking.rs +++ b/tokio/tests/task_blocking.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support threads +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support threads use tokio::{runtime, task, time}; use tokio_test::assert_ok; diff --git a/tokio/tests/tcp_accept.rs b/tokio/tests/tcp_accept.rs index c72dcea39..99f5f5c2b 100644 --- a/tokio/tests/tcp_accept.rs +++ b/tokio/tests/tcp_accept.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind 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 269ba8ef6..2e9cf7229 100644 --- a/tokio/tests/tcp_connect.rs +++ b/tokio/tests/tcp_connect.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind use tokio::net::{TcpListener, TcpStream}; use tokio::sync::oneshot; diff --git a/tokio/tests/tcp_echo.rs b/tokio/tests/tcp_echo.rs index dfd4dd7b9..2ec1a1348 100644 --- a/tokio/tests/tcp_echo.rs +++ b/tokio/tests/tcp_echo.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind 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 df8efadb5..34f35ca92 100644 --- a/tokio/tests/tcp_into_split.rs +++ b/tokio/tests/tcp_into_split.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind 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 58996f75c..95a61525d 100644 --- a/tokio/tests/tcp_into_std.rs +++ b/tokio/tests/tcp_into_std.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind use std::io::Read; use std::io::Result; diff --git a/tokio/tests/tcp_peek.rs b/tokio/tests/tcp_peek.rs index b2d3eda09..2ebcb4188 100644 --- a/tokio/tests/tcp_peek.rs +++ b/tokio/tests/tcp_peek.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind use tokio::io::AsyncReadExt; use tokio::net::TcpStream; diff --git a/tokio/tests/tcp_shutdown.rs b/tokio/tests/tcp_shutdown.rs index 86c1485a4..d5a6488e7 100644 --- a/tokio/tests/tcp_shutdown.rs +++ b/tokio/tests/tcp_shutdown.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind 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 faead95c0..0abebb6cc 100644 --- a/tokio/tests/tcp_socket.rs +++ b/tokio/tests/tcp_socket.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind use std::time::Duration; use tokio::net::TcpSocket; diff --git a/tokio/tests/tcp_split.rs b/tokio/tests/tcp_split.rs index 32aaa1f77..4cbec846c 100644 --- a/tokio/tests/tcp_split.rs +++ b/tokio/tests/tcp_split.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind use std::io::Result; use std::io::{Read, Write}; diff --git a/tokio/tests/tcp_stream.rs b/tokio/tests/tcp_stream.rs index b06628f03..fd89ebeab 100644 --- a/tokio/tests/tcp_stream.rs +++ b/tokio/tests/tcp_stream.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind use tokio::io::{AsyncReadExt, AsyncWriteExt, Interest}; use tokio::net::{TcpListener, TcpStream}; diff --git a/tokio/tests/time_pause.rs b/tokio/tests/time_pause.rs index a14f7e22c..879d1b72a 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))] // Too slow on miri. use rand::SeedableRng; use rand::{rngs::StdRng, Rng}; diff --git a/tokio/tests/time_sleep.rs b/tokio/tests/time_sleep.rs index 6da7ada03..e1b5f4d29 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))] // Too slow on Miri. use std::future::Future; use std::task::Context; diff --git a/tokio/tests/udp.rs b/tokio/tests/udp.rs index 586ceb42e..d3d88b147 100644 --- a/tokio/tests/udp.rs +++ b/tokio/tests/udp.rs @@ -1,5 +1,5 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support bind or UDP +#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi does not support bind or UDP use std::future::poll_fn; use std::io; diff --git a/tokio/tests/uds_cred.rs b/tokio/tests/uds_cred.rs index c2b3914df..7facffaed 100644 --- a/tokio/tests/uds_cred.rs +++ b/tokio/tests/uds_cred.rs @@ -1,6 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] -#![cfg(all(unix, not(target_os = "dragonfly")))] +#![cfg(all(unix, not(target_os = "dragonfly"), not(miri)))] use tokio::net::UnixStream; diff --git a/tokio/tests/uds_datagram.rs b/tokio/tests/uds_datagram.rs index 126af1cac..9af7a8824 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))] use tokio::io::ReadBuf; use tokio::net::UnixDatagram; diff --git a/tokio/tests/uds_socket.rs b/tokio/tests/uds_socket.rs index 5261ffe5d..bc3e57b2b 100644 --- a/tokio/tests/uds_socket.rs +++ b/tokio/tests/uds_socket.rs @@ -1,6 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] +#![cfg(not(miri))] use futures::future::try_join; use std::io; diff --git a/tokio/tests/uds_split.rs b/tokio/tests/uds_split.rs index 81614237e..b6c2fa6f0 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))] 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 37e53aafc..392bbc0bb 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))] use std::io; #[cfg(target_os = "android")]