mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-08 00:00:13 +02:00
miri: add annotations for tests with miri ignore (#6981)
This commit is contained in:
@@ -18,7 +18,7 @@ env:
|
|||||||
rust_stable: stable
|
rust_stable: stable
|
||||||
rust_nightly: nightly-2024-05-05
|
rust_nightly: nightly-2024-05-05
|
||||||
# Pin a specific miri version
|
# Pin a specific miri version
|
||||||
rust_miri_nightly: nightly-2024-09-19
|
rust_miri_nightly: nightly-2024-10-21
|
||||||
rust_clippy: '1.77'
|
rust_clippy: '1.77'
|
||||||
# When updating this, also update:
|
# When updating this, also update:
|
||||||
# - README.md
|
# - README.md
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // Block on https://github.com/tokio-rs/tokio/issues/6860
|
||||||
async fn pending_first() {
|
async fn pending_first() {
|
||||||
let (tx1, rx1) = mpsc::unbounded_channel_stream();
|
let (tx1, rx1) = mpsc::unbounded_channel_stream();
|
||||||
let (tx2, rx2) = mpsc::unbounded_channel_stream();
|
let (tx2, rx2) = mpsc::unbounded_channel_stream();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use std::net::TcpStream;
|
|||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[cfg_attr(miri, ignore)]
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn echo_server() {
|
async fn echo_server() {
|
||||||
const N: usize = 1024;
|
const N: usize = 1024;
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
/// 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.
|
/// and there are two budget events per packet, a send and a recv.
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[cfg_attr(miri, ignore)]
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn coop_budget_udp_send_recv() {
|
async fn coop_budget_udp_send_recv() {
|
||||||
const BUDGET: usize = 128;
|
const BUDGET: usize = 128;
|
||||||
const N_ITERATIONS: usize = 1024;
|
const N_ITERATIONS: usize = 1024;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use tempfile::tempdir;
|
|||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[cfg_attr(miri, ignore)]
|
#[cfg_attr(miri, ignore)] // No `fchmod` in miri.
|
||||||
async fn copy() {
|
async fn copy() {
|
||||||
let dir = tempdir().unwrap();
|
let dir = tempdir().unwrap();
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ async fn copy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[cfg_attr(miri, ignore)]
|
#[cfg_attr(miri, ignore)] // No `fchmod` in miri.
|
||||||
async fn copy_permissions() {
|
async fn copy_permissions() {
|
||||||
let dir = tempdir().unwrap();
|
let dir = tempdir().unwrap();
|
||||||
let from_path = dir.path().join("foo.txt");
|
let from_path = dir.path().join("foo.txt");
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use std::io::Write;
|
|||||||
use tempfile::tempdir;
|
use tempfile::tempdir;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[cfg_attr(miri, ignore)]
|
#[cfg_attr(miri, ignore)] // No `linkat` in miri.
|
||||||
async fn test_hard_link() {
|
async fn test_hard_link() {
|
||||||
let dir = tempdir().unwrap();
|
let dir = tempdir().unwrap();
|
||||||
let src = dir.path().join("src.txt");
|
let src = dir.path().join("src.txt");
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use tempfile::tempdir;
|
|||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[cfg_attr(miri, ignore)]
|
#[cfg_attr(miri, ignore)] // No `chmod` in miri.
|
||||||
async fn try_exists() {
|
async fn try_exists() {
|
||||||
let dir = tempdir().unwrap();
|
let dir = tempdir().unwrap();
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![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 std::time::Duration;
|
||||||
use tokio::io::{self, copy_bidirectional, AsyncReadExt, AsyncWriteExt};
|
use tokio::io::{self, copy_bidirectional, AsyncReadExt, AsyncWriteExt};
|
||||||
@@ -59,6 +59,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
async fn test_basic_transfer() {
|
async fn test_basic_transfer() {
|
||||||
symmetric(|_handle, mut a, mut b| async move {
|
symmetric(|_handle, mut a, mut b| async move {
|
||||||
a.write_all(b"test").await.unwrap();
|
a.write_all(b"test").await.unwrap();
|
||||||
@@ -70,6 +71,7 @@ async fn test_basic_transfer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
async fn test_transfer_after_close() {
|
async fn test_transfer_after_close() {
|
||||||
symmetric(|handle, mut a, mut b| async move {
|
symmetric(|handle, mut a, mut b| async move {
|
||||||
AsyncWriteExt::shutdown(&mut a).await.unwrap();
|
AsyncWriteExt::shutdown(&mut a).await.unwrap();
|
||||||
@@ -89,6 +91,7 @@ async fn test_transfer_after_close() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
async fn blocking_one_side_does_not_block_other() {
|
async fn blocking_one_side_does_not_block_other() {
|
||||||
symmetric(|handle, mut a, mut b| async move {
|
symmetric(|handle, mut a, mut b| async move {
|
||||||
block_write(&mut a).await;
|
block_write(&mut a).await;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
// Wasi does not support panic recovery or threading
|
// 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::net::TcpListener;
|
||||||
use tokio::runtime;
|
use tokio::runtime;
|
||||||
@@ -32,6 +32,7 @@ impl<T> Task<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
fn test_drop_on_notify() {
|
fn test_drop_on_notify() {
|
||||||
// When the reactor receives a kernel notification, it notifies the
|
// When the reactor receives a kernel notification, it notifies the
|
||||||
// task that holds the associated socket. If this notification results in
|
// task that holds the associated socket. If this notification results in
|
||||||
@@ -90,6 +91,7 @@ fn test_drop_on_notify() {
|
|||||||
#[should_panic(
|
#[should_panic(
|
||||||
expected = "A Tokio 1.x context was found, but IO is disabled. Call `enable_io` on the runtime builder to enable IO."
|
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() {
|
fn panics_when_io_disabled() {
|
||||||
let rt = runtime::Builder::new_current_thread().build().unwrap();
|
let rt = runtime::Builder::new_current_thread().build().unwrap();
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![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::net::TcpListener;
|
||||||
use tokio::runtime;
|
use tokio::runtime;
|
||||||
use tokio_test::{assert_err, assert_pending, assert_ready, task};
|
use tokio_test::{assert_err, assert_pending, assert_ready, task};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
fn tcp_doesnt_block() {
|
fn tcp_doesnt_block() {
|
||||||
let rt = rt();
|
let rt = rt();
|
||||||
|
|
||||||
@@ -25,6 +26,7 @@ fn tcp_doesnt_block() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
fn drop_wakes() {
|
fn drop_wakes() {
|
||||||
let rt = rt();
|
let rt = rt();
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![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;
|
use tokio::net::TcpListener;
|
||||||
|
|
||||||
@@ -7,6 +7,7 @@ use std::net;
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
fn no_runtime_panics_binding_net_tcp_listener() {
|
fn no_runtime_panics_binding_net_tcp_listener() {
|
||||||
let listener = net::TcpListener::bind("127.0.0.1:0").expect("failed to bind listener");
|
let listener = net::TcpListener::bind("127.0.0.1:0").expect("failed to bind listener");
|
||||||
let _ = TcpListener::try_from(listener);
|
let _ = TcpListener::try_from(listener);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ async fn lookup_str_socket_addr() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[cfg_attr(miri, ignore)]
|
#[cfg_attr(miri, ignore)] // No `getaddrinfo` in miri.
|
||||||
async fn resolve_dns() -> io::Result<()> {
|
async fn resolve_dns() -> io::Result<()> {
|
||||||
let mut hosts = net::lookup_host("localhost:3000").await?;
|
let mut hosts = net::lookup_host("localhost:3000").await?;
|
||||||
let host = hosts.next().unwrap();
|
let host = hosts.next().unwrap();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![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")]
|
#![cfg(panic = "unwind")]
|
||||||
|
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
@@ -12,6 +12,7 @@ mod support {
|
|||||||
use support::panic::test_panic;
|
use support::panic::test_panic;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
fn udp_socket_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
fn udp_socket_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
use tokio::net::UdpSocket;
|
use tokio::net::UdpSocket;
|
||||||
@@ -34,6 +35,7 @@ fn udp_socket_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
fn tcp_listener_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
fn tcp_listener_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
||||||
let std_listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
|
let std_listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
|
||||||
std_listener.set_nonblocking(true).unwrap();
|
std_listener.set_nonblocking(true).unwrap();
|
||||||
@@ -52,6 +54,7 @@ fn tcp_listener_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
fn tcp_stream_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
fn tcp_stream_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
||||||
let std_listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
|
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<dyn Error>> {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
fn unix_listener_bind_panic_caller() -> Result<(), Box<dyn Error>> {
|
fn unix_listener_bind_panic_caller() -> Result<(), Box<dyn Error>> {
|
||||||
use tokio::net::UnixListener;
|
use tokio::net::UnixListener;
|
||||||
|
|
||||||
@@ -94,6 +98,7 @@ fn unix_listener_bind_panic_caller() -> Result<(), Box<dyn Error>> {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
fn unix_listener_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
fn unix_listener_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
||||||
use tokio::net::UnixListener;
|
use tokio::net::UnixListener;
|
||||||
|
|
||||||
@@ -116,6 +121,7 @@ fn unix_listener_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
fn unix_stream_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
fn unix_stream_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
||||||
use tokio::net::UnixStream;
|
use tokio::net::UnixStream;
|
||||||
|
|
||||||
@@ -139,6 +145,7 @@ fn unix_stream_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
fn unix_datagram_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
fn unix_datagram_from_std_panic_caller() -> Result<(), Box<dyn Error>> {
|
||||||
use std::os::unix::net::UnixDatagram as StdUDS;
|
use std::os::unix::net::UnixDatagram as StdUDS;
|
||||||
use tokio::net::UnixDatagram;
|
use tokio::net::UnixDatagram;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#![cfg(feature = "full")]
|
#![cfg(feature = "full")]
|
||||||
#![cfg(unix)]
|
#![cfg(unix)]
|
||||||
#![cfg(not(miri))]
|
|
||||||
|
|
||||||
use tokio::io::{AsyncReadExt, AsyncWriteExt, Interest};
|
use tokio::io::{AsyncReadExt, AsyncWriteExt, Interest};
|
||||||
use tokio::net::unix::pipe;
|
use tokio::net::unix::pipe;
|
||||||
@@ -38,6 +37,7 @@ impl AsRef<Path> for TempFifo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `mkfifo` in miri.
|
||||||
async fn fifo_simple_send() -> io::Result<()> {
|
async fn fifo_simple_send() -> io::Result<()> {
|
||||||
const DATA: &[u8] = b"this is some data to write to the fifo";
|
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]
|
#[tokio::test]
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `mkfifo` in miri.
|
||||||
async fn fifo_simple_send_sender_first() -> io::Result<()> {
|
async fn fifo_simple_send_sender_first() -> io::Result<()> {
|
||||||
const DATA: &[u8] = b"this is some data to write to the fifo";
|
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<Path>, msg: &[u8]) -> io::Result<()> {
|
|||||||
/// Checks EOF behavior with single reader and writers sequentially opening
|
/// Checks EOF behavior with single reader and writers sequentially opening
|
||||||
/// and closing a FIFO.
|
/// and closing a FIFO.
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `mkfifo` in miri.
|
||||||
async fn fifo_multiple_writes() -> io::Result<()> {
|
async fn fifo_multiple_writes() -> io::Result<()> {
|
||||||
const DATA: &[u8] = b"this is some data to write to the fifo";
|
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.
|
/// with writers sequentially opening and closing a FIFO.
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
async fn fifo_resilient_reader() -> io::Result<()> {
|
async fn fifo_resilient_reader() -> io::Result<()> {
|
||||||
const DATA: &[u8] = b"this is some data to write to the fifo";
|
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]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `O_NONBLOCK` for open64 in miri.
|
||||||
async fn open_detects_not_a_fifo() -> io::Result<()> {
|
async fn open_detects_not_a_fifo() -> io::Result<()> {
|
||||||
let dir = tempfile::Builder::new()
|
let dir = tempfile::Builder::new()
|
||||||
.prefix("tokio-fifo-tests")
|
.prefix("tokio-fifo-tests")
|
||||||
@@ -185,6 +189,7 @@ async fn open_detects_not_a_fifo() -> io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `mkfifo` in miri.
|
||||||
async fn from_file() -> io::Result<()> {
|
async fn from_file() -> io::Result<()> {
|
||||||
const DATA: &[u8] = b"this is some data to write to the fifo";
|
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]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `fstat` in miri.
|
||||||
async fn from_file_detects_not_a_fifo() -> io::Result<()> {
|
async fn from_file_detects_not_a_fifo() -> io::Result<()> {
|
||||||
let dir = tempfile::Builder::new()
|
let dir = tempfile::Builder::new()
|
||||||
.prefix("tokio-fifo-tests")
|
.prefix("tokio-fifo-tests")
|
||||||
@@ -245,6 +251,7 @@ async fn from_file_detects_not_a_fifo() -> io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `mkfifo` in miri.
|
||||||
async fn from_file_detects_wrong_access_mode() -> io::Result<()> {
|
async fn from_file_detects_wrong_access_mode() -> io::Result<()> {
|
||||||
let fifo = TempFifo::new("wrong_access_mode")?;
|
let fifo = TempFifo::new("wrong_access_mode")?;
|
||||||
|
|
||||||
@@ -276,6 +283,7 @@ fn is_nonblocking<T: AsRawFd>(fd: &T) -> io::Result<bool> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `mkfifo` in miri.
|
||||||
async fn from_file_sets_nonblock() -> io::Result<()> {
|
async fn from_file_sets_nonblock() -> io::Result<()> {
|
||||||
let fifo = TempFifo::new("sets_nonblock")?;
|
let fifo = TempFifo::new("sets_nonblock")?;
|
||||||
|
|
||||||
@@ -303,6 +311,7 @@ fn writable_by_poll(writer: &pipe::Sender) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `mkfifo` in miri.
|
||||||
async fn try_read_write() -> io::Result<()> {
|
async fn try_read_write() -> io::Result<()> {
|
||||||
const DATA: &[u8] = b"this is some data to write to the fifo";
|
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]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `mkfifo` in miri.
|
||||||
async fn try_read_write_vectored() -> io::Result<()> {
|
async fn try_read_write_vectored() -> io::Result<()> {
|
||||||
const DATA: &[u8] = b"this is some data to write to the fifo";
|
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]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `mkfifo` in miri.
|
||||||
async fn try_read_buf() -> std::io::Result<()> {
|
async fn try_read_buf() -> std::io::Result<()> {
|
||||||
const DATA: &[u8] = b"this is some data to write to the fifo";
|
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]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
|
||||||
async fn anon_pipe_spawn_echo() -> std::io::Result<()> {
|
async fn anon_pipe_spawn_echo() -> std::io::Result<()> {
|
||||||
use tokio::process::Command;
|
use tokio::process::Command;
|
||||||
|
|
||||||
@@ -488,6 +500,7 @@ async fn anon_pipe_spawn_echo() -> std::io::Result<()> {
|
|||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `fstat` in miri.
|
||||||
async fn anon_pipe_from_owned_fd() -> std::io::Result<()> {
|
async fn anon_pipe_from_owned_fd() -> std::io::Result<()> {
|
||||||
use nix::fcntl::OFlag;
|
use nix::fcntl::OFlag;
|
||||||
|
|
||||||
@@ -507,6 +520,7 @@ async fn anon_pipe_from_owned_fd() -> std::io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
|
||||||
async fn anon_pipe_into_nonblocking_fd() -> std::io::Result<()> {
|
async fn anon_pipe_into_nonblocking_fd() -> std::io::Result<()> {
|
||||||
let (tx, rx) = pipe::pipe()?;
|
let (tx, rx) = pipe::pipe()?;
|
||||||
|
|
||||||
@@ -520,6 +534,7 @@ async fn anon_pipe_into_nonblocking_fd() -> std::io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
|
||||||
async fn anon_pipe_into_blocking_fd() -> std::io::Result<()> {
|
async fn anon_pipe_into_blocking_fd() -> std::io::Result<()> {
|
||||||
let (tx, rx) = pipe::pipe()?;
|
let (tx, rx) = pipe::pipe()?;
|
||||||
|
|
||||||
|
|||||||
@@ -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::net::TcpStream;
|
||||||
use tokio::sync::oneshot;
|
use tokio::sync::oneshot;
|
||||||
@@ -20,6 +20,7 @@ fn timeout_panics_when_no_tokio_context() {
|
|||||||
#[should_panic(
|
#[should_panic(
|
||||||
expected = "there is no reactor running, must be called from the context of a Tokio 1.x runtime"
|
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() {
|
fn panics_when_no_reactor() {
|
||||||
let srv = TcpListener::bind("127.0.0.1:0").unwrap();
|
let srv = TcpListener::bind("127.0.0.1:0").unwrap();
|
||||||
let addr = srv.local_addr().unwrap();
|
let addr = srv.local_addr().unwrap();
|
||||||
@@ -36,6 +37,7 @@ async fn timeout_value() {
|
|||||||
#[should_panic(
|
#[should_panic(
|
||||||
expected = "there is no reactor running, must be called from the context of a Tokio 1.x runtime"
|
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() {
|
fn io_panics_when_no_tokio_context() {
|
||||||
let _ = tokio::net::TcpListener::from_std(std::net::TcpListener::bind("127.0.0.1:0").unwrap());
|
let _ = tokio::net::TcpListener::from_std(std::net::TcpListener::bind("127.0.0.1:0").unwrap());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -542,6 +542,7 @@ rt_test! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os="wasi"))] // Wasi does not support bind
|
#[cfg(not(target_os="wasi"))] // Wasi does not support bind
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
#[test]
|
#[test]
|
||||||
fn block_on_socket() {
|
fn block_on_socket() {
|
||||||
let rt = rt();
|
let rt = rt();
|
||||||
@@ -616,6 +617,7 @@ rt_test! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os="wasi"))] // Wasi does not support bind
|
#[cfg(not(target_os="wasi"))] // Wasi does not support bind
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
#[test]
|
#[test]
|
||||||
fn socket_from_blocking() {
|
fn socket_from_blocking() {
|
||||||
let rt = rt();
|
let rt = rt();
|
||||||
@@ -686,6 +688,7 @@ rt_test! {
|
|||||||
// concern. There also isn't a great/obvious solution to take. For now, the
|
// concern. There also isn't a great/obvious solution to take. For now, the
|
||||||
// test is disabled.
|
// test is disabled.
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
#[cfg(not(target_os="wasi"))] // Wasi does not support bind or threads
|
#[cfg(not(target_os="wasi"))] // Wasi does not support bind or threads
|
||||||
fn io_driver_called_when_under_load() {
|
fn io_driver_called_when_under_load() {
|
||||||
let rt = rt();
|
let rt = rt();
|
||||||
@@ -740,6 +743,7 @@ rt_test! {
|
|||||||
/// spuriously.
|
/// spuriously.
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(target_os="wasi"))]
|
#[cfg(not(target_os="wasi"))]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
fn yield_defers_until_park() {
|
fn yield_defers_until_park() {
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
if yield_defers_until_park_inner() {
|
if yield_defers_until_park_inner() {
|
||||||
@@ -839,6 +843,7 @@ rt_test! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os="wasi"))] // Wasi does not support threads
|
#[cfg(not(target_os="wasi"))] // Wasi does not support threads
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
#[test]
|
#[test]
|
||||||
fn client_server_block_on() {
|
fn client_server_block_on() {
|
||||||
let rt = rt();
|
let rt = rt();
|
||||||
@@ -1004,6 +1009,7 @@ rt_test! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os="wasi"))] // Wasi doesn't support UDP or bind()
|
#[cfg(not(target_os="wasi"))] // Wasi doesn't support UDP or bind()
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
#[test]
|
#[test]
|
||||||
fn io_notify_while_shutting_down() {
|
fn io_notify_while_shutting_down() {
|
||||||
use tokio::net::UdpSocket;
|
use tokio::net::UdpSocket;
|
||||||
@@ -1135,6 +1141,7 @@ rt_test! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "wasi"))] // Wasi does not support bind
|
#[cfg(not(target_os = "wasi"))] // Wasi does not support bind
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
#[test]
|
#[test]
|
||||||
fn local_set_block_on_socket() {
|
fn local_set_block_on_socket() {
|
||||||
let rt = rt();
|
let rt = rt();
|
||||||
@@ -1157,6 +1164,7 @@ rt_test! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "wasi"))] // Wasi does not support bind
|
#[cfg(not(target_os = "wasi"))] // Wasi does not support bind
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
#[test]
|
#[test]
|
||||||
fn local_set_client_server_block_on() {
|
fn local_set_client_server_block_on() {
|
||||||
let rt = rt();
|
let rt = rt();
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ rt_test! {
|
|||||||
// ==== net ======
|
// ==== net ======
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
fn tcp_listener_bind() {
|
fn tcp_listener_bind() {
|
||||||
let rt = rt();
|
let rt = rt();
|
||||||
let _enter = rt.enter();
|
let _enter = rt.enter();
|
||||||
@@ -262,6 +263,7 @@ rt_test! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
fn udp_socket_bind() {
|
fn udp_socket_bind() {
|
||||||
let rt = rt();
|
let rt = rt();
|
||||||
let _enter = rt.enter();
|
let _enter = rt.enter();
|
||||||
@@ -422,6 +424,7 @@ rt_test! {
|
|||||||
#[cfg(not(target_os = "wasi"))]
|
#[cfg(not(target_os = "wasi"))]
|
||||||
multi_threaded_rt_test! {
|
multi_threaded_rt_test! {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
#[test]
|
#[test]
|
||||||
fn unix_listener_bind() {
|
fn unix_listener_bind() {
|
||||||
let rt = rt();
|
let rt = rt();
|
||||||
|
|||||||
@@ -189,6 +189,7 @@ fn lifo_slot_budget() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
fn spawn_shutdown() {
|
fn spawn_shutdown() {
|
||||||
let rt = rt();
|
let rt = rt();
|
||||||
let (tx, rx) = mpsc::channel();
|
let (tx, rx) = mpsc::channel();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(feature = "full")]
|
#![cfg(feature = "full")]
|
||||||
#![cfg(unix)]
|
#![cfg(unix)]
|
||||||
#![cfg(not(miri))]
|
#![cfg(not(miri))] // No `sigaction` in Miri.
|
||||||
|
|
||||||
mod support {
|
mod support {
|
||||||
pub mod signal;
|
pub mod signal;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(feature = "full")]
|
#![cfg(feature = "full")]
|
||||||
#![cfg(unix)]
|
#![cfg(unix)]
|
||||||
#![cfg(not(miri))]
|
#![cfg(not(miri))] // No `sigaction` in miri.
|
||||||
|
|
||||||
mod support {
|
mod support {
|
||||||
pub mod signal;
|
pub mod signal;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(feature = "full")]
|
#![cfg(feature = "full")]
|
||||||
#![cfg(unix)]
|
#![cfg(unix)]
|
||||||
#![cfg(not(miri))]
|
#![cfg(not(miri))] // No `sigaction` in miri.
|
||||||
|
|
||||||
mod support {
|
mod support {
|
||||||
pub mod signal;
|
pub mod signal;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![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"), not(miri)))] // Wasi doesn't support bind
|
||||||
|
// No `socket` on miri.
|
||||||
|
|
||||||
use tokio::net::{TcpListener, TcpStream};
|
use tokio::net::{TcpListener, TcpStream};
|
||||||
use tokio::sync::{mpsc, oneshot};
|
use tokio::sync::{mpsc, oneshot};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![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"), not(miri)))] // Wasi doesn't support bind
|
||||||
|
// No `socket` on miri.
|
||||||
|
|
||||||
use tokio::net::{TcpListener, TcpStream};
|
use tokio::net::{TcpListener, TcpStream};
|
||||||
use tokio::sync::oneshot;
|
use tokio::sync::oneshot;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![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"), not(miri)))] // Wasi doesn't support bind
|
||||||
|
// No socket on miri.
|
||||||
|
|
||||||
use tokio::io::{self, AsyncReadExt, AsyncWriteExt};
|
use tokio::io::{self, AsyncReadExt, AsyncWriteExt};
|
||||||
use tokio::net::{TcpListener, TcpStream};
|
use tokio::net::{TcpListener, TcpStream};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![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"), not(miri)))] // Wasi doesn't support bind
|
||||||
|
// No `socket` on miri.
|
||||||
|
|
||||||
use std::io::{Error, ErrorKind, Result};
|
use std::io::{Error, ErrorKind, Result};
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![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"), not(miri)))] // Wasi doesn't support bind
|
||||||
|
// No socket on `miri`.
|
||||||
|
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::io::Result;
|
use std::io::Result;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![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"), not(miri)))] // Wasi doesn't support bind
|
||||||
|
// No `socket` on miri.
|
||||||
|
|
||||||
use tokio::io::AsyncReadExt;
|
use tokio::io::AsyncReadExt;
|
||||||
use tokio::net::TcpStream;
|
use tokio::net::TcpStream;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![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"), not(miri)))] // Wasi doesn't support bind
|
||||||
|
// No `socket` on miri.
|
||||||
|
|
||||||
use tokio::io::{self, AsyncReadExt, AsyncWriteExt};
|
use tokio::io::{self, AsyncReadExt, AsyncWriteExt};
|
||||||
use tokio::net::{TcpListener, TcpStream};
|
use tokio::net::{TcpListener, TcpStream};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![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"), not(miri)))] // Wasi doesn't support bind
|
||||||
|
// No `socket` on miri.
|
||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use tokio::net::TcpSocket;
|
use tokio::net::TcpSocket;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![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"), not(miri)))] // Wasi doesn't support bind
|
||||||
|
// No `socket` on miri.
|
||||||
|
|
||||||
use std::io::Result;
|
use std::io::Result;
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![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::io::{AsyncReadExt, AsyncWriteExt, Interest};
|
||||||
use tokio::net::{TcpListener, TcpStream};
|
use tokio::net::{TcpListener, TcpStream};
|
||||||
@@ -13,6 +13,7 @@ use std::task::Poll;
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn set_linger() {
|
async fn set_linger() {
|
||||||
let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();
|
let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();
|
||||||
|
|
||||||
@@ -28,6 +29,7 @@ async fn set_linger() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn try_read_write() {
|
async fn try_read_write() {
|
||||||
const DATA: &[u8] = b"this is some data to write to the socket";
|
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]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn poll_read_ready() {
|
async fn poll_read_ready() {
|
||||||
let (mut client, mut server) = create_pair().await;
|
let (mut client, mut server) = create_pair().await;
|
||||||
|
|
||||||
@@ -231,6 +234,7 @@ async fn poll_read_ready() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn poll_write_ready() {
|
async fn poll_write_ready() {
|
||||||
let (mut client, server) = create_pair().await;
|
let (mut client, server) = create_pair().await;
|
||||||
|
|
||||||
@@ -284,6 +288,7 @@ fn write_until_pending(stream: &mut TcpStream) -> usize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn try_read_buf() {
|
async fn try_read_buf() {
|
||||||
const DATA: &[u8] = b"this is some data to write to the socket";
|
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.
|
// read_closed is a best effort event, so test only for no false positives.
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn read_closed() {
|
async fn read_closed() {
|
||||||
let (client, mut server) = create_pair().await;
|
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.
|
// write_closed is a best effort event, so test only for no false positives.
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn write_closed() {
|
async fn write_closed() {
|
||||||
let (mut client, mut server) = create_pair().await;
|
let (mut client, mut server) = create_pair().await;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi does not support bind or UDP
|
#![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::future::poll_fn;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(feature = "full")]
|
#![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;
|
use tokio::net::UnixStream;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(feature = "full")]
|
#![cfg(feature = "full")]
|
||||||
#![cfg(unix)]
|
#![cfg(unix)]
|
||||||
#![cfg(not(miri))]
|
|
||||||
|
|
||||||
use tokio::io::ReadBuf;
|
use tokio::io::ReadBuf;
|
||||||
use tokio::net::UnixDatagram;
|
use tokio::net::UnixDatagram;
|
||||||
@@ -22,6 +21,7 @@ async fn echo_server(socket: UnixDatagram) -> io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn echo() -> io::Result<()> {
|
async fn echo() -> io::Result<()> {
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
let server_path = dir.path().join("server.sock");
|
let server_path = dir.path().join("server.sock");
|
||||||
@@ -46,6 +46,7 @@ async fn echo() -> io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn echo_from() -> io::Result<()> {
|
async fn echo_from() -> io::Result<()> {
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
let server_path = dir.path().join("server.sock");
|
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.
|
// Even though we use sync non-blocking io we still need a reactor.
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No SOCK_DGRAM for `socketpair` in miri.
|
||||||
async fn try_send_recv_never_block() -> io::Result<()> {
|
async fn try_send_recv_never_block() -> io::Result<()> {
|
||||||
let mut recv_buf = [0u8; 16];
|
let mut recv_buf = [0u8; 16];
|
||||||
let payload = b"PAYLOAD";
|
let payload = b"PAYLOAD";
|
||||||
@@ -117,6 +119,7 @@ async fn try_send_recv_never_block() -> io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn split() -> std::io::Result<()> {
|
async fn split() -> std::io::Result<()> {
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
let path = dir.path().join("split.sock");
|
let path = dir.path().join("split.sock");
|
||||||
@@ -141,6 +144,7 @@ async fn split() -> std::io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn send_to_recv_from_poll() -> std::io::Result<()> {
|
async fn send_to_recv_from_poll() -> std::io::Result<()> {
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
let sender_path = dir.path().join("sender.sock");
|
let sender_path = dir.path().join("sender.sock");
|
||||||
@@ -162,6 +166,7 @@ async fn send_to_recv_from_poll() -> std::io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn send_recv_poll() -> std::io::Result<()> {
|
async fn send_recv_poll() -> std::io::Result<()> {
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
let sender_path = dir.path().join("sender.sock");
|
let sender_path = dir.path().join("sender.sock");
|
||||||
@@ -185,6 +190,7 @@ async fn send_recv_poll() -> std::io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn try_send_to_recv_from() -> std::io::Result<()> {
|
async fn try_send_to_recv_from() -> std::io::Result<()> {
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
let server_path = dir.path().join("server.sock");
|
let server_path = dir.path().join("server.sock");
|
||||||
@@ -232,6 +238,7 @@ async fn try_send_to_recv_from() -> std::io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn try_recv_buf_from() -> std::io::Result<()> {
|
async fn try_recv_buf_from() -> std::io::Result<()> {
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
let server_path = dir.path().join("server.sock");
|
let server_path = dir.path().join("server.sock");
|
||||||
@@ -279,6 +286,7 @@ async fn try_recv_buf_from() -> std::io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn recv_buf_from() -> std::io::Result<()> {
|
async fn recv_buf_from() -> std::io::Result<()> {
|
||||||
let tmp = tempfile::tempdir()?;
|
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.
|
// Even though we use sync non-blocking io we still need a reactor.
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No SOCK_DGRAM for `socketpair` in miri.
|
||||||
async fn try_recv_buf_never_block() -> io::Result<()> {
|
async fn try_recv_buf_never_block() -> io::Result<()> {
|
||||||
let payload = b"PAYLOAD";
|
let payload = b"PAYLOAD";
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@@ -349,6 +358,7 @@ async fn try_recv_buf_never_block() -> io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No SOCK_DGRAM for `socketpair` in miri.
|
||||||
async fn recv_buf() -> std::io::Result<()> {
|
async fn recv_buf() -> std::io::Result<()> {
|
||||||
// Create the pair of sockets
|
// Create the pair of sockets
|
||||||
let (sock1, sock2) = UnixDatagram::pair()?;
|
let (sock1, sock2) = UnixDatagram::pair()?;
|
||||||
@@ -367,6 +377,7 @@ async fn recv_buf() -> std::io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` on miri.
|
||||||
async fn poll_ready() -> io::Result<()> {
|
async fn poll_ready() -> io::Result<()> {
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
let server_path = dir.path().join("server.sock");
|
let server_path = dir.path().join("server.sock");
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(feature = "full")]
|
#![cfg(feature = "full")]
|
||||||
#![cfg(unix)]
|
#![cfg(unix)]
|
||||||
#![cfg(not(miri))]
|
|
||||||
|
|
||||||
use futures::future::try_join;
|
use futures::future::try_join;
|
||||||
use std::io;
|
use std::io;
|
||||||
@@ -11,6 +10,7 @@ use tokio::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
async fn datagram_echo_server() -> io::Result<()> {
|
async fn datagram_echo_server() -> io::Result<()> {
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
let server_path = dir.path().join("server.sock");
|
let server_path = dir.path().join("server.sock");
|
||||||
@@ -52,6 +52,7 @@ async fn datagram_echo_server() -> io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
async fn listen_and_stream() -> std::io::Result<()> {
|
async fn listen_and_stream() -> std::io::Result<()> {
|
||||||
let dir = tempfile::Builder::new().tempdir().unwrap();
|
let dir = tempfile::Builder::new().tempdir().unwrap();
|
||||||
let sock_path = dir.path().join("connect.sock");
|
let sock_path = dir.path().join("connect.sock");
|
||||||
@@ -91,6 +92,7 @@ async fn listen_and_stream() -> std::io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[cfg_attr(miri, ignore)] // No `socket` in miri.
|
||||||
async fn assert_usage() -> std::io::Result<()> {
|
async fn assert_usage() -> std::io::Result<()> {
|
||||||
let datagram_socket = UnixSocket::new_datagram()?;
|
let datagram_socket = UnixSocket::new_datagram()?;
|
||||||
let result = datagram_socket
|
let result = datagram_socket
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(feature = "full")]
|
#![cfg(feature = "full")]
|
||||||
#![cfg(unix)]
|
#![cfg(unix)]
|
||||||
#![cfg(not(miri))]
|
#![cfg(not(miri))] // No `socket` in miri.
|
||||||
|
|
||||||
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
||||||
use tokio::net::UnixStream;
|
use tokio::net::UnixStream;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#![cfg(feature = "full")]
|
#![cfg(feature = "full")]
|
||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(unix)]
|
#![cfg(unix)]
|
||||||
#![cfg(not(miri))]
|
#![cfg(not(miri))] // No socket in miri.
|
||||||
|
|
||||||
use std::io;
|
use std::io;
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
|
|||||||
Reference in New Issue
Block a user