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/rt_handle.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use std::sync::Arc; use tokio::runtime::Runtime; use tokio::sync::{mpsc, Barrier}; #[test] #[cfg_attr(panic = "abort", ignore)] fn basic_enter() { let rt1 = rt(); let rt2 = rt(); let enter1 = rt1.enter(); let enter2 = rt2.enter(); drop(enter2)...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_handle.rs
1
60
tokio-rs/tokio:tokio/tests/rt_handle.rs:2
let _enter1 = rt1.enter(); let enter2 = rt1.enter(); let enter3 = rt1.enter(); drop(enter2); drop(enter3); } #[test] #[cfg(not(target_os = "wasi"))] #[cfg_attr(panic = "abort", ignore)] fn interleave_then_enter() { let _ = std::panic::catch_unwind(|| { let rt1 = rt(); let rt2 = rt(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_handle.rs
41
100
tokio-rs/tokio:tokio/tests/rt_handle.rs:3
// Poll the JoinHandle once. This registers the waker. // The other task cannot have finished at this point due to the barrier below. futures::future::select(b, std::future::ready(())).await; barrier_a.wait().await; }); let b = tokio::spawn(async move { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_handle.rs
81
125
tokio-rs/tokio:tokio/tests/rt_handle.rs:3
// Poll the JoinHandle once. This registers the waker. // The other task cannot have finished at this point due to the barrier below. futures::future::select(b, std::future::ready(())).await; barrier_a.wait().await; }); let b = tokio::spawn(async move { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/rt_handle.rs
81
130
tokio-rs/tokio:tokio/tests/rt_handle.rs:4
assert_ne!(rt1.handle().id(), rt2.handle().id()); } } fn rt() -> Runtime { tokio::runtime::Builder::new_current_thread() .build() .unwrap() }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/rt_handle.rs
121
130
tokio-rs/tokio:tokio/tests/rt_handle.rs:1
#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] use std::sync::Arc; use tokio::runtime::Runtime; use tokio::sync::{mpsc, Barrier}; #[test] #[cfg_attr(panic = "abort", ignore)] fn basic_enter() { let rt1 = rt(); let rt2 = rt(); let enter1 = rt1.enter(); l...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
970d880ceb473b222a9ddd4b35b934ca68cecb4a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/tests/rt_handle.rs
1
60
tokio-rs/tokio:tokio/tests/rt_handle.rs:2
let _enter1 = rt1.enter(); let enter2 = rt1.enter(); let enter3 = rt1.enter(); drop(enter2); drop(enter3); } #[test] #[cfg(not(target_os = "wasi"))] #[cfg_attr(panic = "abort", ignore)] fn interleave_then_enter() { let _ = std::panic::catch_unwind(|| { let rt1 = rt(); let rt2 = rt(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
970d880ceb473b222a9ddd4b35b934ca68cecb4a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/tests/rt_handle.rs
41
100
tokio-rs/tokio:tokio/tests/rt_handle.rs:3
let b = rx.recv().await.unwrap(); // Poll the JoinHandle once. This registers the waker. // The other task cannot have finished at this point due to the barrier below. futures::future::select(b, std::future::ready(())).await; barrier_a.wait().await; }); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
970d880ceb473b222a9ddd4b35b934ca68cecb4a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/tests/rt_handle.rs
81
131
tokio-rs/tokio:tokio/tests/rt_handle.rs:4
let rt2 = rt(); assert_ne!(rt1.handle().id(), rt2.handle().id()); } } fn rt() -> Runtime { tokio::runtime::Builder::new_current_thread() .build() .unwrap() }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
970d880ceb473b222a9ddd4b35b934ca68cecb4a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/970d880ceb473b222a9ddd4b35b934ca68cecb4a/tokio/tests/rt_handle.rs
121
131
tokio-rs/tokio:tokio/tests/rt_handle.rs:1
#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; #[test] #[cfg_attr(panic = "abort", ignore)] fn basic_enter() { let rt1 = rt(); let rt2 = rt(); let enter1 = rt1.enter(); let enter2 = rt2.enter(); drop(enter2); drop(e...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
2a0df5fb05ae1a624fe2f6db756190f41812214b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2a0df5fb05ae1a624fe2f6db756190f41812214b/tokio/tests/rt_handle.rs
1
60
tokio-rs/tokio:tokio/tests/rt_handle.rs:2
let enter2 = rt1.enter(); let enter3 = rt1.enter(); drop(enter2); drop(enter3); } #[test] #[cfg(not(target_os = "wasi"))] #[cfg_attr(panic = "abort", ignore)] fn interleave_then_enter() { let _ = std::panic::catch_unwind(|| { let rt1 = rt(); let rt2 = rt(); let enter1 = rt1.en...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
2a0df5fb05ae1a624fe2f6db756190f41812214b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2a0df5fb05ae1a624fe2f6db756190f41812214b/tokio/tests/rt_handle.rs
41
95
tokio-rs/tokio:tokio/tests/rt_handle.rs:3
#[test] fn runtime_ids_different() { let rt1 = rt(); let rt2 = rt(); assert_ne!(rt1.handle().id(), rt2.handle().id()); } } fn rt() -> Runtime { tokio::runtime::Builder::new_current_thread() .build() .unwrap() }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
2a0df5fb05ae1a624fe2f6db756190f41812214b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2a0df5fb05ae1a624fe2f6db756190f41812214b/tokio/tests/rt_handle.rs
81
95
tokio-rs/tokio:tokio/tests/rt_handle.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; #[test] #[cfg_attr(panic = "abort", ignore)] fn basic_enter() { let rt1 = rt(); let rt2 = rt(); let enter1 = rt1.enter(); let enter2 = rt2.enter(); drop(enter2); drop(enter1); } #[test] #[should_panic] #[cfg_a...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
58edfc61abe4acdc2dda485c1d66715790b9315c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/58edfc61abe4acdc2dda485c1d66715790b9315c/tokio/tests/rt_handle.rs
1
60
tokio-rs/tokio:tokio/tests/rt_handle.rs:2
let enter3 = rt1.enter(); drop(enter2); drop(enter3); } #[test] #[cfg(not(target_os = "wasi"))] #[cfg_attr(panic = "abort", ignore)] fn interleave_then_enter() { let _ = std::panic::catch_unwind(|| { let rt1 = rt(); let rt2 = rt(); let enter1 = rt1.enter(); let enter2 = rt...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
58edfc61abe4acdc2dda485c1d66715790b9315c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/58edfc61abe4acdc2dda485c1d66715790b9315c/tokio/tests/rt_handle.rs
41
94
tokio-rs/tokio:tokio/tests/rt_handle.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; #[cfg(panic = "unwind")] #[test] fn basic_enter() { let rt1 = rt(); let rt2 = rt(); let enter1 = rt1.enter(); let enter2 = rt2.enter(); drop(enter2); drop(enter1); } #[cfg(panic = "unwind")] #[test] #[should_p...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
d8a4a5f24bfc5012071eec4e501bb4a58a1181d6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/rt_handle.rs
1
60
tokio-rs/tokio:tokio/tests/rt_handle.rs:2
let enter3 = rt1.enter(); drop(enter2); drop(enter3); } #[cfg(panic = "unwind")] #[test] #[cfg(not(target_os = "wasi"))] fn interleave_then_enter() { let _ = std::panic::catch_unwind(|| { let rt1 = rt(); let rt2 = rt(); let enter1 = rt1.enter(); let enter2 = rt2.enter(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
d8a4a5f24bfc5012071eec4e501bb4a58a1181d6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/rt_handle.rs
41
94
tokio-rs/tokio:tokio/tests/rt_handle.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; #[test] fn basic_enter() { let rt1 = rt(); let rt2 = rt(); let enter1 = rt1.enter(); let enter2 = rt2.enter(); drop(enter2); drop(enter1); } #[test] #[should_panic] fn interleave_enter_different_rt() { let...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/rt_handle.rs
1
60
tokio-rs/tokio:tokio/tests/rt_handle.rs:2
drop(enter3); } #[test] #[cfg(not(target_os = "wasi"))] fn interleave_then_enter() { let _ = std::panic::catch_unwind(|| { let rt1 = rt(); let rt2 = rt(); let enter1 = rt1.enter(); let enter2 = rt2.enter(); drop(enter1); drop(enter2); }); // Can still ente...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/rt_handle.rs
41
90
tokio-rs/tokio:tokio/tests/rt_handle.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; #[test] fn basic_enter() { let rt1 = rt(); let rt2 = rt(); let enter1 = rt1.enter(); let enter2 = rt2.enter(); drop(enter2); drop(enter1); } #[test] #[should_panic] fn interleave_enter_different_rt() { let...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
63577cd8d3f2b1a1c787870125ab808eaa1eaa99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/63577cd8d3f2b1a1c787870125ab808eaa1eaa99/tokio/tests/rt_handle.rs
1
60
tokio-rs/tokio:tokio/tests/rt_handle.rs:2
drop(enter3); } #[test] #[cfg(not(tokio_wasi))] fn interleave_then_enter() { let _ = std::panic::catch_unwind(|| { let rt1 = rt(); let rt2 = rt(); let enter1 = rt1.enter(); let enter2 = rt2.enter(); drop(enter1); drop(enter2); }); // Can still enter le...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
63577cd8d3f2b1a1c787870125ab808eaa1eaa99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/63577cd8d3f2b1a1c787870125ab808eaa1eaa99/tokio/tests/rt_handle.rs
41
90
tokio-rs/tokio:tokio/tests/rt_handle.rs:2
drop(enter3); } #[test] #[cfg(not(tokio_wasi))] fn interleave_then_enter() { let _ = std::panic::catch_unwind(|| { let rt1 = rt(); let rt2 = rt(); let enter1 = rt1.enter(); let enter2 = rt2.enter(); drop(enter1); drop(enter2); }); // Can still enter le...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle.rs
MIT
cbb3c155dd416f6e6a26be5e3b2ebc02853e4b62
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cbb3c155dd416f6e6a26be5e3b2ebc02853e4b62/tokio/tests/rt_handle.rs
41
67
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(miri)))] // All io tests that deal with shutdown is currently ignored because there are known bugs in with // shutting down the io driver while concurrently registering new resources. See // https://github.com/tokio-rs/tokio/pull/3569#pullrequestreview-612703...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_handle_block_on.rs
1
60
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:2
.enable_all() .build() .unwrap() } } } } #[cfg(not(target_os = "wasi"))] macro_rules! rt_test { ($($t:tt)*) => { mod current_thread_scheduler { use super::*; $($t)* fn rt() -> Runtime { tok...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_handle_block_on.rs
41
100
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:3
$($t)* fn rt() -> Runtime { tokio::runtime::Builder::new_multi_thread() .worker_threads(1) .enable_all() .build() .unwrap() } } } } // ==== runtime independent futures ====== #[test] fn...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_handle_block_on.rs
81
140
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:4
let _ = tx.send(42); let value = Handle::current().block_on(rx.recv()).unwrap(); assert_eq!(value, 42); }) } #[test] fn yield_in_block_in_place() { test_with_runtimes(|| { Handle::current().block_on(async { tokio::task::block_in_place(|| { Handle::current()....
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_handle_block_on.rs
121
180
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:5
let err: std::io::Error = Handle::current() .block_on(fs::read_to_string("Cargo.toml")) .unwrap_err(); assert_eq!(err.kind(), std::io::ErrorKind::Other); let inner_err = err.get_ref().expect("no inner error"); assert_eq!(inner_err.to_string(), "background task failed");...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_handle_block_on.rs
161
220
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:6
assert!(join_err.is_cancelled()); } #[test] fn spawn_blocking_started_before_shutdown_continues() { use tokio::task::spawn_blocking; let rt = rt(); let _enter = rt.enter(); let handle = spawn_blocking(|| { std::thread::sleep(Duration::from_secs(1)); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_handle_block_on.rs
201
260
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:7
// ==== net ====== #[test] #[cfg_attr(miri, ignore)] // No `socket` in miri. fn tcp_listener_bind() { let rt = rt(); let _enter = rt.enter(); Handle::current() .block_on(net::TcpListener::bind("127.0.0.1:0")) .unwrap(); } // All io tests are ignored...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_handle_block_on.rs
241
300
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:8
let bind_future = net::TcpListener::bind("127.0.0.1:0"); rt.shutdown_timeout(Duration::from_secs(1000)); let err = Handle::current().block_on(bind_future).unwrap_err(); assert_eq!(err.kind(), std::io::ErrorKind::Other); assert_eq!( err.get_ref().unwrap().to_string(), ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_handle_block_on.rs
281
340
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:9
"A Tokio 1.x context was found, but it is being shutdown.", ); } // All io tests are ignored for now. See above why that is. #[ignore] #[test] fn udp_stream_bind_before_shutdown() { let rt = rt(); let _enter = rt.enter(); let bind_future = net::UdpSocket::bind("127....
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_handle_block_on.rs
321
380
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:10
assert_eq!( err.get_ref().unwrap().to_string(), "A Tokio 1.x context was found, but it is being shutdown.", ); } // All io tests are ignored for now. See above why that is. #[ignore] #[cfg(unix)] #[test] fn unix_listener_shutdown_after_bind() { let rt = r...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_handle_block_on.rs
361
420
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:11
let accept_future = listener.accept(); rt.shutdown_timeout(Duration::from_secs(1000)); // this should not timeout but fail immediately since the runtime has been shutdown let err = Handle::current().block_on(accept_future).unwrap_err(); assert_eq!(err.kind(), std::io::ErrorKind::Other...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_handle_block_on.rs
401
460
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:12
drop(rt); let jh2 = handle.spawn(futures::future::pending::<()>()); let err1 = jh1.now_or_never().unwrap().unwrap_err(); let err2 = jh2.now_or_never().unwrap().unwrap_err(); assert!(err1.is_cancelled()); assert!(err2.is_cancelled()); } } #[cfg(not(target_os = "wasi"))] mul...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_handle_block_on.rs
441
500
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:13
#[test] fn sleep() { let rt = rt(); let _enter = rt.enter(); Handle::current().block_on(time::sleep(Duration::from_millis(100))); } #[test] #[should_panic(expected = "A Tokio 1.x context was found, but it is being shutdown.")] fn sleep_before_shutdown_panics() { let...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_handle_block_on.rs
481
540
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:14
.enable_all() .build() .unwrap() } /// Create a new single threaded runtime fn new_current_thread() -> Runtime { tokio::runtime::Builder::new_current_thread() .enable_all() .build() .unwrap() } /// Utility to test things on both kinds of runtimes both before and after shutt...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_handle_block_on.rs
521
567
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:6
assert!(join_err.is_cancelled()); } #[test] fn spawn_blocking_started_before_shutdown_continues() { use tokio::task::spawn_blocking; let rt = rt(); let _enter = rt.enter(); let handle = spawn_blocking(|| { std::thread::sleep(Duration::from_secs(1)); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
addbfb9204be25a8621feb3f20b44a7c1f00edbd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/addbfb9204be25a8621feb3f20b44a7c1f00edbd/tokio/tests/rt_handle_block_on.rs
201
260
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:7
let _enter = rt.enter(); rt.shutdown_timeout(Duration::from_secs(1000)); let err = Handle::current() .block_on(net::TcpListener::bind("127.0.0.1:0")) .unwrap_err(); assert_eq!(err.kind(), std::io::ErrorKind::Other); assert_eq!( err.get_ref().unwrap(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
addbfb9204be25a8621feb3f20b44a7c1f00edbd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/addbfb9204be25a8621feb3f20b44a7c1f00edbd/tokio/tests/rt_handle_block_on.rs
241
300
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:8
Handle::current() .block_on(net::UdpSocket::bind("127.0.0.1:0")) .unwrap(); } // All io tests are ignored for now. See above why that is. #[ignore] #[test] fn udp_stream_bind_after_shutdown() { let rt = rt(); let _enter = rt.enter(); rt.shutdown_time...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
addbfb9204be25a8621feb3f20b44a7c1f00edbd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/addbfb9204be25a8621feb3f20b44a7c1f00edbd/tokio/tests/rt_handle_block_on.rs
281
340
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:9
assert_eq!( err.get_ref().unwrap().to_string(), "A Tokio 1.x context was found, but it is being shutdown.", ); } // All io tests are ignored for now. See above why that is. #[ignore] #[cfg(unix)] #[test] fn unix_listener_bind_after_shutdown() { let rt = r...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
addbfb9204be25a8621feb3f20b44a7c1f00edbd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/addbfb9204be25a8621feb3f20b44a7c1f00edbd/tokio/tests/rt_handle_block_on.rs
321
380
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:10
rt.shutdown_timeout(Duration::from_secs(1000)); // this should not timeout but fail immediately since the runtime has been shutdown let err = Handle::current().block_on(listener.accept()).unwrap_err(); assert_eq!(err.kind(), std::io::ErrorKind::Other); assert_eq!(err.get_ref().unwrap()...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
addbfb9204be25a8621feb3f20b44a7c1f00edbd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/addbfb9204be25a8621feb3f20b44a7c1f00edbd/tokio/tests/rt_handle_block_on.rs
361
420
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:11
fn nesting() { fn some_non_async_function() -> i32 { Handle::current().block_on(time::sleep(Duration::from_millis(10))); 1 } let rt = rt(); rt.block_on(async { some_non_async_function() }); } #[test] fn spawn_after_runtime_dropped() { use fu...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
addbfb9204be25a8621feb3f20b44a7c1f00edbd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/addbfb9204be25a8621feb3f20b44a7c1f00edbd/tokio/tests/rt_handle_block_on.rs
401
460
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:12
let rt = rt(); let _enter = rt.enter(); let dir = tempfile::tempdir().unwrap(); let path = dir.path().join("socket"); let listener = net::UnixListener::bind(path).unwrap(); // this should timeout and not fail immediately since the runtime has not been shutdown let _: t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
addbfb9204be25a8621feb3f20b44a7c1f00edbd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/addbfb9204be25a8621feb3f20b44a7c1f00edbd/tokio/tests/rt_handle_block_on.rs
441
500
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:13
Handle::current().block_on(f); } #[test] #[should_panic(expected = "A Tokio 1.x context was found, but it is being shutdown.")] fn sleep_after_shutdown_panics() { let rt = rt(); let _enter = rt.enter(); rt.shutdown_timeout(Duration::from_secs(1000)); Handle::current()....
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
addbfb9204be25a8621feb3f20b44a7c1f00edbd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/addbfb9204be25a8621feb3f20b44a7c1f00edbd/tokio/tests/rt_handle_block_on.rs
481
540
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:14
{ let rt = new_current_thread(); let _enter = rt.enter(); f(); rt.shutdown_timeout(Duration::from_secs(1000)); f(); } #[cfg(not(target_os = "wasi"))] { let rt = new_multi_thread(1); let _enter = rt.enter(); f(); rt.shutdown_timeout(D...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
addbfb9204be25a8621feb3f20b44a7c1f00edbd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/addbfb9204be25a8621feb3f20b44a7c1f00edbd/tokio/tests/rt_handle_block_on.rs
521
549
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:3
$($t)* fn rt() -> Runtime { tokio::runtime::Builder::new_multi_thread() .worker_threads(1) .enable_all() .build() .unwrap() } } } } // ==== runtime independent futures ====== #[test] fn...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
4047d7962a02722859b0f1c7bbcd85bc1bfc865d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/rt_handle_block_on.rs
81
140
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:4
let _ = tx.send(42); let value = Handle::current().block_on(rx.recv()).unwrap(); assert_eq!(value, 42); }) } #[cfg(not(target_os = "wasi"))] // Wasi doesn't support file operations or bind rt_test! { use tokio::fs; // ==== spawn blocking futures ====== #[test] fn basic_fs() { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
4047d7962a02722859b0f1c7bbcd85bc1bfc865d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/rt_handle_block_on.rs
121
180
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:5
#[test] fn basic_spawn_blocking() { use tokio::task::spawn_blocking; let rt = rt(); let _enter = rt.enter(); let answer = Handle::current() .block_on(spawn_blocking(|| { std::thread::sleep(Duration::from_millis(100)); 42 })) ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
4047d7962a02722859b0f1c7bbcd85bc1bfc865d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/rt_handle_block_on.rs
161
220
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:6
std::thread::sleep(Duration::from_secs(1)); 42 }); rt.shutdown_timeout(Duration::from_secs(1000)); let answer = Handle::current().block_on(handle).unwrap(); assert_eq!(answer, 42); } // ==== net ====== #[test] #[cfg_attr(miri, ignore)] // No `socket` in m...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
4047d7962a02722859b0f1c7bbcd85bc1bfc865d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/rt_handle_block_on.rs
201
260
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:7
"A Tokio 1.x context was found, but it is being shutdown.", ); } // All io tests are ignored for now. See above why that is. #[ignore] #[test] fn tcp_listener_connect_before_shutdown() { let rt = rt(); let _enter = rt.enter(); let bind_future = net::TcpListener::bin...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
4047d7962a02722859b0f1c7bbcd85bc1bfc865d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/rt_handle_block_on.rs
241
300
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:8
let _enter = rt.enter(); rt.shutdown_timeout(Duration::from_secs(1000)); let err = Handle::current() .block_on(net::UdpSocket::bind("127.0.0.1:0")) .unwrap_err(); assert_eq!(err.kind(), std::io::ErrorKind::Other); assert_eq!( err.get_ref().unwrap()....
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
4047d7962a02722859b0f1c7bbcd85bc1bfc865d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/rt_handle_block_on.rs
281
340
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:9
let rt = rt(); let _enter = rt.enter(); let dir = tempfile::tempdir().unwrap(); let path = dir.path().join("socket"); rt.shutdown_timeout(Duration::from_secs(1000)); let err = net::UnixListener::bind(path).unwrap_err(); assert_eq!(err.kind(), std::io::ErrorKind::Other...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
4047d7962a02722859b0f1c7bbcd85bc1bfc865d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/rt_handle_block_on.rs
321
380
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:10
#[ignore] #[cfg(unix)] #[test] fn unix_listener_shutdown_after_accept() { let rt = rt(); let _enter = rt.enter(); let dir = tempfile::tempdir().unwrap(); let path = dir.path().join("socket"); let listener = net::UnixListener::bind(path).unwrap(); let accept...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
4047d7962a02722859b0f1c7bbcd85bc1bfc865d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/rt_handle_block_on.rs
361
420
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:11
#[test] fn spawn_after_runtime_dropped() { use futures::future::FutureExt; let rt = rt(); let handle = rt.block_on(async move { Handle::current() }); let jh1 = handle.spawn(futures::future::pending::<()>()); drop(rt); let jh2 = handle.spawn(fu...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
4047d7962a02722859b0f1c7bbcd85bc1bfc865d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/rt_handle_block_on.rs
401
460
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:12
Duration::from_millis(10), listener.accept(), )) .unwrap_err(); } // ==== timers ====== // `Handle::block_on` doesn't work with timer futures on a current thread runtime as there is no // one to drive the timers so they will just hang forever. Therefore they are...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
4047d7962a02722859b0f1c7bbcd85bc1bfc865d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/rt_handle_block_on.rs
441
500
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:13
Handle::current().block_on(time::sleep(Duration::from_millis(100))); } } // ==== utils ====== /// Create a new multi threaded runtime #[cfg(not(target_os = "wasi"))] fn new_multi_thread(n: usize) -> Runtime { tokio::runtime::Builder::new_multi_thread() .worker_threads(n) .enable_all() ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
4047d7962a02722859b0f1c7bbcd85bc1bfc865d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/rt_handle_block_on.rs
481
538
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:14
let rt = new_multi_thread(1); let _enter = rt.enter(); f(); rt.shutdown_timeout(Duration::from_secs(1000)); f(); } #[cfg(not(target_os = "wasi"))] { let rt = new_multi_thread(4); let _enter = rt.enter(); f(); rt.shutdown_timeout(Duration::fr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
4047d7962a02722859b0f1c7bbcd85bc1bfc865d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4047d7962a02722859b0f1c7bbcd85bc1bfc865d/tokio/tests/rt_handle_block_on.rs
521
538
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:5
#[test] fn basic_spawn_blocking() { use tokio::task::spawn_blocking; let rt = rt(); let _enter = rt.enter(); let answer = Handle::current() .block_on(spawn_blocking(|| { std::thread::sleep(Duration::from_millis(100)); 42 })) ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/rt_handle_block_on.rs
161
220
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:6
std::thread::sleep(Duration::from_secs(1)); 42 }); rt.shutdown_timeout(Duration::from_secs(1000)); let answer = Handle::current().block_on(handle).unwrap(); assert_eq!(answer, 42); } // ==== net ====== #[test] fn tcp_listener_bind() { let rt = rt(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/rt_handle_block_on.rs
201
260
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:7
); } // All io tests are ignored for now. See above why that is. #[ignore] #[test] fn tcp_listener_connect_before_shutdown() { let rt = rt(); let _enter = rt.enter(); let bind_future = net::TcpListener::bind("127.0.0.1:0"); rt.shutdown_timeout(Duration::from_secs(1...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/rt_handle_block_on.rs
241
300
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:8
rt.shutdown_timeout(Duration::from_secs(1000)); let err = Handle::current() .block_on(net::UdpSocket::bind("127.0.0.1:0")) .unwrap_err(); assert_eq!(err.kind(), std::io::ErrorKind::Other); assert_eq!( err.get_ref().unwrap().to_string(), "A Tokio ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/rt_handle_block_on.rs
281
340
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:9
let dir = tempfile::tempdir().unwrap(); let path = dir.path().join("socket"); rt.shutdown_timeout(Duration::from_secs(1000)); let err = net::UnixListener::bind(path).unwrap_err(); assert_eq!(err.kind(), std::io::ErrorKind::Other); assert_eq!( err.get_ref().unwrap()...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/rt_handle_block_on.rs
321
380
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:10
#[test] fn unix_listener_shutdown_after_accept() { let rt = rt(); let _enter = rt.enter(); let dir = tempfile::tempdir().unwrap(); let path = dir.path().join("socket"); let listener = net::UnixListener::bind(path).unwrap(); let accept_future = listener.accept(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/rt_handle_block_on.rs
361
420
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:11
use futures::future::FutureExt; let rt = rt(); let handle = rt.block_on(async move { Handle::current() }); let jh1 = handle.spawn(futures::future::pending::<()>()); drop(rt); let jh2 = handle.spawn(futures::future::pending::<()>()); let err1 = jh...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/rt_handle_block_on.rs
401
460
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:12
.unwrap_err(); } // ==== timers ====== // `Handle::block_on` doesn't work with timer futures on a current thread runtime as there is no // one to drive the timers so they will just hang forever. Therefore they are not tested. #[test] fn sleep() { let rt = rt(); let _enter = rt...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/rt_handle_block_on.rs
441
500
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:13
// ==== utils ====== /// Create a new multi threaded runtime #[cfg(not(target_os = "wasi"))] fn new_multi_thread(n: usize) -> Runtime { tokio::runtime::Builder::new_multi_thread() .worker_threads(n) .enable_all() .build() .unwrap() } /// Create a new single threaded runtime fn new_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/rt_handle_block_on.rs
481
535
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:14
rt.shutdown_timeout(Duration::from_secs(1000)); f(); } #[cfg(not(target_os = "wasi"))] { let rt = new_multi_thread(4); let _enter = rt.enter(); f(); rt.shutdown_timeout(Duration::from_secs(1000)); f(); } }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/rt_handle_block_on.rs
521
535
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] // All io tests that deal with shutdown is currently ignored because there are known bugs in with // shutting down the io driver while concurrently registering new resources. See // https://github.com/tokio-rs/tokio/pull/3569#pullrequestreview-612703467 for more det...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
340d4e5238f7feaee63978c541559e0a127733bf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/340d4e5238f7feaee63978c541559e0a127733bf/tokio/tests/rt_handle_block_on.rs
1
60
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] // All io tests that deal with shutdown is currently ignored because there are known bugs in with // shutting down the io driver while concurrently registering new resources. See // https://github.com/tokio-rs/tokio/pull/3569#pullrequestreview-612703467 fo more deta...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/rt_handle_block_on.rs
1
60
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] // All io tests that deal with shutdown is currently ignored because there are known bugs in with // shutting down the io driver while concurrently registering new resources. See // https://github.com/tokio-rs/tokio/pull/3569#pullrequestreview-612703467 fo more deta...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
57e08e714754420f8b3d8ffe863549d8acf761d0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57e08e714754420f8b3d8ffe863549d8acf761d0/tokio/tests/rt_handle_block_on.rs
1
60
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:2
.enable_all() .build() .unwrap() } } } } #[cfg(not(tokio_wasi))] macro_rules! rt_test { ($($t:tt)*) => { mod current_thread_scheduler { use super::*; $($t)* fn rt() -> Runtime { tokio::runt...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
57e08e714754420f8b3d8ffe863549d8acf761d0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57e08e714754420f8b3d8ffe863549d8acf761d0/tokio/tests/rt_handle_block_on.rs
41
100
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:3
$($t)* fn rt() -> Runtime { tokio::runtime::Builder::new_multi_thread() .worker_threads(1) .enable_all() .build() .unwrap() } } } } // ==== runtime independent futures ====== #[test] fn...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
57e08e714754420f8b3d8ffe863549d8acf761d0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57e08e714754420f8b3d8ffe863549d8acf761d0/tokio/tests/rt_handle_block_on.rs
81
140
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:4
let _ = tx.send(42); let value = Handle::current().block_on(rx.recv()).unwrap(); assert_eq!(value, 42); }) } #[cfg(not(tokio_wasi))] // Wasi doesn't support file operations or bind rt_test! { use tokio::fs; // ==== spawn blocking futures ====== #[test] fn basic_fs() { let ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
57e08e714754420f8b3d8ffe863549d8acf761d0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57e08e714754420f8b3d8ffe863549d8acf761d0/tokio/tests/rt_handle_block_on.rs
121
180
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:11
use futures::future::FutureExt; let rt = rt(); let handle = rt.block_on(async move { Handle::current() }); let jh1 = handle.spawn(futures::future::pending::<()>()); drop(rt); let jh2 = handle.spawn(futures::future::pending::<()>()); let err1 = jh...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
57e08e714754420f8b3d8ffe863549d8acf761d0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57e08e714754420f8b3d8ffe863549d8acf761d0/tokio/tests/rt_handle_block_on.rs
401
460
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:12
.unwrap_err(); } // ==== timers ====== // `Handle::block_on` doesn't work with timer futures on a current thread runtime as there is no // one to drive the timers so they will just hang forever. Therefore they are not tested. #[test] fn sleep() { let rt = rt(); let _enter = rt...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
57e08e714754420f8b3d8ffe863549d8acf761d0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57e08e714754420f8b3d8ffe863549d8acf761d0/tokio/tests/rt_handle_block_on.rs
441
500
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:13
// ==== utils ====== /// Create a new multi threaded runtime #[cfg(not(tokio_wasi))] fn new_multi_thread(n: usize) -> Runtime { tokio::runtime::Builder::new_multi_thread() .worker_threads(n) .enable_all() .build() .unwrap() } /// Create a new single threaded runtime fn new_current_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
57e08e714754420f8b3d8ffe863549d8acf761d0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57e08e714754420f8b3d8ffe863549d8acf761d0/tokio/tests/rt_handle_block_on.rs
481
535
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:14
rt.shutdown_timeout(Duration::from_secs(1000)); f(); } #[cfg(not(tokio_wasi))] { let rt = new_multi_thread(4); let _enter = rt.enter(); f(); rt.shutdown_timeout(Duration::from_secs(1000)); f(); } }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
57e08e714754420f8b3d8ffe863549d8acf761d0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57e08e714754420f8b3d8ffe863549d8acf761d0/tokio/tests/rt_handle_block_on.rs
521
535
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:13
// ==== utils ====== /// Create a new multi threaded runtime #[cfg(not(tokio_wasi))] fn new_multi_thread(n: usize) -> Runtime { tokio::runtime::Builder::new_multi_thread() .worker_threads(n) .enable_all() .build() .unwrap() } /// Create a new single threaded runtime fn new_current_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/rt_handle_block_on.rs
481
540
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:14
println!("multi thread (1 thread) runtime"); let rt = new_multi_thread(1); let _enter = rt.enter(); f(); println!("multi thread runtime after shutdown"); rt.shutdown_timeout(Duration::from_secs(1000)); f(); } #[cfg(not(tokio_wasi))] { println!("mult...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/rt_handle_block_on.rs
521
544
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:13
// ==== utils ====== /// Create a new multi threaded runtime #[cfg(not(target_os = "wasi"))] fn new_multi_thread(n: usize) -> Runtime { tokio::runtime::Builder::new_multi_thread() .worker_threads(n) .enable_all() .build() .unwrap() } /// Create a new single threaded runtime fn new_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/rt_handle_block_on.rs
481
540
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:14
println!("multi thread (1 thread) runtime"); let rt = new_multi_thread(1); let _enter = rt.enter(); f(); println!("multi thread runtime after shutdown"); rt.shutdown_timeout(Duration::from_secs(1000)); f(); } #[cfg(not(target_os = "wasi"))] { printl...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/rt_handle_block_on.rs
521
544
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] // All io tests that deal with shutdown is currently ignored because there are known bugs in with // shutting down the io driver while concurrently registering new resources. See // https://github.com/tokio-rs/tokio/pull/3569#pullrequestreview-612703467 fo more deta...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
1a423b3322bd32afc761a2a39fc986909aab633d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a423b3322bd32afc761a2a39fc986909aab633d/tokio/tests/rt_handle_block_on.rs
1
60
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:2
.build() .unwrap() } } } } macro_rules! rt_test { ($($t:tt)*) => { mod current_thread_scheduler { use super::*; $($t)* fn rt() -> Runtime { tokio::runtime::Builder::new_current_thread() .en...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
1a423b3322bd32afc761a2a39fc986909aab633d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a423b3322bd32afc761a2a39fc986909aab633d/tokio/tests/rt_handle_block_on.rs
41
100
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:3
fn rt() -> Runtime { tokio::runtime::Builder::new_multi_thread() .worker_threads(1) .enable_all() .build() .unwrap() } } } } // ==== runtime independent futures ====== #[test] fn basic() { test_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
1a423b3322bd32afc761a2a39fc986909aab633d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a423b3322bd32afc761a2a39fc986909aab633d/tokio/tests/rt_handle_block_on.rs
81
140
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:4
let value = Handle::current().block_on(rx.recv()).unwrap(); assert_eq!(value, 42); }) } rt_test! { // ==== spawn blocking futures ====== #[test] fn basic_fs() { let rt = rt(); let _enter = rt.enter(); let contents = Handle::current() .block_on(fs::read_to_s...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
1a423b3322bd32afc761a2a39fc986909aab633d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a423b3322bd32afc761a2a39fc986909aab633d/tokio/tests/rt_handle_block_on.rs
121
180
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:5
let answer = Handle::current() .block_on(spawn_blocking(|| { std::thread::sleep(Duration::from_millis(100)); 42 })) .unwrap(); assert_eq!(answer, 42); } #[test] fn spawn_blocking_after_shutdown_fails() { let rt = rt(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
1a423b3322bd32afc761a2a39fc986909aab633d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a423b3322bd32afc761a2a39fc986909aab633d/tokio/tests/rt_handle_block_on.rs
161
220
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:6
assert_eq!(answer, 42); } // ==== net ====== #[test] fn tcp_listener_bind() { let rt = rt(); let _enter = rt.enter(); Handle::current() .block_on(net::TcpListener::bind("127.0.0.1:0")) .unwrap(); } // All io tests are ignored for now. See above...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
1a423b3322bd32afc761a2a39fc986909aab633d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a423b3322bd32afc761a2a39fc986909aab633d/tokio/tests/rt_handle_block_on.rs
201
260
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:7
let rt = rt(); let _enter = rt.enter(); let bind_future = net::TcpListener::bind("127.0.0.1:0"); rt.shutdown_timeout(Duration::from_secs(1000)); let err = Handle::current().block_on(bind_future).unwrap_err(); assert_eq!(err.kind(), std::io::ErrorKind::Other); assert_e...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
1a423b3322bd32afc761a2a39fc986909aab633d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a423b3322bd32afc761a2a39fc986909aab633d/tokio/tests/rt_handle_block_on.rs
241
300
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:8
assert_eq!( err.get_ref().unwrap().to_string(), "A Tokio 1.x context was found, but it is being shutdown.", ); } // All io tests are ignored for now. See above why that is. #[ignore] #[test] fn udp_stream_bind_before_shutdown() { let rt = rt(); let _e...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
1a423b3322bd32afc761a2a39fc986909aab633d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a423b3322bd32afc761a2a39fc986909aab633d/tokio/tests/rt_handle_block_on.rs
281
340
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:9
assert_eq!(err.kind(), std::io::ErrorKind::Other); assert_eq!( err.get_ref().unwrap().to_string(), "A Tokio 1.x context was found, but it is being shutdown.", ); } // All io tests are ignored for now. See above why that is. #[ignore] #[cfg(unix)] #[test] ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
1a423b3322bd32afc761a2a39fc986909aab633d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a423b3322bd32afc761a2a39fc986909aab633d/tokio/tests/rt_handle_block_on.rs
321
380
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:10
let listener = net::UnixListener::bind(path).unwrap(); let accept_future = listener.accept(); rt.shutdown_timeout(Duration::from_secs(1000)); // this should not timeout but fail immediately since the runtime has been shutdown let err = Handle::current().block_on(accept_future).unwrap_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
1a423b3322bd32afc761a2a39fc986909aab633d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a423b3322bd32afc761a2a39fc986909aab633d/tokio/tests/rt_handle_block_on.rs
361
420
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:11
let jh1 = handle.spawn(futures::future::pending::<()>()); drop(rt); let jh2 = handle.spawn(futures::future::pending::<()>()); let err1 = jh1.now_or_never().unwrap().unwrap_err(); let err2 = jh2.now_or_never().unwrap().unwrap_err(); assert!(err1.is_cancelled()); assert!...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
1a423b3322bd32afc761a2a39fc986909aab633d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a423b3322bd32afc761a2a39fc986909aab633d/tokio/tests/rt_handle_block_on.rs
401
460
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:12
#[test] fn sleep() { let rt = rt(); let _enter = rt.enter(); Handle::current().block_on(time::sleep(Duration::from_millis(100))); } #[test] #[should_panic(expected = "A Tokio 1.x context was found, but it is being shutdown.")] fn sleep_before_shutdown_panics() { let...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
1a423b3322bd32afc761a2a39fc986909aab633d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a423b3322bd32afc761a2a39fc986909aab633d/tokio/tests/rt_handle_block_on.rs
441
500
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:13
.build() .unwrap() } /// Create a new single threaded runtime fn new_current_thread() -> Runtime { tokio::runtime::Builder::new_current_thread() .enable_all() .build() .unwrap() } /// Utility to test things on both kinds of runtimes both before and after shutting it down. fn test_w...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
1a423b3322bd32afc761a2a39fc986909aab633d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a423b3322bd32afc761a2a39fc986909aab633d/tokio/tests/rt_handle_block_on.rs
481
533
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:14
{ println!("multi thread (4 threads) runtime"); let rt = new_multi_thread(4); let _enter = rt.enter(); f(); println!("multi thread runtime after shutdown"); rt.shutdown_timeout(Duration::from_secs(1000)); f(); } }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
1a423b3322bd32afc761a2a39fc986909aab633d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a423b3322bd32afc761a2a39fc986909aab633d/tokio/tests/rt_handle_block_on.rs
521
533
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:3
fn rt() -> Runtime { tokio::runtime::Builder::new_multi_thread() .worker_threads(1) .enable_all() .build() .unwrap() } } } } // ==== runtime independent futures ====== #[test] fn basic() { test_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
a39e6c2439927ed9c73043401959b0b02d054630
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a39e6c2439927ed9c73043401959b0b02d054630/tokio/tests/rt_handle_block_on.rs
81
140
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:4
let value = Handle::current().block_on(rx.recv()).unwrap(); assert_eq!(value, 42); }) } rt_test! { // ==== spawn blocking futures ====== #[test] fn basic_fs() { let rt = rt(); let _enter = rt.enter(); let contents = Handle::current() .block_on(fs::read_to_s...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
a39e6c2439927ed9c73043401959b0b02d054630
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a39e6c2439927ed9c73043401959b0b02d054630/tokio/tests/rt_handle_block_on.rs
121
180
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:10
let listener = net::UnixListener::bind(path).unwrap(); let accept_future = listener.accept(); rt.shutdown_timeout(Duration::from_secs(1000)); // this should not timeout but fail immediately since the runtime has been shutdown let err = Handle::current().block_on(accept_future).unwrap_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c39d9867bb989396bb02e74d87f2805969f43f03
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c39d9867bb989396bb02e74d87f2805969f43f03/tokio/tests/rt_handle_block_on.rs
361
420
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:11
let path = dir.path().join("socket"); let listener = net::UnixListener::bind(path).unwrap(); // this should timeout and not fail immediately since the runtime has not been shutdown let _: tokio::time::error::Elapsed = Handle::current() .block_on(tokio::time::timeout( ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c39d9867bb989396bb02e74d87f2805969f43f03
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c39d9867bb989396bb02e74d87f2805969f43f03/tokio/tests/rt_handle_block_on.rs
401
460
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:12
#[should_panic(expected = "A Tokio 1.x context was found, but it is being shutdown.")] fn sleep_after_shutdown_panics() { let rt = rt(); let _enter = rt.enter(); rt.shutdown_timeout(Duration::from_secs(1000)); Handle::current().block_on(time::sleep(Duration::from_millis(100))); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c39d9867bb989396bb02e74d87f2805969f43f03
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c39d9867bb989396bb02e74d87f2805969f43f03/tokio/tests/rt_handle_block_on.rs
441
500
tokio-rs/tokio:tokio/tests/rt_handle_block_on.rs:13
f(); println!("current thread runtime after shutdown"); rt.shutdown_timeout(Duration::from_secs(1000)); f(); } { println!("multi thread (1 thread) runtime"); let rt = new_multi_thread(1); let _enter = rt.enter(); f(); println!("multi thread run...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_handle_block_on.rs
MIT
c39d9867bb989396bb02e74d87f2805969f43f03
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c39d9867bb989396bb02e74d87f2805969f43f03/tokio/tests/rt_handle_block_on.rs
481
511