id
stringlengths
22
133
text
stringlengths
40
40.2k
arch
stringclasses
1 value
syntax
stringclasses
1 value
kind
stringclasses
4 values
repo
stringclasses
27 values
path
stringlengths
5
116
license
stringclasses
6 values
commit
stringlengths
40
40
source_host
stringclasses
1 value
category
stringclasses
16 values
source_url
stringlengths
85
196
line_start
int64
1
4.28k
line_end
int64
4
4.31k
tokio-rs/tokio:tokio/tests/io_async_fd.rs:11
let r_barrier = Arc::new(tokio::sync::Barrier::new(2)); let barrier_clone = r_barrier.clone(); let read_fut = tokio::spawn(async move { // Move waker onto this task first assert_pending!(poll!(futures::future::poll_fn(|cx| afd_a_2 .as_ref() .poll_read_ready(cx)))); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
0f296d2089ccbe9861ad78792326d393d1db1a48
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0f296d2089ccbe9861ad78792326d393d1db1a48/tokio/tests/io_async_fd.rs
401
460
tokio-rs/tokio:tokio/tests/io_async_fd.rs:12
let _ = tokio::join!(readable, read_fut); // Our original waker should _not_ be awoken (poll_read_ready retains only the last context) assert!(!waker.awoken()); // The writable side should not be awoken tokio::select! { _ = &mut write_fut => unreachable!(), _ = tokio::time::sleep(Durat...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
0f296d2089ccbe9861ad78792326d393d1db1a48
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0f296d2089ccbe9861ad78792326d393d1db1a48/tokio/tests/io_async_fd.rs
441
500
tokio-rs/tokio:tokio/tests/io_async_fd.rs:13
let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; let readable = assert_pending(afd_a.readable()); std::mem::drop(rt); // The future was initialized **before** dropping the rt assert_err!(futures::executor::block_on(readable)); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
0f296d2089ccbe9861ad78792326d393d1db1a48
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0f296d2089ccbe9861ad78792326d393d1db1a48/tokio/tests/io_async_fd.rs
481
540
tokio-rs/tokio:tokio/tests/io_async_fd.rs:14
let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; let _ = std::thread::spawn(move || std::mem::drop(rt)); // This may or may not return an error (but will be awoken) let _ = futures::executor::block_on(afd_a.readable()); // However retrying will always return an...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
0f296d2089ccbe9861ad78792326d393d1db1a48
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0f296d2089ccbe9861ad78792326d393d1db1a48/tokio/tests/io_async_fd.rs
521
580
tokio-rs/tokio:tokio/tests/io_async_fd.rs:15
assert_err!(futures::executor::block_on(readable)); assert_err!(futures::executor::block_on(writable)); } #[test] fn driver_shutdown_wakes_poll() { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; std::mem::drop(rt);...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
0f296d2089ccbe9861ad78792326d393d1db1a48
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0f296d2089ccbe9861ad78792326d393d1db1a48/tokio/tests/io_async_fd.rs
561
620
tokio-rs/tokio:tokio/tests/io_async_fd.rs:16
for _ in 0..100 { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; while afd_a.get_ref().write(&[0; 512]).is_ok() {} // make not writable let _ = std::thread::spawn(move || std::mem::d...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
0f296d2089ccbe9861ad78792326d393d1db1a48
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0f296d2089ccbe9861ad78792326d393d1db1a48/tokio/tests/io_async_fd.rs
601
660
tokio-rs/tokio:tokio/tests/io_async_fd.rs:17
} #[cfg(any(target_os = "linux", target_os = "android"))] fn send_oob_data<S: AsRawFd>(stream: &S, data: &[u8]) -> io::Result<usize> { unsafe { let res = libc::send( stream.as_raw_fd(), data.as_ptr().cast(), data.len(), libc::MSG_OOB, ); if re...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
0f296d2089ccbe9861ad78792326d393d1db1a48
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0f296d2089ccbe9861ad78792326d393d1db1a48/tokio/tests/io_async_fd.rs
641
700
tokio-rs/tokio:tokio/tests/io_async_fd.rs:18
} #[tokio::test] async fn clear_ready_matching_clears_ready_mut() { use tokio::io::{Interest, Ready}; let (a, mut b) = socketpair(); let mut afd_a = AsyncFd::new(a).unwrap(); b.write_all(b"0").unwrap(); let mut guard = afd_a .ready_mut(Interest::READABLE | Interest::WRITABLE) .aw...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
0f296d2089ccbe9861ad78792326d393d1db1a48
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0f296d2089ccbe9861ad78792326d393d1db1a48/tokio/tests/io_async_fd.rs
681
740
tokio-rs/tokio:tokio/tests/io_async_fd.rs:19
configure_timestamping_socket(&socket).unwrap(); socket.connect(address_b).unwrap(); let fd = AsyncFd::new(socket).unwrap(); tokio::select! { _ = fd.ready(Interest::ERROR) => panic!(), _ = tokio::time::sleep(Duration::from_millis(10)) => {} } let buf = b"hello there"; fd.get_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
0f296d2089ccbe9861ad78792326d393d1db1a48
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0f296d2089ccbe9861ad78792326d393d1db1a48/tokio/tests/io_async_fd.rs
721
780
tokio-rs/tokio:tokio/tests/io_async_fd.rs:20
#[tokio::test] #[cfg(target_os = "linux")] async fn await_error_readiness_invalid_address() { use std::net::{Ipv4Addr, SocketAddr}; use tokio::io::{Interest, Ready}; let socket_addr = SocketAddr::from((Ipv4Addr::LOCALHOST, 0)); let socket = std::net::UdpSocket::bind(socket_addr).unwrap(); let socke...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
0f296d2089ccbe9861ad78792326d393d1db1a48
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0f296d2089ccbe9861ad78792326d393d1db1a48/tokio/tests/io_async_fd.rs
761
820
tokio-rs/tokio:tokio/tests/io_async_fd.rs:21
// Prepare the message data let message = "Hello, Socket!"; // Prepare the message structure for sendmsg let mut iov = libc::iovec { iov_base: message.as_ptr() as *mut libc::c_void, iov_len: message.len(), }; // Prepare the destination address for the se...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
0f296d2089ccbe9861ad78792326d393d1db1a48
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0f296d2089ccbe9861ad78792326d393d1db1a48/tokio/tests/io_async_fd.rs
801
829
tokio-rs/tokio:tokio/tests/io_async_fd.rs:15
assert_err!(futures::executor::block_on(readable)); assert_err!(futures::executor::block_on(writable)); } #[test] fn driver_shutdown_wakes_poll() { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; std::mem::drop(rt);...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
10e141d211526559190b97904508e3aee6c1fece
github
async-runtime
https://github.com/tokio-rs/tokio/blob/10e141d211526559190b97904508e3aee6c1fece/tokio/tests/io_async_fd.rs
561
620
tokio-rs/tokio:tokio/tests/io_async_fd.rs:16
} #[tokio::test] #[cfg(any(target_os = "linux", target_os = "android"))] async fn priority_event_on_oob_data() { use std::net::SocketAddr; use tokio::io::Interest; let addr: SocketAddr = "127.0.0.1:0".parse().unwrap(); let listener = std::net::TcpListener::bind(addr).unwrap(); let addr = listene...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
10e141d211526559190b97904508e3aee6c1fece
github
async-runtime
https://github.com/tokio-rs/tokio/blob/10e141d211526559190b97904508e3aee6c1fece/tokio/tests/io_async_fd.rs
601
660
tokio-rs/tokio:tokio/tests/io_async_fd.rs:17
} #[tokio::test] async fn clear_ready_matching_clears_ready() { use tokio::io::{Interest, Ready}; let (a, mut b) = socketpair(); let afd_a = AsyncFd::new(a).unwrap(); b.write_all(b"0").unwrap(); let mut guard = afd_a .ready(Interest::READABLE | Interest::WRITABLE) .await ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
10e141d211526559190b97904508e3aee6c1fece
github
async-runtime
https://github.com/tokio-rs/tokio/blob/10e141d211526559190b97904508e3aee6c1fece/tokio/tests/io_async_fd.rs
641
700
tokio-rs/tokio:tokio/tests/io_async_fd.rs:18
guard.clear_ready_matching(Ready::READABLE); assert_eq!(guard.ready(), Ready::WRITABLE); guard.clear_ready_matching(Ready::WRITABLE); assert_eq!(guard.ready(), Ready::EMPTY); } #[tokio::test] #[cfg(target_os = "linux")] async fn await_error_readiness_timestamping() { use std::net::{Ipv4Addr, SocketAdd...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
10e141d211526559190b97904508e3aee6c1fece
github
async-runtime
https://github.com/tokio-rs/tokio/blob/10e141d211526559190b97904508e3aee6c1fece/tokio/tests/io_async_fd.rs
681
740
tokio-rs/tokio:tokio/tests/io_async_fd.rs:19
} #[cfg(target_os = "linux")] fn configure_timestamping_socket(udp_socket: &std::net::UdpSocket) -> std::io::Result<libc::c_int> { // enable software timestamping, and specifically software send timestamping let options = libc::SOF_TIMESTAMPING_SOFTWARE | libc::SOF_TIMESTAMPING_TX_SOFTWARE; let res = unsa...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
10e141d211526559190b97904508e3aee6c1fece
github
async-runtime
https://github.com/tokio-rs/tokio/blob/10e141d211526559190b97904508e3aee6c1fece/tokio/tests/io_async_fd.rs
721
780
tokio-rs/tokio:tokio/tests/io_async_fd.rs:20
libc::SOL_IP, libc::IP_RECVERR, &recv_err as *const _ as *const libc::c_void, std::mem::size_of_val(&recv_err) as libc::socklen_t, ); if res == -1 { panic!("{:?}", std::io::Error::last_os_error()); } } // Spawn a separate thread for sendin...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
10e141d211526559190b97904508e3aee6c1fece
github
async-runtime
https://github.com/tokio-rs/tokio/blob/10e141d211526559190b97904508e3aee6c1fece/tokio/tests/io_async_fd.rs
761
812
tokio-rs/tokio:tokio/tests/io_async_fd.rs:21
msg.msg_iovlen = 1; if unsafe { libc::sendmsg(socket_fd, &msg, 0) } == -1 { Err(std::io::Error::last_os_error()).unwrap() } }); let fd = AsyncFd::new(socket).unwrap(); let guard = fd.ready(Interest::ERROR).await.unwrap(); assert_eq!(guard.ready(), Ready::ERROR); }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
10e141d211526559190b97904508e3aee6c1fece
github
async-runtime
https://github.com/tokio-rs/tokio/blob/10e141d211526559190b97904508e3aee6c1fece/tokio/tests/io_async_fd.rs
801
812
tokio-rs/tokio:tokio/tests/io_async_fd.rs:17
} #[tokio::test] async fn clear_ready_matching_clears_ready() { use tokio::io::{Interest, Ready}; let (a, mut b) = socketpair(); let afd_a = AsyncFd::new(a).unwrap(); b.write_all(b"0").unwrap(); let mut guard = afd_a .ready(Interest::READABLE | Interest::WRITABLE) .await ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
7b24b22901f8fc89c1b5f7989d4c2482cd4f288a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b24b22901f8fc89c1b5f7989d4c2482cd4f288a/tokio/tests/io_async_fd.rs
641
687
tokio-rs/tokio:tokio/tests/io_async_fd.rs:15
assert_err!(futures::executor::block_on(readable)); assert_err!(futures::executor::block_on(writable)); } #[test] fn driver_shutdown_wakes_poll() { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; std::mem::drop(rt);...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
7e474640dd803fd057e26b1aea302382711120af
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7e474640dd803fd057e26b1aea302382711120af/tokio/tests/io_async_fd.rs
561
601
tokio-rs/tokio:tokio/tests/io_async_fd.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(unix, feature = "full"))] use std::os::unix::io::{AsRawFd, RawFd}; use std::sync::{ atomic::{AtomicBool, Ordering}, Arc, }; use std::time::Duration; use std::{ future::Future, io::{self, ErrorKind, Read, Write}, task::{Context, Waker}, }; use nix::unistd::{clo...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
127983e5b4ac36e780fbdafddca1da349cdb6453
github
async-runtime
https://github.com/tokio-rs/tokio/blob/127983e5b4ac36e780fbdafddca1da349cdb6453/tokio/tests/io_async_fd.rs
1
60
tokio-rs/tokio:tokio/tests/io_async_fd.rs:4
nix::fcntl::fcntl(fd, F_SETFL(flags)).expect("fcntl(F_SETFD)"); } fn socketpair() -> (FileDescriptor, FileDescriptor) { use nix::sys::socket::{self, AddressFamily, SockFlag, SockType}; let (fd_a, fd_b) = socket::socketpair( AddressFamily::Unix, SockType::Stream, None, SockFlag:...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
127983e5b4ac36e780fbdafddca1da349cdb6453
github
async-runtime
https://github.com/tokio-rs/tokio/blob/127983e5b4ac36e780fbdafddca1da349cdb6453/tokio/tests/io_async_fd.rs
121
180
tokio-rs/tokio:tokio/tests/io_async_fd.rs:5
let afd_b = AsyncFd::new(b).unwrap(); afd_a.writable().await.unwrap().clear_ready(); afd_b.writable().await.unwrap().clear_ready(); futures::select_biased! { _ = tokio::time::sleep(Duration::from_millis(10)).fuse() => {}, _ = afd_a.readable().fuse() => panic!("Unexpected readable state"), ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
127983e5b4ac36e780fbdafddca1da349cdb6453
github
async-runtime
https://github.com/tokio-rs/tokio/blob/127983e5b4ac36e780fbdafddca1da349cdb6453/tokio/tests/io_async_fd.rs
161
220
tokio-rs/tokio:tokio/tests/io_async_fd.rs:6
guard.clear_ready(); let readable = afd_a.readable(); tokio::pin!(readable); tokio::select! { _ = readable.as_mut() => panic!(), _ = tokio::time::sleep(Duration::from_millis(10)) => {} } b.write_all(b"0").unwrap(); // We can observe the new readable event afd_a.readable()...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
127983e5b4ac36e780fbdafddca1da349cdb6453
github
async-runtime
https://github.com/tokio-rs/tokio/blob/127983e5b4ac36e780fbdafddca1da349cdb6453/tokio/tests/io_async_fd.rs
201
260
tokio-rs/tokio:tokio/tests/io_async_fd.rs:7
drain(&b); let _ = writable.await.unwrap(); } #[derive(Debug)] struct ArcFd<T>(Arc<T>); impl<T: AsRawFd> AsRawFd for ArcFd<T> { fn as_raw_fd(&self) -> RawFd { self.0.as_raw_fd() } } #[tokio::test] async fn drop_closes() { let (a, mut b) = socketpair(); let afd_a = AsyncFd::new(a).unwrap(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
127983e5b4ac36e780fbdafddca1da349cdb6453
github
async-runtime
https://github.com/tokio-rs/tokio/blob/127983e5b4ac36e780fbdafddca1da349cdb6453/tokio/tests/io_async_fd.rs
241
300
tokio-rs/tokio:tokio/tests/io_async_fd.rs:8
let (a, mut b) = socketpair(); let arc_fd = Arc::new(a); let afd_a = AsyncFd::new(ArcFd(arc_fd.clone())).unwrap(); std::mem::drop(afd_a); assert_eq!( ErrorKind::WouldBlock, b.read(&mut [0]).err().unwrap().kind() ); std::mem::drop(arc_fd); // suppress unnecessary clone clippy wa...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
127983e5b4ac36e780fbdafddca1da349cdb6453
github
async-runtime
https://github.com/tokio-rs/tokio/blob/127983e5b4ac36e780fbdafddca1da349cdb6453/tokio/tests/io_async_fd.rs
281
340
tokio-rs/tokio:tokio/tests/io_async_fd.rs:9
// Should clear the readable state let _ = guard.try_io(|_| io::Result::<()>::Err(ErrorKind::WouldBlock.into())); // Assert not readable let readable = afd_a.readable(); tokio::pin!(readable); tokio::select! { _ = readable.as_mut() => panic!(), _ = tokio::time::sleep(Duration::from...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
127983e5b4ac36e780fbdafddca1da349cdb6453
github
async-runtime
https://github.com/tokio-rs/tokio/blob/127983e5b4ac36e780fbdafddca1da349cdb6453/tokio/tests/io_async_fd.rs
321
380
tokio-rs/tokio:tokio/tests/io_async_fd.rs:10
_ = notify_barrier.fuse() => unreachable!(), } std::mem::drop(afd_a); }; tasks.push(tokio::spawn(f)); } let mut all_tasks = futures::future::try_join_all(tasks); tokio::select! { r = std::pin::Pin::new(&mut all_tasks) => { r.unwrap(); // propag...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
127983e5b4ac36e780fbdafddca1da349cdb6453
github
async-runtime
https://github.com/tokio-rs/tokio/blob/127983e5b4ac36e780fbdafddca1da349cdb6453/tokio/tests/io_async_fd.rs
361
420
tokio-rs/tokio:tokio/tests/io_async_fd.rs:11
let read_fut = tokio::spawn(async move { // Move waker onto this task first assert_pending!(poll!(futures::future::poll_fn(|cx| afd_a_2 .as_ref() .poll_read_ready(cx)))); barrier_clone.wait().await; let _ = futures::future::poll_fn(|cx| afd_a_2.as_ref().poll_read...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
127983e5b4ac36e780fbdafddca1da349cdb6453
github
async-runtime
https://github.com/tokio-rs/tokio/blob/127983e5b4ac36e780fbdafddca1da349cdb6453/tokio/tests/io_async_fd.rs
401
460
tokio-rs/tokio:tokio/tests/io_async_fd.rs:12
// Our original waker should _not_ be awoken (poll_read_ready retains only the last context) assert!(!waker.awoken()); // The writable side should not be awoken tokio::select! { _ = &mut write_fut => unreachable!(), _ = tokio::time::sleep(Duration::from_millis(5)) => {} } // Make i...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
127983e5b4ac36e780fbdafddca1da349cdb6453
github
async-runtime
https://github.com/tokio-rs/tokio/blob/127983e5b4ac36e780fbdafddca1da349cdb6453/tokio/tests/io_async_fd.rs
441
500
tokio-rs/tokio:tokio/tests/io_async_fd.rs:13
let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; let readable = assert_pending(afd_a.readable()); std::mem::drop(rt); // The future was initialized **before** dropping the rt assert_err!(futures::executor::block_on(readable)); // The future is initialized **after** dropping the r...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
127983e5b4ac36e780fbdafddca1da349cdb6453
github
async-runtime
https://github.com/tokio-rs/tokio/blob/127983e5b4ac36e780fbdafddca1da349cdb6453/tokio/tests/io_async_fd.rs
481
540
tokio-rs/tokio:tokio/tests/io_async_fd.rs:14
}; let _ = std::thread::spawn(move || std::mem::drop(rt)); // This may or may not return an error (but will be awoken) let _ = futures::executor::block_on(afd_a.readable()); // However retrying will always return an error assert_err!(futures::executor::block_on(afd_a.readable(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
127983e5b4ac36e780fbdafddca1da349cdb6453
github
async-runtime
https://github.com/tokio-rs/tokio/blob/127983e5b4ac36e780fbdafddca1da349cdb6453/tokio/tests/io_async_fd.rs
521
580
tokio-rs/tokio:tokio/tests/io_async_fd.rs:15
} #[test] fn driver_shutdown_wakes_poll() { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; std::mem::drop(rt); assert_err!(futures::executor::block_on(poll_readable(&afd_a))); assert_err!(futures::executor::bl...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
127983e5b4ac36e780fbdafddca1da349cdb6453
github
async-runtime
https://github.com/tokio-rs/tokio/blob/127983e5b4ac36e780fbdafddca1da349cdb6453/tokio/tests/io_async_fd.rs
561
599
tokio-rs/tokio:tokio/tests/io_async_fd.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(unix, feature = "full"))] use std::os::unix::io::{AsRawFd, RawFd}; use std::sync::{ atomic::{AtomicBool, Ordering}, Arc, }; use std::time::Duration; use std::{ future::Future, io::{self, ErrorKind, Read, Write}, task::{Context, Waker}, }; use nix::errno::Errno...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
564c943309f0a94474e2e71a115ec0bb45f3e7fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/564c943309f0a94474e2e71a115ec0bb45f3e7fd/tokio/tests/io_async_fd.rs
1
60
tokio-rs/tokio:tokio/tests/io_async_fd.rs:2
fn new() -> Self { let inner: Arc<TestWakerInner> = Default::default(); Self { inner: inner.clone(), waker: futures::task::waker(inner), } } fn awoken(&self) -> bool { self.inner.awoken.swap(false, Ordering::SeqCst) } fn context(&self) -> Contex...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
564c943309f0a94474e2e71a115ec0bb45f3e7fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/564c943309f0a94474e2e71a115ec0bb45f3e7fd/tokio/tests/io_async_fd.rs
41
100
tokio-rs/tokio:tokio/tests/io_async_fd.rs:3
} } impl Read for FileDescriptor { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { (self as &Self).read(buf) } } impl Write for &FileDescriptor { fn write(&mut self, buf: &[u8]) -> io::Result<usize> { match write(self.fd, buf) { Ok(n) => Ok(n), Err(e) if i...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
564c943309f0a94474e2e71a115ec0bb45f3e7fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/564c943309f0a94474e2e71a115ec0bb45f3e7fd/tokio/tests/io_async_fd.rs
81
140
tokio-rs/tokio:tokio/tests/io_async_fd.rs:4
use nix::fcntl::{OFlag, F_GETFL, F_SETFL}; let flags = nix::fcntl::fcntl(fd, F_GETFL).expect("fcntl(F_GETFD)"); if flags < 0 { panic!( "bad return value from fcntl(F_GETFL): {} ({:?})", flags, nix::Error::last() ); } let flags = OFlag::from_bits_tru...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
564c943309f0a94474e2e71a115ec0bb45f3e7fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/564c943309f0a94474e2e71a115ec0bb45f3e7fd/tokio/tests/io_async_fd.rs
121
180
tokio-rs/tokio:tokio/tests/io_async_fd.rs:5
Err(e) if e.kind() == ErrorKind::WouldBlock => break, Ok(0) => panic!("unexpected EOF"), Err(e) => panic!("unexpected error: {:?}", e), Ok(_) => continue, } } } #[tokio::test] async fn initially_writable() { let (a, b) = socketpair(); let afd_a = AsyncFd::new(a)...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
564c943309f0a94474e2e71a115ec0bb45f3e7fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/564c943309f0a94474e2e71a115ec0bb45f3e7fd/tokio/tests/io_async_fd.rs
161
220
tokio-rs/tokio:tokio/tests/io_async_fd.rs:6
let mut guard = readable.await.unwrap(); guard .try_io(|_| afd_a.get_ref().read(&mut [0])) .unwrap() .unwrap(); // `a` is not readable, but the reactor still thinks it is // (because we have not observed a not-ready error yet) afd_a.readable().await.unwrap().retain_ready(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
564c943309f0a94474e2e71a115ec0bb45f3e7fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/564c943309f0a94474e2e71a115ec0bb45f3e7fd/tokio/tests/io_async_fd.rs
201
260
tokio-rs/tokio:tokio/tests/io_async_fd.rs:7
.is_ok() {} // Writable state should be cleared now. let writable = afd_a.writable(); tokio::pin!(writable); tokio::select! { _ = writable.as_mut() => panic!(), _ = tokio::time::sleep(Duration::from_millis(10)) => {} } // Read from the other side; we should become writable...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
564c943309f0a94474e2e71a115ec0bb45f3e7fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/564c943309f0a94474e2e71a115ec0bb45f3e7fd/tokio/tests/io_async_fd.rs
241
300
tokio-rs/tokio:tokio/tests/io_async_fd.rs:8
// into_inner does not close the fd let (a, mut b) = socketpair(); let afd_a = AsyncFd::new(a).unwrap(); let _a: FileDescriptor = afd_a.into_inner(); assert_eq!( ErrorKind::WouldBlock, b.read(&mut [0]).err().unwrap().kind() ); // Drop closure behavior is delegated to the inner...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
564c943309f0a94474e2e71a115ec0bb45f3e7fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/564c943309f0a94474e2e71a115ec0bb45f3e7fd/tokio/tests/io_async_fd.rs
281
340
tokio-rs/tokio:tokio/tests/io_async_fd.rs:9
let afd_a = AsyncFd::new(a).unwrap(); let mut guard = afd_a.readable().await.unwrap(); afd_a.get_ref().read_exact(&mut [0]).unwrap(); // Should not clear the readable state let _ = guard.try_io(|_| Ok(())); // Still readable... let _ = afd_a.readable().await.unwrap(); // Should clear th...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
564c943309f0a94474e2e71a115ec0bb45f3e7fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/564c943309f0a94474e2e71a115ec0bb45f3e7fd/tokio/tests/io_async_fd.rs
321
380
tokio-rs/tokio:tokio/tests/io_async_fd.rs:10
let barrier = barrier.clone(); let f = async move { let notify_barrier = async { barrier.wait().await; futures::future::pending::<()>().await; }; futures::select_biased! { guard = afd_a.readable().fuse() => { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
564c943309f0a94474e2e71a115ec0bb45f3e7fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/564c943309f0a94474e2e71a115ec0bb45f3e7fd/tokio/tests/io_async_fd.rs
361
420
tokio-rs/tokio:tokio/tests/io_async_fd.rs:11
let afd_a = Arc::new(AsyncFd::new(a).unwrap()); let afd_b = Arc::new(AsyncFd::new(b).unwrap()); // Fill up the write side of A while afd_a.get_ref().write(&[0; 512]).is_ok() {} let waker = TestWaker::new(); assert_pending!(afd_a.as_ref().poll_read_ready(&mut waker.context())); let afd_a_2 = ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
564c943309f0a94474e2e71a115ec0bb45f3e7fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/564c943309f0a94474e2e71a115ec0bb45f3e7fd/tokio/tests/io_async_fd.rs
401
460
tokio-rs/tokio:tokio/tests/io_async_fd.rs:12
let readable = afd_a.readable(); tokio::pin!(readable); tokio::select! { _ = &mut readable => unreachable!(), _ = tokio::task::yield_now() => {} } // Make A readable. We expect that 'readable' and 'read_fut' will both complete quickly afd_b.get_ref().write_all(b"0").unwrap(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
564c943309f0a94474e2e71a115ec0bb45f3e7fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/564c943309f0a94474e2e71a115ec0bb45f3e7fd/tokio/tests/io_async_fd.rs
441
500
tokio-rs/tokio:tokio/tests/io_async_fd.rs:13
fn rt() -> tokio::runtime::Runtime { tokio::runtime::Builder::new_current_thread() .enable_all() .build() .unwrap() } #[test] fn driver_shutdown_wakes_currently_pending() { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
564c943309f0a94474e2e71a115ec0bb45f3e7fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/564c943309f0a94474e2e71a115ec0bb45f3e7fd/tokio/tests/io_async_fd.rs
481
540
tokio-rs/tokio:tokio/tests/io_async_fd.rs:14
assert_err!(futures::executor::block_on(afd_a.readable())); } #[test] fn driver_shutdown_wakes_pending_race() { // TODO: make this a loom test for _ in 0..100 { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unw...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
564c943309f0a94474e2e71a115ec0bb45f3e7fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/564c943309f0a94474e2e71a115ec0bb45f3e7fd/tokio/tests/io_async_fd.rs
521
580
tokio-rs/tokio:tokio/tests/io_async_fd.rs:15
AsyncFd::new(a).unwrap() }; while afd_a.get_ref().write(&[0; 512]).is_ok() {} // make not writable let readable = assert_pending(poll_readable(&afd_a)); let writable = assert_pending(poll_writable(&afd_a)); std::mem::drop(rt); // Attempting to poll readiness when the rt is dropped is an erro...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
564c943309f0a94474e2e71a115ec0bb45f3e7fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/564c943309f0a94474e2e71a115ec0bb45f3e7fd/tokio/tests/io_async_fd.rs
561
612
tokio-rs/tokio:tokio/tests/io_async_fd.rs:16
AsyncFd::new(a).unwrap() }; while afd_a.get_ref().write(&[0; 512]).is_ok() {} // make not writable let _ = std::thread::spawn(move || std::mem::drop(rt)); // The poll variants will always return an error in this case assert_err!(futures::executor::block_on(poll_readable(&afd_a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
564c943309f0a94474e2e71a115ec0bb45f3e7fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/564c943309f0a94474e2e71a115ec0bb45f3e7fd/tokio/tests/io_async_fd.rs
601
612
tokio-rs/tokio:tokio/tests/io_async_fd.rs:5
Err(e) if e.kind() == ErrorKind::WouldBlock => break, Ok(0) => panic!("unexpected EOF"), Err(e) => panic!("unexpected error: {:?}", e), Ok(_) => continue, } } } #[tokio::test] async fn initially_writable() { let (a, b) = socketpair(); let afd_a = AsyncFd::new(a)...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c7671a03840751f58b7a509386b8fe3b5e670a37
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c7671a03840751f58b7a509386b8fe3b5e670a37/tokio/tests/io_async_fd.rs
161
220
tokio-rs/tokio:tokio/tests/io_async_fd.rs:6
let mut guard = readable.await.unwrap(); guard.with_io(|_| afd_a.get_ref().read(&mut [0])).unwrap(); // `a` is not readable, but the reactor still thinks it is // (because we have not observed a not-ready error yet) afd_a.readable().await.unwrap().retain_ready(); // Explicitly clear the ready sta...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c7671a03840751f58b7a509386b8fe3b5e670a37
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c7671a03840751f58b7a509386b8fe3b5e670a37/tokio/tests/io_async_fd.rs
201
260
tokio-rs/tokio:tokio/tests/io_async_fd.rs:7
} // Writable state should be cleared now. let writable = afd_a.writable(); tokio::pin!(writable); tokio::select! { _ = writable.as_mut() => panic!(), _ = tokio::time::sleep(Duration::from_millis(10)) => {} } // Read from the other side; we should become writable now. drai...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c7671a03840751f58b7a509386b8fe3b5e670a37
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c7671a03840751f58b7a509386b8fe3b5e670a37/tokio/tests/io_async_fd.rs
241
300
tokio-rs/tokio:tokio/tests/io_async_fd.rs:8
// into_inner does not close the fd let (a, mut b) = socketpair(); let afd_a = AsyncFd::new(a).unwrap(); let _a: FileDescriptor = afd_a.into_inner(); assert_eq!( ErrorKind::WouldBlock, b.read(&mut [0]).err().unwrap().kind() ); // Drop closure behavior is delegated to the inner...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c7671a03840751f58b7a509386b8fe3b5e670a37
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c7671a03840751f58b7a509386b8fe3b5e670a37/tokio/tests/io_async_fd.rs
281
340
tokio-rs/tokio:tokio/tests/io_async_fd.rs:9
b.write_all(b"0").unwrap(); let afd_a = AsyncFd::new(a).unwrap(); let mut guard = afd_a.readable().await.unwrap(); afd_a.get_ref().read_exact(&mut [0]).unwrap(); // Should not clear the readable state let _ = guard.with_poll(|_| Poll::Ready(())); // Still readable... let _ = afd_a.reada...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c7671a03840751f58b7a509386b8fe3b5e670a37
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c7671a03840751f58b7a509386b8fe3b5e670a37/tokio/tests/io_async_fd.rs
321
380
tokio-rs/tokio:tokio/tests/io_async_fd.rs:10
let afd_a = afd_a.clone(); let barrier = barrier.clone(); let f = async move { let notify_barrier = async { barrier.wait().await; futures::future::pending::<()>().await; }; futures::select_biased! { guard = afd_a.reada...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c7671a03840751f58b7a509386b8fe3b5e670a37
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c7671a03840751f58b7a509386b8fe3b5e670a37/tokio/tests/io_async_fd.rs
361
420
tokio-rs/tokio:tokio/tests/io_async_fd.rs:11
let (a, b) = socketpair(); let afd_a = Arc::new(AsyncFd::new(a).unwrap()); let afd_b = Arc::new(AsyncFd::new(b).unwrap()); // Fill up the write side of A while afd_a.get_ref().write(&[0; 512]).is_ok() {} let waker = TestWaker::new(); assert_pending!(afd_a.as_ref().poll_read_ready(&mut waker.c...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c7671a03840751f58b7a509386b8fe3b5e670a37
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c7671a03840751f58b7a509386b8fe3b5e670a37/tokio/tests/io_async_fd.rs
401
460
tokio-rs/tokio:tokio/tests/io_async_fd.rs:12
w_barrier.wait().await; let readable = afd_a.readable(); tokio::pin!(readable); tokio::select! { _ = &mut readable => unreachable!(), _ = tokio::task::yield_now() => {} } // Make A readable. We expect that 'readable' and 'read_fut' will both complete quickly afd_b.get_ref().wr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c7671a03840751f58b7a509386b8fe3b5e670a37
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c7671a03840751f58b7a509386b8fe3b5e670a37/tokio/tests/io_async_fd.rs
441
500
tokio-rs/tokio:tokio/tests/io_async_fd.rs:14
assert_err!(futures::executor::block_on(afd_a.readable())); } #[test] fn driver_shutdown_wakes_pending_race() { // TODO: make this a loom test for _ in 0..100 { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unw...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c7671a03840751f58b7a509386b8fe3b5e670a37
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c7671a03840751f58b7a509386b8fe3b5e670a37/tokio/tests/io_async_fd.rs
521
580
tokio-rs/tokio:tokio/tests/io_async_fd.rs:15
let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; while afd_a.get_ref().write(&[0; 512]).is_ok() {} // make not writable let readable = assert_pending(poll_readable(&afd_a)); let writable = assert_pending(poll_writable(&afd_a)); std::mem::drop(rt); // Attempting to poll readiness ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c7671a03840751f58b7a509386b8fe3b5e670a37
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c7671a03840751f58b7a509386b8fe3b5e670a37/tokio/tests/io_async_fd.rs
561
613
tokio-rs/tokio:tokio/tests/io_async_fd.rs:16
let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; while afd_a.get_ref().write(&[0; 512]).is_ok() {} // make not writable let _ = std::thread::spawn(move || std::mem::drop(rt)); // The poll variants will always return an error in this case assert_err!(futures::ex...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c7671a03840751f58b7a509386b8fe3b5e670a37
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c7671a03840751f58b7a509386b8fe3b5e670a37/tokio/tests/io_async_fd.rs
601
613
tokio-rs/tokio:tokio/tests/io_async_fd.rs:5
Err(e) if e.kind() == ErrorKind::WouldBlock => break, Ok(0) => panic!("unexpected EOF"), Err(e) => panic!("unexpected error: {:?}", e), Ok(_) => continue, } } } #[tokio::test] async fn initially_writable() { let (a, b) = socketpair(); let afd_a = AsyncFd::new(a)...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
e1256d8ca4c510c8417874660e74760d87178445
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e1256d8ca4c510c8417874660e74760d87178445/tokio/tests/io_async_fd.rs
161
220
tokio-rs/tokio:tokio/tests/io_async_fd.rs:6
let mut guard = readable.await.unwrap(); guard.with_io(|| afd_a.get_ref().read(&mut [0])).unwrap(); // `a` is not readable, but the reactor still thinks it is // (because we have not observed a not-ready error yet) afd_a.readable().await.unwrap().retain_ready(); // Explicitly clear the ready stat...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
e1256d8ca4c510c8417874660e74760d87178445
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e1256d8ca4c510c8417874660e74760d87178445/tokio/tests/io_async_fd.rs
201
260
tokio-rs/tokio:tokio/tests/io_async_fd.rs:8
// into_inner does not close the fd let (a, mut b) = socketpair(); let afd_a = AsyncFd::new(a).unwrap(); let _a: FileDescriptor = afd_a.into_inner(); assert_eq!( ErrorKind::WouldBlock, b.read(&mut [0]).err().unwrap().kind() ); // Drop closure behavior is delegated to the inner...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
e1256d8ca4c510c8417874660e74760d87178445
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e1256d8ca4c510c8417874660e74760d87178445/tokio/tests/io_async_fd.rs
281
340
tokio-rs/tokio:tokio/tests/io_async_fd.rs:9
b.write_all(b"0").unwrap(); let afd_a = AsyncFd::new(a).unwrap(); let mut guard = afd_a.readable().await.unwrap(); afd_a.get_ref().read_exact(&mut [0]).unwrap(); // Should not clear the readable state let _ = guard.with_poll(|| Poll::Ready(())); // Still readable... let _ = afd_a.readab...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
e1256d8ca4c510c8417874660e74760d87178445
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e1256d8ca4c510c8417874660e74760d87178445/tokio/tests/io_async_fd.rs
321
380
tokio-rs/tokio:tokio/tests/io_async_fd.rs:13
fn rt() -> tokio::runtime::Runtime { tokio::runtime::Builder::new_current_thread() .enable_all() .build() .unwrap() } #[test] fn driver_shutdown_wakes_currently_pending() { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
a43ec09b55363374221aa3214fe0cec3d6712b6c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a43ec09b55363374221aa3214fe0cec3d6712b6c/tokio/tests/io_async_fd.rs
481
540
tokio-rs/tokio:tokio/tests/io_async_fd.rs:8
// into_inner does not close the fd let (a, mut b) = socketpair(); let afd_a = AsyncFd::new(a).unwrap(); let _a: FileDescriptor = afd_a.into_inner(); assert_eq!( ErrorKind::WouldBlock, b.read(&mut [0]).err().unwrap().kind() ); // Drop closure behavior is delegated to the inner...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c1539132110d3f8d20d22efb4b3f6a16fafd0e63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c1539132110d3f8d20d22efb4b3f6a16fafd0e63/tokio/tests/io_async_fd.rs
281
340
tokio-rs/tokio:tokio/tests/io_async_fd.rs:9
let _ = guard.with_poll(|| Poll::Ready(())); // Still readable... let _ = afd_a.readable().await.unwrap(); // Should clear the readable state let _ = guard.with_poll(|| Poll::Pending::<()>); // Assert not readable let readable = afd_a.readable(); tokio::pin!(readable); tokio::select!...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c1539132110d3f8d20d22efb4b3f6a16fafd0e63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c1539132110d3f8d20d22efb4b3f6a16fafd0e63/tokio/tests/io_async_fd.rs
321
380
tokio-rs/tokio:tokio/tests/io_async_fd.rs:10
futures::select_biased! { guard = afd_a.readable().fuse() => { tokio::task::yield_now().await; guard.unwrap().clear_ready() }, _ = notify_barrier.fuse() => unreachable!(), } std::mem::drop(afd_a); };...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c1539132110d3f8d20d22efb4b3f6a16fafd0e63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c1539132110d3f8d20d22efb4b3f6a16fafd0e63/tokio/tests/io_async_fd.rs
361
420
tokio-rs/tokio:tokio/tests/io_async_fd.rs:11
assert_pending!(afd_a.as_ref().poll_read_ready(&mut waker.context())); let afd_a_2 = afd_a.clone(); let r_barrier = Arc::new(tokio::sync::Barrier::new(2)); let barrier_clone = r_barrier.clone(); let read_fut = tokio::spawn(async move { // Move waker onto this task first assert_pending!...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c1539132110d3f8d20d22efb4b3f6a16fafd0e63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c1539132110d3f8d20d22efb4b3f6a16fafd0e63/tokio/tests/io_async_fd.rs
401
460
tokio-rs/tokio:tokio/tests/io_async_fd.rs:12
// Make A readable. We expect that 'readable' and 'read_fut' will both complete quickly afd_b.get_ref().write_all(b"0").unwrap(); let _ = tokio::join!(readable, read_fut); // Our original waker should _not_ be awoken (poll_read_ready retains only the last context) assert!(!waker.awoken()); // The...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c1539132110d3f8d20d22efb4b3f6a16fafd0e63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c1539132110d3f8d20d22efb4b3f6a16fafd0e63/tokio/tests/io_async_fd.rs
441
500
tokio-rs/tokio:tokio/tests/io_async_fd.rs:13
fn driver_shutdown_wakes_currently_pending() { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; let readable = assert_pending(afd_a.readable()); std::mem::drop(rt); // Being awoken by a rt drop does not return a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c1539132110d3f8d20d22efb4b3f6a16fafd0e63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c1539132110d3f8d20d22efb4b3f6a16fafd0e63/tokio/tests/io_async_fd.rs
481
540
tokio-rs/tokio:tokio/tests/io_async_fd.rs:14
let (a, _b) = socketpair(); let afd_a = { let _enter = rt.enter(); AsyncFd::new(a).unwrap() }; let _ = std::thread::spawn(move || std::mem::drop(rt)); // This may or may not return an error (but will be awoken) let _ = futures::executor::block_on(afd_a.r...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c1539132110d3f8d20d22efb4b3f6a16fafd0e63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c1539132110d3f8d20d22efb4b3f6a16fafd0e63/tokio/tests/io_async_fd.rs
521
580
tokio-rs/tokio:tokio/tests/io_async_fd.rs:15
std::mem::drop(rt); // Attempting to poll readiness when the rt is dropped is an error assert_err!(futures::executor::block_on(readable)); assert_err!(futures::executor::block_on(writable)); } #[test] fn driver_shutdown_wakes_poll() { let rt = rt(); let (a, _b) = socketpair(); let afd_a = { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd.rs
MIT
c1539132110d3f8d20d22efb4b3f6a16fafd0e63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c1539132110d3f8d20d22efb4b3f6a16fafd0e63/tokio/tests/io_async_fd.rs
561
604
tokio-rs/tokio:tokio/tests/io_async_fd_memory_leak.rs:1
//! Regression test for issue #7563 - Memory leak when fd closed before AsyncFd drop //! //! This test uses a custom global allocator to track actual memory usage, //! avoiding false positives from RSS measurements which include freed-but-retained memory. #![cfg(all(unix, target_os = "linux", feature = "full"))] use ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd_memory_leak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd_memory_leak.rs
1
60
tokio-rs/tokio:tokio/tests/io_async_fd_memory_leak.rs:2
// Subtract old size, add new size if new_size > layout.size() { self.allocated .fetch_add(new_size - layout.size(), Ordering::Relaxed); } else { self.allocated .fetch_sub(layout.size() - new_size, Ordering::Relaxed); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd_memory_leak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd_memory_leak.rs
41
100
tokio-rs/tokio:tokio/tests/io_async_fd_memory_leak.rs:3
impl AsRawFd for ArcFd { fn as_raw_fd(&self) -> RawFd { self.0.as_raw_fd() } } fn set_nonblocking(fd: &OwnedFd) { use nix::fcntl::{OFlag, F_GETFL, F_SETFL}; let flags = nix::fcntl::fcntl(fd, F_GETFL).expect("fcntl(F_GETFL)"); if flags < 0 { pani...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd_memory_leak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd_memory_leak.rs
81
140
tokio-rs/tokio:tokio/tests/io_async_fd_memory_leak.rs:4
let raw_fd = fd_a.as_raw_fd(); set_nonblocking(&fd_a); std::mem::forget(fd_a); let wrapper = Arc::new(RawFdWrapper { fd: raw_fd }); let async_fd = AsyncFd::new(ArcFd(wrapper)).unwrap(); // Close fd before dropping AsyncFd - this triggers the bug unsafe { lib...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd_memory_leak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd_memory_leak.rs
121
180
tokio-rs/tokio:tokio/tests/io_async_fd_memory_leak.rs:5
drop(async_fd); } tokio::task::yield_now().await; let after_phase2 = allocated_bytes(); // Phase 3: Run even more iterations for _ in 0..ITERATIONS { let (fd_a, _fd_b) = socket::socketpair( AddressFamily::Unix, SockType::Stream, None, SockFla...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd_memory_leak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd_memory_leak.rs
161
210
tokio-rs/tokio:tokio/tests/io_async_fd_memory_leak.rs:6
let threshold = 64 * 1024; // 64KB assert!( growth_phase2 < threshold || growth_phase3 < threshold, "Memory leak detected: allocations keep growing without stabilizing. \ Phase 1->2: +{growth_phase2} bytes, Phase 2->3: +{growth_phase3} bytes. \ (baseline: {baseline} bytes, phase2:...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd_memory_leak.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_fd_memory_leak.rs
201
210
tokio-rs/tokio:tokio/tests/io_async_fd_memory_leak.rs:2
// Subtract old size, add new size if new_size > layout.size() { self.allocated .fetch_add(new_size - layout.size(), Ordering::Relaxed); } else { self.allocated .fetch_sub(layout.size() - new_size, Ordering::Relaxed); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd_memory_leak.rs
MIT
1280cf81de55aef040b65b202dddb09713fd4f2b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1280cf81de55aef040b65b202dddb09713fd4f2b/tokio/tests/io_async_fd_memory_leak.rs
41
100
tokio-rs/tokio:tokio/tests/io_async_fd_memory_leak.rs:3
fn as_raw_fd(&self) -> RawFd { self.0.as_raw_fd() } } fn set_nonblocking(fd: RawFd) { use nix::fcntl::{OFlag, F_GETFL, F_SETFL}; let flags = nix::fcntl::fcntl(fd, F_GETFL).expect("fcntl(F_GETFL)"); if flags < 0 { panic!( "bad return valu...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd_memory_leak.rs
MIT
1280cf81de55aef040b65b202dddb09713fd4f2b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1280cf81de55aef040b65b202dddb09713fd4f2b/tokio/tests/io_async_fd_memory_leak.rs
81
140
tokio-rs/tokio:tokio/tests/io_async_fd_memory_leak.rs:4
let raw_fd = fd_a.as_raw_fd(); set_nonblocking(raw_fd); std::mem::forget(fd_a); let wrapper = Arc::new(RawFdWrapper { fd: raw_fd }); let async_fd = AsyncFd::new(ArcFd(wrapper)).unwrap(); // Close fd before dropping AsyncFd - this triggers the bug unsafe { li...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd_memory_leak.rs
MIT
1280cf81de55aef040b65b202dddb09713fd4f2b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1280cf81de55aef040b65b202dddb09713fd4f2b/tokio/tests/io_async_fd_memory_leak.rs
121
180
tokio-rs/tokio:tokio/tests/io_async_fd_memory_leak.rs:5
drop(async_fd); } tokio::task::yield_now().await; let after_phase2 = allocated_bytes(); // Phase 3: Run even more iterations for _ in 0..ITERATIONS { let (fd_a, _fd_b) = socket::socketpair( AddressFamily::Unix, SockType::Stream, None, SockFla...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_fd_memory_leak.rs
MIT
1280cf81de55aef040b65b202dddb09713fd4f2b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1280cf81de55aef040b65b202dddb09713fd4f2b/tokio/tests/io_async_fd_memory_leak.rs
161
209
tokio-rs/tokio:tokio/tests/io_async_read.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::io::AsyncRead; #[test] fn assert_obj_safe() { fn _assert<T>() {} _assert::<Box<dyn AsyncRead>>(); }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_read.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/io_async_read.rs
1
10
tokio-rs/tokio:tokio/tests/io_async_read.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::io::{AsyncRead, ReadBuf}; use tokio_test::task; use tokio_test::{assert_ready_err, assert_ready_ok}; use bytes::BytesMut; use std::io; use std::pin::Pin; use std::task::{Context, Poll}; #[test] fn assert_obj_safe() { fn _assert<T>() {} _assert::...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_read.rs
MIT
c393236dfd12c13e82badd631d3a3a90481c6f95
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c393236dfd12c13e82badd631d3a3a90481c6f95/tokio/tests/io_async_read.rs
1
60
tokio-rs/tokio:tokio/tests/io_async_read.rs:2
}); } #[test] fn read_buf_error() { struct Rd; impl AsyncRead for Rd { fn poll_read( self: Pin<&mut Self>, _cx: &mut Context<'_>, _buf: &mut ReadBuf<'_>, ) -> Poll<io::Result<()>> { let err = io::ErrorKind::Other.into(); Poll::Ready(E...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_read.rs
MIT
c393236dfd12c13e82badd631d3a3a90481c6f95
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c393236dfd12c13e82badd631d3a3a90481c6f95/tokio/tests/io_async_read.rs
41
100
tokio-rs/tokio:tokio/tests/io_async_read.rs:3
let mut buf = [0u8; 0]; task::spawn(Rd).enter(|cx, rd| { let n = assert_ready_ok!(rd.poll_read_buf(cx, &mut &mut buf[..])); assert_eq!(0, n); }); } #[test] fn read_buf_uninitialized_ok() { struct Rd; impl AsyncRead for Rd { fn poll_read( self: Pin<&mut Self>, ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_read.rs
MIT
c393236dfd12c13e82badd631d3a3a90481c6f95
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c393236dfd12c13e82badd631d3a3a90481c6f95/tokio/tests/io_async_read.rs
81
113
tokio-rs/tokio:tokio/tests/io_async_read.rs:1
#![allow(clippy::transmute_ptr_to_ptr)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::io::AsyncRead; use tokio_test::task; use tokio_test::{assert_ready_err, assert_ready_ok}; use bytes::{BufMut, BytesMut}; use std::io; use std::mem::MaybeUninit; use std::pin::Pin; use std::task::{Context, Poll}; #...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_read.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/tests/io_async_read.rs
1
60
tokio-rs/tokio:tokio/tests/io_async_read.rs:2
assert_eq!(11, n); assert_eq!(buf[..], b"hello world"[..]); }); } #[test] fn read_buf_error() { struct Rd; impl AsyncRead for Rd { fn poll_read( self: Pin<&mut Self>, _cx: &mut Context<'_>, _buf: &mut [u8], ) -> Poll<io::Result<usize>> { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_read.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/tests/io_async_read.rs
41
100
tokio-rs/tokio:tokio/tests/io_async_read.rs:3
} let mut buf = [0u8; 0]; task::spawn(Rd).enter(|cx, rd| { let n = assert_ready_ok!(rd.poll_read_buf(cx, &mut &mut buf[..])); assert_eq!(0, n); }); } #[test] fn read_buf_no_uninitialized() { struct Rd; impl AsyncRead for Rd { fn poll_read( self: Pin<&mut Self>...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_read.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/tests/io_async_read.rs
81
140
tokio-rs/tokio:tokio/tests/io_async_read.rs:4
impl AsyncRead for Rd { unsafe fn prepare_uninitialized_buffer(&self, _: &mut [MaybeUninit<u8>]) -> bool { false } fn poll_read( self: Pin<&mut Self>, _cx: &mut Context<'_>, buf: &mut [u8], ) -> Poll<io::Result<usize>> { assert...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_read.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/tests/io_async_read.rs
121
148
tokio-rs/tokio:tokio/tests/io_async_read.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::io::AsyncRead; use tokio_test::task; use tokio_test::{assert_ready_err, assert_ready_ok}; use bytes::{BufMut, BytesMut}; use std::io; use std::mem::MaybeUninit; use std::pin::Pin; use std::task::{Context, Poll}; #[test] fn assert_obj_safe() { fn _as...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_read.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/io_async_read.rs
1
60
tokio-rs/tokio:tokio/tests/io_async_read.rs:2
assert_eq!(buf[..], b"hello world"[..]); }); } #[test] fn read_buf_error() { struct Rd; impl AsyncRead for Rd { fn poll_read( self: Pin<&mut Self>, _cx: &mut Context<'_>, _buf: &mut [u8], ) -> Poll<io::Result<usize>> { let err = io::ErrorKind...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_read.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/io_async_read.rs
41
100
tokio-rs/tokio:tokio/tests/io_async_read.rs:3
let mut buf = [0u8; 0]; task::spawn(Rd).enter(|cx, rd| { let n = assert_ready_ok!(rd.poll_read_buf(cx, &mut &mut buf[..])); assert_eq!(0, n); }); } #[test] fn read_buf_no_uninitialized() { struct Rd; impl AsyncRead for Rd { fn poll_read( self: Pin<&mut Self>, ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_read.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/io_async_read.rs
81
140
tokio-rs/tokio:tokio/tests/io_async_read.rs:4
unsafe fn prepare_uninitialized_buffer(&self, _: &mut [MaybeUninit<u8>]) -> bool { false } fn poll_read( self: Pin<&mut Self>, _cx: &mut Context<'_>, buf: &mut [u8], ) -> Poll<io::Result<usize>> { assert_eq!(buf[0..11], b"hello world"[...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_read.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/io_async_read.rs
121
147
tokio-rs/tokio:tokio/tests/io_async_read.rs:1
use tokio::io::AsyncRead; use tokio_test::task; use tokio_test::{assert_ready_err, assert_ready_ok}; use bytes::{BufMut, BytesMut}; use std::io; use std::mem::MaybeUninit; use std::pin::Pin; use std::task::{Context, Poll}; #[test] fn assert_obj_safe() { fn _assert<T>() {} _assert::<Box<dyn AsyncRead>>(); } #...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_read.rs
MIT
5cd665afd7b70b184b559e6407fdf645983e1314
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5cd665afd7b70b184b559e6407fdf645983e1314/tokio/tests/io_async_read.rs
1
60
tokio-rs/tokio:tokio/tests/io_async_read.rs:2
#[test] fn read_buf_error() { struct Rd; impl AsyncRead for Rd { fn poll_read( self: Pin<&mut Self>, _cx: &mut Context<'_>, _buf: &mut [u8], ) -> Poll<io::Result<usize>> { let err = io::ErrorKind::Other.into(); Poll::Ready(Err(err)) ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_read.rs
MIT
5cd665afd7b70b184b559e6407fdf645983e1314
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5cd665afd7b70b184b559e6407fdf645983e1314/tokio/tests/io_async_read.rs
41
100
tokio-rs/tokio:tokio/tests/io_async_read.rs:3
task::spawn(Rd).enter(|cx, rd| { let n = assert_ready_ok!(rd.poll_read_buf(cx, &mut &mut buf[..])); assert_eq!(0, n); }); } #[test] fn read_buf_no_uninitialized() { struct Rd; impl AsyncRead for Rd { fn poll_read( self: Pin<&mut Self>, _cx: &mut Context<'_>,...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_read.rs
MIT
5cd665afd7b70b184b559e6407fdf645983e1314
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5cd665afd7b70b184b559e6407fdf645983e1314/tokio/tests/io_async_read.rs
81
140
tokio-rs/tokio:tokio/tests/io_async_read.rs:4
fn poll_read( self: Pin<&mut Self>, _cx: &mut Context<'_>, buf: &mut [u8], ) -> Poll<io::Result<usize>> { assert_eq!(buf[0..11], b"hello world"[..]); Poll::Ready(Ok(0)) } } // Can't create BytesMut w/ zero capacity, so fill it up l...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_read.rs
MIT
5cd665afd7b70b184b559e6407fdf645983e1314
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5cd665afd7b70b184b559e6407fdf645983e1314/tokio/tests/io_async_read.rs
121
144
tokio-rs/tokio:tokio/tests/io_async_read.rs:1
use tokio::io::AsyncRead; use tokio_test::task; use tokio_test::{assert_ready_err, assert_ready_ok}; use bytes::{BufMut, BytesMut}; use std::io; use std::pin::Pin; use std::task::{Context, Poll}; #[test] fn assert_obj_safe() { fn _assert<T>() {} _assert::<Box<dyn AsyncRead>>(); } #[test] fn read_buf_success(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/io_async_read.rs
MIT
966ccd5d5306adf6b6c39721331c2a3c32be6fa8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/966ccd5d5306adf6b6c39721331c2a3c32be6fa8/tokio/tests/io_async_read.rs
1
60