diff --git a/tokio-stream/tests/stream_chain.rs b/tokio-stream/tests/stream_chain.rs index 4b47ce7a905..bae0efb5d3e 100644 --- a/tokio-stream/tests/stream_chain.rs +++ b/tokio-stream/tests/stream_chain.rs @@ -49,6 +49,7 @@ where } #[tokio::test] +#[cfg_attr(miri, ignore)] // Block on https://github.com/tokio-rs/tokio/issues/6860 async fn pending_first() { let (tx1, rx1) = mpsc::unbounded_channel_stream(); let (tx2, rx2) = mpsc::unbounded_channel_stream(); diff --git a/tokio/tests/buffered.rs b/tokio/tests/buffered.rs index bb67255f57d..6e111801015 100644 --- a/tokio/tests/buffered.rs +++ b/tokio/tests/buffered.rs @@ -9,7 +9,7 @@ use std::net::TcpStream; use std::thread; #[tokio::test] -#[cfg_attr(miri, ignore)] +#[cfg_attr(miri, ignore)] // No `socket` on miri. async fn echo_server() { const N: usize = 1024; diff --git a/tokio/tests/coop_budget.rs b/tokio/tests/coop_budget.rs index 2400187d0d5..3aaf9db21d6 100644 --- a/tokio/tests/coop_budget.rs +++ b/tokio/tests/coop_budget.rs @@ -22,7 +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)] +#[cfg_attr(miri, ignore)] // No `socket` on miri. 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 4f8daadf269..fac64dccddc 100644 --- a/tokio/tests/fs_copy.rs +++ b/tokio/tests/fs_copy.rs @@ -5,7 +5,7 @@ use tempfile::tempdir; use tokio::fs; #[tokio::test] -#[cfg_attr(miri, ignore)] +#[cfg_attr(miri, ignore)] // No `fchmod` in miri. async fn copy() { let dir = tempdir().unwrap(); @@ -22,7 +22,7 @@ async fn copy() { } #[tokio::test] -#[cfg_attr(miri, ignore)] +#[cfg_attr(miri, ignore)] // No `fchmod` in miri. async fn copy_permissions() { let dir = tempdir().unwrap(); let from_path = dir.path().join("foo.txt"); diff --git a/tokio/tests/fs_link.rs b/tokio/tests/fs_link.rs index 36cd1fe0d05..4e6742a57f8 100644 --- a/tokio/tests/fs_link.rs +++ b/tokio/tests/fs_link.rs @@ -7,7 +7,7 @@ use std::io::Write; use tempfile::tempdir; #[tokio::test] -#[cfg_attr(miri, ignore)] +#[cfg_attr(miri, ignore)] // No `linkat` in miri. 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 56d4bca18a4..5c855341767 100644 --- a/tokio/tests/fs_try_exists.rs +++ b/tokio/tests/fs_try_exists.rs @@ -5,7 +5,7 @@ use tempfile::tempdir; use tokio::fs; #[tokio::test] -#[cfg_attr(miri, ignore)] +#[cfg_attr(miri, ignore)] // No `chmod` in miri. 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 469d2a4acbe..8bee2d5fa4e 100644 --- a/tokio/tests/io_async_fd.rs +++ b/tokio/tests/io_async_fd.rs @@ -616,6 +616,7 @@ fn driver_shutdown_wakes_poll_race() { #[tokio::test] #[cfg(any(target_os = "linux", target_os = "android"))] +#[cfg_attr(miri, ignore)] // No `socket` in miri. async fn priority_event_on_oob_data() { use std::net::SocketAddr; @@ -704,7 +705,7 @@ async fn clear_ready_matching_clears_ready_mut() { #[tokio::test] #[cfg(target_os = "linux")] -#[cfg_attr(miri, ignore)] +#[cfg_attr(miri, ignore)] // No `socket` in miri. async fn await_error_readiness_timestamping() { use std::net::{Ipv4Addr, SocketAddr}; @@ -761,7 +762,7 @@ fn configure_timestamping_socket(udp_socket: &std::net::UdpSocket) -> std::io::R #[tokio::test] #[cfg(target_os = "linux")] -#[cfg_attr(miri, ignore)] +#[cfg_attr(miri, ignore)] // No `socket` in miri. 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 44ba6ecdf40..8aa95106dfc 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"), not(miri)))] // Wasi does not support bind() +#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support bind() use std::time::Duration; use tokio::io::{self, copy_bidirectional, AsyncReadExt, AsyncWriteExt}; @@ -59,6 +59,7 @@ where } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` in miri. async fn test_basic_transfer() { symmetric(|_handle, mut a, mut b| async move { a.write_all(b"test").await.unwrap(); @@ -70,6 +71,7 @@ async fn test_basic_transfer() { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` in miri. async fn test_transfer_after_close() { symmetric(|handle, mut a, mut b| async move { AsyncWriteExt::shutdown(&mut a).await.unwrap(); @@ -89,6 +91,7 @@ async fn test_transfer_after_close() { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` in miri. async fn blocking_one_side_does_not_block_other() { symmetric(|handle, mut a, mut b| async move { block_write(&mut a).await; diff --git a/tokio/tests/io_driver.rs b/tokio/tests/io_driver.rs index 5fa1fd1da19..9f8915fb130 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"), not(miri)))] +#![cfg(all(feature = "full", not(target_os = "wasi")))] use tokio::net::TcpListener; use tokio::runtime; @@ -32,6 +32,7 @@ impl Task { } #[test] +#[cfg_attr(miri, ignore)] // No `socket` in miri. fn test_drop_on_notify() { // When the reactor receives a kernel notification, it notifies the // task that holds the associated socket. If this notification results in @@ -90,6 +91,7 @@ fn test_drop_on_notify() { #[should_panic( expected = "A Tokio 1.x context was found, but IO is disabled. Call `enable_io` on the runtime builder to enable IO." )] +#[cfg_attr(miri, ignore)] // No `socket` in miri. fn panics_when_io_disabled() { let rt = runtime::Builder::new_current_thread().build().unwrap(); diff --git a/tokio/tests/io_driver_drop.rs b/tokio/tests/io_driver_drop.rs index 85c83c7ba91..0bbd379a95b 100644 --- a/tokio/tests/io_driver_drop.rs +++ b/tokio/tests/io_driver_drop.rs @@ -1,11 +1,12 @@ #![warn(rust_2018_idioms)] -#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi does not support bind +#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support bind use tokio::net::TcpListener; use tokio::runtime; use tokio_test::{assert_err, assert_pending, assert_ready, task}; #[test] +#[cfg_attr(miri, ignore)] // No `socket` in miri. fn tcp_doesnt_block() { let rt = rt(); @@ -25,6 +26,7 @@ fn tcp_doesnt_block() { } #[test] +#[cfg_attr(miri, ignore)] // No `socket` in miri. fn drop_wakes() { let rt = rt(); diff --git a/tokio/tests/net_bind_resource.rs b/tokio/tests/net_bind_resource.rs index b29e0976255..236875515c9 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"), not(miri)))] // Wasi doesn't support panic recovery or bind +#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support panic recovery or bind use tokio::net::TcpListener; @@ -7,6 +7,7 @@ use std::net; #[test] #[should_panic] +#[cfg_attr(miri, ignore)] // No `socket` in miri. fn no_runtime_panics_binding_net_tcp_listener() { let listener = net::TcpListener::bind("127.0.0.1:0").expect("failed to bind listener"); let _ = TcpListener::try_from(listener); diff --git a/tokio/tests/net_lookup_host.rs b/tokio/tests/net_lookup_host.rs index 6adce83ecbb..48b4719adc1 100644 --- a/tokio/tests/net_lookup_host.rs +++ b/tokio/tests/net_lookup_host.rs @@ -23,7 +23,7 @@ async fn lookup_str_socket_addr() { } #[tokio::test] -#[cfg_attr(miri, ignore)] +#[cfg_attr(miri, ignore)] // No `getaddrinfo` in miri. 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 fc1777c0e79..ef42325ef6b 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"), not(miri)))] +#![cfg(all(feature = "full", not(target_os = "wasi")))] #![cfg(panic = "unwind")] use std::error::Error; @@ -12,6 +12,7 @@ mod support { use support::panic::test_panic; #[test] +#[cfg_attr(miri, ignore)] // No `socket` in miri. fn udp_socket_from_std_panic_caller() -> Result<(), Box> { use std::net::SocketAddr; use tokio::net::UdpSocket; @@ -34,6 +35,7 @@ fn udp_socket_from_std_panic_caller() -> Result<(), Box> { } #[test] +#[cfg_attr(miri, ignore)] // No `socket` in miri. fn tcp_listener_from_std_panic_caller() -> Result<(), Box> { let std_listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap(); std_listener.set_nonblocking(true).unwrap(); @@ -52,6 +54,7 @@ fn tcp_listener_from_std_panic_caller() -> Result<(), Box> { } #[test] +#[cfg_attr(miri, ignore)] // No `socket` in miri. fn tcp_stream_from_std_panic_caller() -> Result<(), Box> { let std_listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap(); @@ -73,6 +76,7 @@ fn tcp_stream_from_std_panic_caller() -> Result<(), Box> { #[test] #[cfg(unix)] +#[cfg_attr(miri, ignore)] // No `socket` in miri. fn unix_listener_bind_panic_caller() -> Result<(), Box> { use tokio::net::UnixListener; @@ -94,6 +98,7 @@ fn unix_listener_bind_panic_caller() -> Result<(), Box> { #[test] #[cfg(unix)] +#[cfg_attr(miri, ignore)] // No `socket` in miri. fn unix_listener_from_std_panic_caller() -> Result<(), Box> { use tokio::net::UnixListener; @@ -116,6 +121,7 @@ fn unix_listener_from_std_panic_caller() -> Result<(), Box> { #[test] #[cfg(unix)] +#[cfg_attr(miri, ignore)] // No `socket` in miri. fn unix_stream_from_std_panic_caller() -> Result<(), Box> { use tokio::net::UnixStream; @@ -139,6 +145,7 @@ fn unix_stream_from_std_panic_caller() -> Result<(), Box> { #[test] #[cfg(unix)] +#[cfg_attr(miri, ignore)] // No `socket` in miri. fn unix_datagram_from_std_panic_caller() -> Result<(), Box> { use std::os::unix::net::UnixDatagram as StdUDS; use tokio::net::UnixDatagram; diff --git a/tokio/tests/net_unix_pipe.rs b/tokio/tests/net_unix_pipe.rs index c6d2ab34203..a3a98542c56 100644 --- a/tokio/tests/net_unix_pipe.rs +++ b/tokio/tests/net_unix_pipe.rs @@ -1,6 +1,5 @@ #![cfg(feature = "full")] #![cfg(unix)] -#![cfg(not(miri))] use tokio::io::{AsyncReadExt, AsyncWriteExt, Interest}; use tokio::net::unix::pipe; @@ -38,6 +37,7 @@ impl AsRef for TempFifo { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `mkfifo` in miri. async fn fifo_simple_send() -> io::Result<()> { const DATA: &[u8] = b"this is some data to write to the fifo"; @@ -69,6 +69,7 @@ async fn fifo_simple_send() -> io::Result<()> { #[tokio::test] #[cfg(target_os = "linux")] +#[cfg_attr(miri, ignore)] // No `mkfifo` in miri. async fn fifo_simple_send_sender_first() -> io::Result<()> { const DATA: &[u8] = b"this is some data to write to the fifo"; @@ -105,6 +106,7 @@ async fn write_and_close(path: impl AsRef, msg: &[u8]) -> io::Result<()> { /// Checks EOF behavior with single reader and writers sequentially opening /// and closing a FIFO. #[tokio::test] +#[cfg_attr(miri, ignore)] // No `mkfifo` in miri. async fn fifo_multiple_writes() -> io::Result<()> { const DATA: &[u8] = b"this is some data to write to the fifo"; @@ -133,6 +135,7 @@ async fn fifo_multiple_writes() -> io::Result<()> { /// with writers sequentially opening and closing a FIFO. #[tokio::test] #[cfg(target_os = "linux")] +#[cfg_attr(miri, ignore)] // No `socket` in miri. async fn fifo_resilient_reader() -> io::Result<()> { const DATA: &[u8] = b"this is some data to write to the fifo"; @@ -163,6 +166,7 @@ async fn fifo_resilient_reader() -> io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `O_NONBLOCK` for open64 in miri. async fn open_detects_not_a_fifo() -> io::Result<()> { let dir = tempfile::Builder::new() .prefix("tokio-fifo-tests") @@ -185,6 +189,7 @@ async fn open_detects_not_a_fifo() -> io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `mkfifo` in miri. async fn from_file() -> io::Result<()> { const DATA: &[u8] = b"this is some data to write to the fifo"; @@ -221,6 +226,7 @@ async fn from_file() -> io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `fstat` in miri. async fn from_file_detects_not_a_fifo() -> io::Result<()> { let dir = tempfile::Builder::new() .prefix("tokio-fifo-tests") @@ -245,6 +251,7 @@ async fn from_file_detects_not_a_fifo() -> io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `mkfifo` in miri. async fn from_file_detects_wrong_access_mode() -> io::Result<()> { let fifo = TempFifo::new("wrong_access_mode")?; @@ -276,6 +283,7 @@ fn is_nonblocking(fd: &T) -> io::Result { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `mkfifo` in miri. async fn from_file_sets_nonblock() -> io::Result<()> { let fifo = TempFifo::new("sets_nonblock")?; @@ -303,6 +311,7 @@ fn writable_by_poll(writer: &pipe::Sender) -> bool { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `mkfifo` in miri. async fn try_read_write() -> io::Result<()> { const DATA: &[u8] = b"this is some data to write to the fifo"; @@ -343,6 +352,7 @@ async fn try_read_write() -> io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `mkfifo` in miri. async fn try_read_write_vectored() -> io::Result<()> { const DATA: &[u8] = b"this is some data to write to the fifo"; @@ -390,6 +400,7 @@ async fn try_read_write_vectored() -> io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `mkfifo` in miri. async fn try_read_buf() -> std::io::Result<()> { const DATA: &[u8] = b"this is some data to write to the fifo"; @@ -458,6 +469,7 @@ async fn anon_pipe_simple_send() -> io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri. async fn anon_pipe_spawn_echo() -> std::io::Result<()> { use tokio::process::Command; @@ -488,6 +500,7 @@ async fn anon_pipe_spawn_echo() -> std::io::Result<()> { #[tokio::test] #[cfg(target_os = "linux")] +#[cfg_attr(miri, ignore)] // No `fstat` in miri. async fn anon_pipe_from_owned_fd() -> std::io::Result<()> { use nix::fcntl::OFlag; @@ -507,6 +520,7 @@ async fn anon_pipe_from_owned_fd() -> std::io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri. async fn anon_pipe_into_nonblocking_fd() -> std::io::Result<()> { let (tx, rx) = pipe::pipe()?; @@ -520,6 +534,7 @@ async fn anon_pipe_into_nonblocking_fd() -> std::io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri. async fn anon_pipe_into_blocking_fd() -> std::io::Result<()> { let (tx, rx) = pipe::pipe()?; diff --git a/tokio/tests/no_rt.rs b/tokio/tests/no_rt.rs index 22cf17f6d4c..0730090857c 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"), not(miri)))] // Wasi does not support panic recovery +#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support panic recovery use tokio::net::TcpStream; use tokio::sync::oneshot; @@ -20,6 +20,7 @@ fn timeout_panics_when_no_tokio_context() { #[should_panic( expected = "there is no reactor running, must be called from the context of a Tokio 1.x runtime" )] +#[cfg_attr(miri, ignore)] // No `socket` in miri. fn panics_when_no_reactor() { let srv = TcpListener::bind("127.0.0.1:0").unwrap(); let addr = srv.local_addr().unwrap(); @@ -36,6 +37,7 @@ async fn timeout_value() { #[should_panic( expected = "there is no reactor running, must be called from the context of a Tokio 1.x runtime" )] +#[cfg_attr(miri, ignore)] // No `socket` in miri. fn io_panics_when_no_tokio_context() { let _ = tokio::net::TcpListener::from_std(std::net::TcpListener::bind("127.0.0.1:0").unwrap()); } diff --git a/tokio/tests/rt_common.rs b/tokio/tests/rt_common.rs index ecf283886e2..26a2adbadaf 100644 --- a/tokio/tests/rt_common.rs +++ b/tokio/tests/rt_common.rs @@ -542,6 +542,7 @@ rt_test! { } #[cfg(not(target_os="wasi"))] // Wasi does not support bind + #[cfg_attr(miri, ignore)] // No `socket` in miri. #[test] fn block_on_socket() { let rt = rt(); @@ -616,6 +617,7 @@ rt_test! { } #[cfg(not(target_os="wasi"))] // Wasi does not support bind + #[cfg_attr(miri, ignore)] // No `socket` in miri. #[test] fn socket_from_blocking() { let rt = rt(); @@ -686,6 +688,7 @@ rt_test! { // concern. There also isn't a great/obvious solution to take. For now, the // test is disabled. #[cfg(not(windows))] + #[cfg_attr(miri, ignore)] // No `socket` in miri. #[cfg(not(target_os="wasi"))] // Wasi does not support bind or threads fn io_driver_called_when_under_load() { let rt = rt(); @@ -740,6 +743,7 @@ rt_test! { /// spuriously. #[test] #[cfg(not(target_os="wasi"))] + #[cfg_attr(miri, ignore)] // No `socket` in miri. fn yield_defers_until_park() { for _ in 0..10 { if yield_defers_until_park_inner() { @@ -839,6 +843,7 @@ rt_test! { } #[cfg(not(target_os="wasi"))] // Wasi does not support threads + #[cfg_attr(miri, ignore)] // No `socket` in miri. #[test] fn client_server_block_on() { let rt = rt(); @@ -1004,6 +1009,7 @@ rt_test! { } #[cfg(not(target_os="wasi"))] // Wasi doesn't support UDP or bind() + #[cfg_attr(miri, ignore)] // No `socket` in miri. #[test] fn io_notify_while_shutting_down() { use tokio::net::UdpSocket; @@ -1135,6 +1141,7 @@ rt_test! { } #[cfg(not(target_os = "wasi"))] // Wasi does not support bind + #[cfg_attr(miri, ignore)] // No `socket` in miri. #[test] fn local_set_block_on_socket() { let rt = rt(); @@ -1157,6 +1164,7 @@ rt_test! { } #[cfg(not(target_os = "wasi"))] // Wasi does not support bind + #[cfg_attr(miri, ignore)] // No `socket` in miri. #[test] fn local_set_client_server_block_on() { let rt = rt(); diff --git a/tokio/tests/rt_handle_block_on.rs b/tokio/tests/rt_handle_block_on.rs index 81656bd8140..4037fb93c45 100644 --- a/tokio/tests/rt_handle_block_on.rs +++ b/tokio/tests/rt_handle_block_on.rs @@ -212,6 +212,7 @@ rt_test! { // ==== net ====== #[test] + #[cfg_attr(miri, ignore)] // No `socket` in miri. fn tcp_listener_bind() { let rt = rt(); let _enter = rt.enter(); @@ -262,6 +263,7 @@ rt_test! { } #[test] + #[cfg_attr(miri, ignore)] // No `socket` in miri. fn udp_socket_bind() { let rt = rt(); let _enter = rt.enter(); @@ -422,6 +424,7 @@ rt_test! { #[cfg(not(target_os = "wasi"))] multi_threaded_rt_test! { #[cfg(unix)] + #[cfg_attr(miri, ignore)] // No `socket` in miri. #[test] fn unix_listener_bind() { let rt = rt(); diff --git a/tokio/tests/rt_threaded.rs b/tokio/tests/rt_threaded.rs index b32ab3195ae..777b0d6a07c 100644 --- a/tokio/tests/rt_threaded.rs +++ b/tokio/tests/rt_threaded.rs @@ -189,6 +189,7 @@ fn lifo_slot_budget() { } #[test] +#[cfg_attr(miri, ignore)] // No `socket` in miri. fn spawn_shutdown() { let rt = rt(); let (tx, rx) = mpsc::channel(); diff --git a/tokio/tests/signal_drop_recv.rs b/tokio/tests/signal_drop_recv.rs index f1da899b040..40c76520321 100644 --- a/tokio/tests/signal_drop_recv.rs +++ b/tokio/tests/signal_drop_recv.rs @@ -1,7 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] -#![cfg(not(miri))] +#![cfg(not(miri))] // No `sigaction` in Miri. mod support { pub mod signal; diff --git a/tokio/tests/signal_drop_rt.rs b/tokio/tests/signal_drop_rt.rs index 24fd72865c0..3c909b2313d 100644 --- a/tokio/tests/signal_drop_rt.rs +++ b/tokio/tests/signal_drop_rt.rs @@ -1,7 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] -#![cfg(not(miri))] +#![cfg(not(miri))] // No `sigaction` in miri. mod support { pub mod signal; diff --git a/tokio/tests/signal_drop_signal.rs b/tokio/tests/signal_drop_signal.rs index 9eedd3f467e..6b4a3b63dd8 100644 --- a/tokio/tests/signal_drop_signal.rs +++ b/tokio/tests/signal_drop_signal.rs @@ -1,7 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] -#![cfg(not(miri))] +#![cfg(not(miri))] // No `sigaction` in miri. mod support { pub mod signal; diff --git a/tokio/tests/tcp_accept.rs b/tokio/tests/tcp_accept.rs index 99f5f5c2b22..766304778df 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(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind + // No `socket` on miri. 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 2e9cf722948..feaf703eded 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(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind + // No `socket` on miri. use tokio::net::{TcpListener, TcpStream}; use tokio::sync::oneshot; diff --git a/tokio/tests/tcp_echo.rs b/tokio/tests/tcp_echo.rs index 2ec1a134806..fcec280fbad 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(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind + // No socket on miri. 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 34f35ca9241..cc4b853026b 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(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind + // No `socket` on miri. 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 95a61525dd1..66d1a9cc612 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(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind + // No socket on `miri`. use std::io::Read; use std::io::Result; diff --git a/tokio/tests/tcp_peek.rs b/tokio/tests/tcp_peek.rs index 2ebcb418803..e633badb699 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(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind + // No `socket` on miri. use tokio::io::AsyncReadExt; use tokio::net::TcpStream; diff --git a/tokio/tests/tcp_shutdown.rs b/tokio/tests/tcp_shutdown.rs index d5a6488e783..2497c1a401d 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(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind + // No `socket` on miri. 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 0abebb6ccb2..c05dc1f5319 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(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind + // No `socket` on miri. use std::time::Duration; use tokio::net::TcpSocket; diff --git a/tokio/tests/tcp_split.rs b/tokio/tests/tcp_split.rs index 4cbec846cfa..1b0b8dedc4d 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(target_os = "wasi"), not(miri)))] // Wasi doesn't support bind + // No `socket` on miri. use std::io::Result; use std::io::{Read, Write}; diff --git a/tokio/tests/tcp_stream.rs b/tokio/tests/tcp_stream.rs index fd89ebeabd3..d557246046a 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"), not(miri)))] // Wasi doesn't support bind +#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support bind use tokio::io::{AsyncReadExt, AsyncWriteExt, Interest}; use tokio::net::{TcpListener, TcpStream}; @@ -13,6 +13,7 @@ use std::task::Poll; use std::time::Duration; #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` on miri. async fn set_linger() { let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); @@ -28,6 +29,7 @@ async fn set_linger() { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` on miri. async fn try_read_write() { const DATA: &[u8] = b"this is some data to write to the socket"; @@ -208,6 +210,7 @@ macro_rules! assert_not_writable_by_polling { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` on miri. async fn poll_read_ready() { let (mut client, mut server) = create_pair().await; @@ -231,6 +234,7 @@ async fn poll_read_ready() { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` on miri. async fn poll_write_ready() { let (mut client, server) = create_pair().await; @@ -284,6 +288,7 @@ fn write_until_pending(stream: &mut TcpStream) -> usize { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` on miri. async fn try_read_buf() { const DATA: &[u8] = b"this is some data to write to the socket"; @@ -363,6 +368,7 @@ async fn try_read_buf() { // read_closed is a best effort event, so test only for no false positives. #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` on miri. async fn read_closed() { let (client, mut server) = create_pair().await; @@ -378,6 +384,7 @@ async fn read_closed() { // write_closed is a best effort event, so test only for no false positives. #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` on miri. async fn write_closed() { let (mut client, mut server) = create_pair().await; diff --git a/tokio/tests/udp.rs b/tokio/tests/udp.rs index d3d88b147ef..f17a7c12e1a 100644 --- a/tokio/tests/udp.rs +++ b/tokio/tests/udp.rs @@ -1,5 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi does not support bind or UDP + // No `socket` on miri. use std::future::poll_fn; use std::io; diff --git a/tokio/tests/uds_cred.rs b/tokio/tests/uds_cred.rs index 7facffaed63..4f08d764e26 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"), not(miri)))] +#![cfg(all(unix, not(target_os = "dragonfly"), not(miri)))] // No `getsockopt` on miri. use tokio::net::UnixStream; diff --git a/tokio/tests/uds_datagram.rs b/tokio/tests/uds_datagram.rs index 9af7a8824ea..e9e0fa45b64 100644 --- a/tokio/tests/uds_datagram.rs +++ b/tokio/tests/uds_datagram.rs @@ -1,7 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] -#![cfg(not(miri))] use tokio::io::ReadBuf; use tokio::net::UnixDatagram; @@ -22,6 +21,7 @@ async fn echo_server(socket: UnixDatagram) -> io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` on miri. async fn echo() -> io::Result<()> { let dir = tempfile::tempdir().unwrap(); let server_path = dir.path().join("server.sock"); @@ -46,6 +46,7 @@ async fn echo() -> io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` on miri. async fn echo_from() -> io::Result<()> { let dir = tempfile::tempdir().unwrap(); let server_path = dir.path().join("server.sock"); @@ -72,6 +73,7 @@ async fn echo_from() -> io::Result<()> { // Even though we use sync non-blocking io we still need a reactor. #[tokio::test] +#[cfg_attr(miri, ignore)] // No SOCK_DGRAM for `socketpair` in miri. async fn try_send_recv_never_block() -> io::Result<()> { let mut recv_buf = [0u8; 16]; let payload = b"PAYLOAD"; @@ -117,6 +119,7 @@ async fn try_send_recv_never_block() -> io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` on miri. async fn split() -> std::io::Result<()> { let dir = tempfile::tempdir().unwrap(); let path = dir.path().join("split.sock"); @@ -141,6 +144,7 @@ async fn split() -> std::io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` on miri. async fn send_to_recv_from_poll() -> std::io::Result<()> { let dir = tempfile::tempdir().unwrap(); let sender_path = dir.path().join("sender.sock"); @@ -162,6 +166,7 @@ async fn send_to_recv_from_poll() -> std::io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` on miri. async fn send_recv_poll() -> std::io::Result<()> { let dir = tempfile::tempdir().unwrap(); let sender_path = dir.path().join("sender.sock"); @@ -185,6 +190,7 @@ async fn send_recv_poll() -> std::io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` on miri. async fn try_send_to_recv_from() -> std::io::Result<()> { let dir = tempfile::tempdir().unwrap(); let server_path = dir.path().join("server.sock"); @@ -232,6 +238,7 @@ async fn try_send_to_recv_from() -> std::io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` on miri. async fn try_recv_buf_from() -> std::io::Result<()> { let dir = tempfile::tempdir().unwrap(); let server_path = dir.path().join("server.sock"); @@ -279,6 +286,7 @@ async fn try_recv_buf_from() -> std::io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` on miri. async fn recv_buf_from() -> std::io::Result<()> { let tmp = tempfile::tempdir()?; @@ -302,6 +310,7 @@ async fn recv_buf_from() -> std::io::Result<()> { // Even though we use sync non-blocking io we still need a reactor. #[tokio::test] +#[cfg_attr(miri, ignore)] // No SOCK_DGRAM for `socketpair` in miri. async fn try_recv_buf_never_block() -> io::Result<()> { let payload = b"PAYLOAD"; let mut count = 0; @@ -349,6 +358,7 @@ async fn try_recv_buf_never_block() -> io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No SOCK_DGRAM for `socketpair` in miri. async fn recv_buf() -> std::io::Result<()> { // Create the pair of sockets let (sock1, sock2) = UnixDatagram::pair()?; @@ -367,6 +377,7 @@ async fn recv_buf() -> std::io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` on miri. async fn poll_ready() -> io::Result<()> { let dir = tempfile::tempdir().unwrap(); let server_path = dir.path().join("server.sock"); diff --git a/tokio/tests/uds_socket.rs b/tokio/tests/uds_socket.rs index bc3e57b2b21..10ecd0b5760 100644 --- a/tokio/tests/uds_socket.rs +++ b/tokio/tests/uds_socket.rs @@ -1,7 +1,6 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] -#![cfg(not(miri))] use futures::future::try_join; use std::io; @@ -11,6 +10,7 @@ use tokio::{ }; #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` in miri. async fn datagram_echo_server() -> io::Result<()> { let dir = tempfile::tempdir().unwrap(); let server_path = dir.path().join("server.sock"); @@ -52,6 +52,7 @@ async fn datagram_echo_server() -> io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` in miri. async fn listen_and_stream() -> std::io::Result<()> { let dir = tempfile::Builder::new().tempdir().unwrap(); let sock_path = dir.path().join("connect.sock"); @@ -91,6 +92,7 @@ async fn listen_and_stream() -> std::io::Result<()> { } #[tokio::test] +#[cfg_attr(miri, ignore)] // No `socket` in miri. async fn assert_usage() -> std::io::Result<()> { let datagram_socket = UnixSocket::new_datagram()?; let result = datagram_socket diff --git a/tokio/tests/uds_split.rs b/tokio/tests/uds_split.rs index b6c2fa6f016..4d4b07280ee 100644 --- a/tokio/tests/uds_split.rs +++ b/tokio/tests/uds_split.rs @@ -1,7 +1,7 @@ #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(unix)] -#![cfg(not(miri))] +#![cfg(not(miri))] // No `socket` in 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 392bbc0bb6c..275bb2649f9 100644 --- a/tokio/tests/uds_stream.rs +++ b/tokio/tests/uds_stream.rs @@ -1,7 +1,7 @@ #![cfg(feature = "full")] #![warn(rust_2018_idioms)] #![cfg(unix)] -#![cfg(not(miri))] +#![cfg(not(miri))] // No socket in miri. use std::io; #[cfg(target_os = "android")]