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_basic.rs:11
.rng_seed(RngSeed::from_bytes(seed)) .build() .unwrap(); let rt1_values = rt1.block_on(async { let rand_1 = tokio::macros::support::thread_rng_n(100); let rand_2 = tokio::macros::support::thread_rng_n(100); (rand_1, rand_2) }); let rt...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/rt_basic.rs
401
460
tokio-rs/tokio:tokio/tests/rt_basic.rs:12
let rt1_values_2 = rt1.block_on(async { two_rand_values() }); let rt2 = tokio::runtime::Builder::new_current_thread() .rng_seed(RngSeed::from_bytes(seed)) .build() .unwrap(); let rt2_values_1 = rt2.block_on(async { two_rand_values() }); let rt2_values_2 = rt2...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/rt_basic.rs
441
460
tokio-rs/tokio:tokio/tests/rt_basic.rs:1
#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; use tokio::sync::oneshot; use tokio::time::{timeout, Duration}; use tokio_test::{assert_err, assert_ok}; use std::future::Future; use std::pin::Pin; use std::sync::atomic::{AtomicBool, Ordering}...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
cba86cf1b1edea8cd131f168a99953e6e35739d2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cba86cf1b1edea8cd131f168a99953e6e35739d2/tokio/tests/rt_basic.rs
1
60
tokio-rs/tokio:tokio/tests/rt_basic.rs:1
#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; use tokio::sync::oneshot; use tokio::time::{timeout, Duration}; use tokio_test::{assert_err, assert_ok}; use std::future::Future; use std::pin::Pin; use std::sync::atomic::{AtomicBool, Ordering}...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
2a0df5fb05ae1a624fe2f6db756190f41812214b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2a0df5fb05ae1a624fe2f6db756190f41812214b/tokio/tests/rt_basic.rs
1
60
tokio-rs/tokio:tokio/tests/rt_basic.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; use tokio::sync::oneshot; use tokio::time::{timeout, Duration}; use tokio_test::{assert_err, assert_ok}; use std::future::Future; use std::pin::Pin; use std::sync::atomic::{AtomicBool, Ordering}; use std::task::{Context, Poll}; use std:...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
2d2faf6014ea3ba8329afcdb311fabbc04dd71e1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2d2faf6014ea3ba8329afcdb311fabbc04dd71e1/tokio/tests/rt_basic.rs
1
60
tokio-rs/tokio:tokio/tests/rt_basic.rs:5
Poll::Pending } } impl Drop for ContextOnDrop { fn drop(&mut self) { if tokio::runtime::Handle::try_current().is_ok() { SUCCESS.store(true, Ordering::SeqCst); } } } let rt = rt(); rt.spawn(ContextOnDrop); drop(rt); assert!(SU...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/rt_basic.rs
161
220
tokio-rs/tokio:tokio/tests/rt_basic.rs:6
let _join = rt.spawn(async move { rx.await }); rt.block_on(async { tokio::task::yield_now().await; panic!("boom"); }); } #[test] fn spawn_two() { let rt = rt(); let out = rt.block_on(async { let (tx, rx) = oneshot::channel(); tokio::spawn(async move { toki...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/rt_basic.rs
201
260
tokio-rs/tokio:tokio/tests/rt_basic.rs:7
#[cfg_attr(target_os = "wasi", ignore = "WASI: std::thread::spawn not supported")] #[test] fn spawn_remote() { let rt = rt(); let out = rt.block_on(async { let (tx, rx) = oneshot::channel(); let handle = tokio::spawn(async move { std::thread::spawn(move || { std::th...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/rt_basic.rs
241
300
tokio-rs/tokio:tokio/tests/rt_basic.rs:8
expected = "A Tokio 1.x context was found, but timers are disabled. Call `enable_time` on the runtime builder to enable timers." )] fn timeout_panics_when_no_time_handle() { let rt = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); rt.block_on(async { let (_tx, rx) = one...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/rt_basic.rs
281
340
tokio-rs/tokio:tokio/tests/rt_basic.rs:9
let rt = Builder::new_current_thread() .unhandled_panic(UnhandledPanic::ShutdownRuntime) .build() .unwrap(); let rt1 = Arc::new(rt); let rt2 = rt1.clone(); let _ = std::thread::spawn(move || { rt2.block_on(async { tokio::spawn(asy...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/rt_basic.rs
321
380
tokio-rs/tokio:tokio/tests/rt_basic.rs:10
for _ in 0..N { let rt = rt.clone(); let tx = tx.clone(); ths.push(std::thread::spawn(move || { rt.block_on(async { tx.send(()).unwrap(); futures::future::pending::<()>().await; }); })); } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/rt_basic.rs
361
420
tokio-rs/tokio:tokio/tests/rt_basic.rs:11
.build() .unwrap(); let rt2_values = rt2.block_on(async { let rand_1 = tokio::macros::support::thread_rng_n(100); let rand_2 = tokio::macros::support::thread_rng_n(100); (rand_1, rand_2) }); assert_eq!(rt1_values, rt2_values); } #[test] ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/rt_basic.rs
401
448
tokio-rs/tokio:tokio/tests/rt_basic.rs:5
Poll::Pending } } impl Drop for ContextOnDrop { fn drop(&mut self) { if tokio::runtime::Handle::try_current().is_ok() { SUCCESS.store(true, Ordering::SeqCst); } } } let rt = rt(); rt.spawn(ContextOnDrop); drop(rt); assert!(SU...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
9b486357ed1aa008afa09e95965eb6c94a8753a1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/rt_basic.rs
161
220
tokio-rs/tokio:tokio/tests/rt_basic.rs:6
let _join = rt.spawn(async move { rx.await }); rt.block_on(async { tokio::task::yield_now().await; panic!("boom"); }); } #[test] fn spawn_two() { let rt = rt(); let out = rt.block_on(async { let (tx, rx) = oneshot::channel(); tokio::spawn(async move { toki...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
9b486357ed1aa008afa09e95965eb6c94a8753a1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/rt_basic.rs
201
260
tokio-rs/tokio:tokio/tests/rt_basic.rs:7
#[cfg_attr(tokio_wasi, ignore = "WASI: std::thread::spawn not supported")] #[test] fn spawn_remote() { let rt = rt(); let out = rt.block_on(async { let (tx, rx) = oneshot::channel(); let handle = tokio::spawn(async move { std::thread::spawn(move || { std::thread::sl...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
9b486357ed1aa008afa09e95965eb6c94a8753a1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/rt_basic.rs
241
300
tokio-rs/tokio:tokio/tests/rt_basic.rs:8
expected = "A Tokio 1.x context was found, but timers are disabled. Call `enable_time` on the runtime builder to enable timers." )] fn timeout_panics_when_no_time_handle() { let rt = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); rt.block_on(async { let (_tx, rx) = one...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
9b486357ed1aa008afa09e95965eb6c94a8753a1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/rt_basic.rs
281
340
tokio-rs/tokio:tokio/tests/rt_basic.rs:9
let rt = Builder::new_current_thread() .unhandled_panic(UnhandledPanic::ShutdownRuntime) .build() .unwrap(); let rt1 = Arc::new(rt); let rt2 = rt1.clone(); let _ = std::thread::spawn(move || { rt2.block_on(async { tokio::spawn(asy...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
9b486357ed1aa008afa09e95965eb6c94a8753a1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/rt_basic.rs
321
380
tokio-rs/tokio:tokio/tests/rt_basic.rs:10
for _ in 0..N { let rt = rt.clone(); let tx = tx.clone(); ths.push(std::thread::spawn(move || { rt.block_on(async { tx.send(()).unwrap(); futures::future::pending::<()>().await; }); })); } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
b5709baa917494043e21589adb10347c57361f1f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b5709baa917494043e21589adb10347c57361f1f/tokio/tests/rt_basic.rs
361
420
tokio-rs/tokio:tokio/tests/rt_basic.rs:11
#[test] fn rng_seed_multi_enter() { let seed = b"bytes used to generate seed"; let rt = tokio::runtime::Builder::new_current_thread() .rng_seed(RngSeed::from_bytes(seed)) .build() .unwrap(); rt.block_on(async { let random = tokio::macros::supp...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
b5709baa917494043e21589adb10347c57361f1f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b5709baa917494043e21589adb10347c57361f1f/tokio/tests/rt_basic.rs
401
433
tokio-rs/tokio:tokio/tests/rt_basic.rs:7
#[cfg_attr(tokio_wasi, ignore = "WASI: std::thread::spawn not supported")] #[test] fn spawn_remote() { let rt = rt(); let out = rt.block_on(async { let (tx, rx) = oneshot::channel(); let handle = tokio::spawn(async move { std::thread::spawn(move || { std::thread::sl...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/rt_basic.rs
241
300
tokio-rs/tokio:tokio/tests/rt_basic.rs:8
expected = "A Tokio 1.x context was found, but timers are disabled. Call `enable_time` on the runtime builder to enable timers." )] fn timeout_panics_when_no_time_handle() { let rt = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); rt.block_on(async { let (_tx, rx) = one...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/rt_basic.rs
281
340
tokio-rs/tokio:tokio/tests/rt_basic.rs:10
for _ in 0..N { let rt = rt.clone(); let tx = tx.clone(); ths.push(std::thread::spawn(move || { rt.block_on(async { tx.send(()).unwrap(); futures::future::pending::<()>().await; }); })); } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/rt_basic.rs
361
391
tokio-rs/tokio:tokio/tests/rt_basic.rs:7
#[cfg_attr(target_os = "wasi", ignore = "WASI: std::thread::spawn not supported")] #[test] fn spawn_remote() { let rt = rt(); let out = rt.block_on(async { let (tx, rx) = oneshot::channel(); let handle = tokio::spawn(async move { std::thread::spawn(move || { std::th...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/rt_basic.rs
241
300
tokio-rs/tokio:tokio/tests/rt_basic.rs:8
expected = "A Tokio 1.x context was found, but timers are disabled. Call `enable_time` on the runtime builder to enable timers." )] fn timeout_panics_when_no_time_handle() { let rt = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); rt.block_on(async { let (_tx, rx) = one...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/rt_basic.rs
281
340
tokio-rs/tokio:tokio/tests/rt_basic.rs:5
Poll::Pending } } impl Drop for ContextOnDrop { fn drop(&mut self) { if tokio::runtime::Handle::try_current().is_ok() { SUCCESS.store(true, Ordering::SeqCst); } } } let rt = rt(); rt.spawn(ContextOnDrop); drop(rt); assert!(SU...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/tests/rt_basic.rs
161
220
tokio-rs/tokio:tokio/tests/rt_basic.rs:6
let _join = rt.spawn(async move { rx.await }); rt.block_on(async { tokio::task::yield_now().await; panic!("boom"); }); } #[test] fn spawn_two() { let rt = rt(); let out = rt.block_on(async { let (tx, rx) = oneshot::channel(); tokio::spawn(async move { toki...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/tests/rt_basic.rs
201
260
tokio-rs/tokio:tokio/tests/rt_basic.rs:7
#[test] fn spawn_remote() { let rt = rt(); let out = rt.block_on(async { let (tx, rx) = oneshot::channel(); let handle = tokio::spawn(async move { std::thread::spawn(move || { std::thread::sleep(Duration::from_millis(10)); tx.send("ZOMG").unwrap(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/tests/rt_basic.rs
241
300
tokio-rs/tokio:tokio/tests/rt_basic.rs:8
let rt = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); rt.block_on(async { let (_tx, rx) = oneshot::channel::<()>(); let dur = Duration::from_millis(20); let _ = timeout(dur, rx).await; }); } #[cfg(tokio_unstable)] mod unstable { use tokio::runtim...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/tests/rt_basic.rs
281
340
tokio-rs/tokio:tokio/tests/rt_basic.rs:9
.unwrap(); let rt1 = Arc::new(rt); let rt2 = rt1.clone(); let _ = std::thread::spawn(move || { rt2.block_on(async { tokio::spawn(async { panic!("boom"); }); futures::future::pending::<()>().await; }) ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/tests/rt_basic.rs
321
380
tokio-rs/tokio:tokio/tests/rt_basic.rs:10
tx.send(()).unwrap(); futures::future::pending::<()>().await; }); })); } for _ in 0..N { rx.recv().unwrap(); } rt.spawn(async { panic!("boom"); }); for th in ths { assert!(th.join().is_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
c98be229ff3a4e1e230711844b7e38a30cb64f2c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c98be229ff3a4e1e230711844b7e38a30cb64f2c/tokio/tests/rt_basic.rs
361
386
tokio-rs/tokio:tokio/tests/rt_basic.rs:7
#[test] fn spawn_remote() { let rt = rt(); let out = rt.block_on(async { let (tx, rx) = oneshot::channel(); let handle = tokio::spawn(async move { std::thread::spawn(move || { std::thread::sleep(Duration::from_millis(10)); tx.send("ZOMG").unwrap(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
24f4ee31f0266a97547a81f510726da9c1bb9ec9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/tests/rt_basic.rs
241
296
tokio-rs/tokio:tokio/tests/rt_basic.rs:8
let rt = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); rt.block_on(async { let (_tx, rx) = oneshot::channel::<()>(); let dur = Duration::from_millis(20); let _ = timeout(dur, rx).await; }); } fn rt() -> Runtime { tokio::runtime::Builder::new_curre...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
24f4ee31f0266a97547a81f510726da9c1bb9ec9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/tests/rt_basic.rs
281
296
tokio-rs/tokio:tokio/tests/rt_basic.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; use tokio::sync::oneshot; use tokio::time::{timeout, Duration}; use tokio_test::{assert_err, assert_ok}; use std::future::Future; use std::pin::Pin; use std::sync::atomic::{AtomicBool, Ordering}; use std::task::{Context, Poll}; use std:...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
e951d55720689ae5058d8af97a71a66d063f87cd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e951d55720689ae5058d8af97a71a66d063f87cd/tokio/tests/rt_basic.rs
1
60
tokio-rs/tokio:tokio/tests/rt_basic.rs:2
use std::pin::Pin; use std::sync::{ atomic::{AtomicUsize, Ordering::SeqCst}, Arc, }; use std::task::{Context, Poll}; use tokio_stream::{Stream, StreamExt}; pin_project! { struct TrackPolls<S> { npolls: Arc<AtomicUsize>, #[pin] s: S, ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
e951d55720689ae5058d8af97a71a66d063f87cd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e951d55720689ae5058d8af97a71a66d063f87cd/tokio/tests/rt_basic.rs
41
100
tokio-rs/tokio:tokio/tests/rt_basic.rs:3
rt.spawn(async move { while rx.next().await.is_some() {} }); rt.block_on(async { tokio::task::yield_now().await; }); // should have been polled exactly once: the initial poll assert_eq!(npolls.load(SeqCst), 1); tx.send(()).unwrap(); rt.block_on(async { tokio::task::yield_now()....
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
e951d55720689ae5058d8af97a71a66d063f87cd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e951d55720689ae5058d8af97a71a66d063f87cd/tokio/tests/rt_basic.rs
81
140
tokio-rs/tokio:tokio/tests/rt_basic.rs:4
rt.spawn(async move { let _ = rx1.await; tx2.send(()).unwrap(); unreachable!(); }); // Spawn a task that will never notify rt.spawn(async move { pending::<()>().await; tx1.send(()).unwrap(); }); // Tick the loop rt.block_on(async { task::yield_no...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
e951d55720689ae5058d8af97a71a66d063f87cd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e951d55720689ae5058d8af97a71a66d063f87cd/tokio/tests/rt_basic.rs
121
180
tokio-rs/tokio:tokio/tests/rt_basic.rs:5
} } let rt = rt(); rt.spawn(ContextOnDrop); drop(rt); assert!(SUCCESS.load(Ordering::SeqCst)); } #[test] #[should_panic(expected = "boom")] fn wake_in_drop_after_panic() { let (tx, rx) = oneshot::channel::<()>(); struct WakeOnDrop(Option<oneshot::Sender<()>>); impl Drop for WakeOnDr...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
e951d55720689ae5058d8af97a71a66d063f87cd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e951d55720689ae5058d8af97a71a66d063f87cd/tokio/tests/rt_basic.rs
161
220
tokio-rs/tokio:tokio/tests/rt_basic.rs:6
#[should_panic( expected = "A Tokio 1.x context was found, but timers are disabled. Call `enable_time` on the runtime builder to enable timers." )] fn timeout_panics_when_no_time_handle() { let rt = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); rt.block_on(async { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
e951d55720689ae5058d8af97a71a66d063f87cd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e951d55720689ae5058d8af97a71a66d063f87cd/tokio/tests/rt_basic.rs
201
220
tokio-rs/tokio:tokio/tests/rt_basic.rs:4
rt.spawn(async move { let _ = rx1.await; tx2.send(()).unwrap(); unreachable!(); }); // Spawn a task that will never notify rt.spawn(async move { pending::<()>().await; tx1.send(()).unwrap(); }); // Tick the loop rt.block_on(async { task::yield_no...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
1f8105588c06c41c90c3c77628d10cde4b3b2edb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1f8105588c06c41c90c3c77628d10cde4b3b2edb/tokio/tests/rt_basic.rs
121
180
tokio-rs/tokio:tokio/tests/rt_basic.rs:5
} } let rt = rt(); rt.spawn(ContextOnDrop); drop(rt); assert!(SUCCESS.load(Ordering::SeqCst)); } #[test] #[should_panic( expected = "A Tokio 1.x context was found, but timers are disabled. Call `enable_time` on the runtime builder to enable timers." )] fn timeout_panics_when_no_time_handle() ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
1f8105588c06c41c90c3c77628d10cde4b3b2edb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1f8105588c06c41c90c3c77628d10cde4b3b2edb/tokio/tests/rt_basic.rs
161
191
tokio-rs/tokio:tokio/tests/rt_basic.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; use tokio::sync::oneshot; use tokio_test::{assert_err, assert_ok}; use std::thread; use tokio::time::{timeout, Duration}; mod support { pub(crate) mod mpsc_stream; } #[test] fn spawned_task_does_not_progress_without_block_on() { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
fdde5583f853655fec57c44928b7d5f01621b754
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fdde5583f853655fec57c44928b7d5f01621b754/tokio/tests/rt_basic.rs
1
60
tokio-rs/tokio:tokio/tests/rt_basic.rs:2
}; use std::task::{Context, Poll}; use tokio_stream::{Stream, StreamExt}; pin_project! { struct TrackPolls<S> { npolls: Arc<AtomicUsize>, #[pin] s: S, } } impl<S> Stream for TrackPolls<S> where S: Stream, { type Item = S::...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
fdde5583f853655fec57c44928b7d5f01621b754
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fdde5583f853655fec57c44928b7d5f01621b754/tokio/tests/rt_basic.rs
41
100
tokio-rs/tokio:tokio/tests/rt_basic.rs:3
// should have been polled exactly once: the initial poll assert_eq!(npolls.load(SeqCst), 1); tx.send(()).unwrap(); rt.block_on(async { tokio::task::yield_now().await; }); // should have been polled twice more: once to yield Some(), then once to yield Pending assert_eq!(npolls.load(Seq...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
fdde5583f853655fec57c44928b7d5f01621b754
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fdde5583f853655fec57c44928b7d5f01621b754/tokio/tests/rt_basic.rs
81
140
tokio-rs/tokio:tokio/tests/rt_basic.rs:4
}); // Spawn a task that will never notify rt.spawn(async move { pending::<()>().await; tx1.send(()).unwrap(); }); // Tick the loop rt.block_on(async { task::yield_now().await; }); // Drop the rt drop(rt); } #[test] #[should_panic( expected = "A Tokio 1.x ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
fdde5583f853655fec57c44928b7d5f01621b754
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fdde5583f853655fec57c44928b7d5f01621b754/tokio/tests/rt_basic.rs
121
158
tokio-rs/tokio:tokio/tests/rt_basic.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; use tokio::sync::oneshot; use tokio_test::{assert_err, assert_ok}; use std::thread; use std::time::Duration; mod support { pub(crate) mod mpsc_stream; } #[test] fn spawned_task_does_not_progress_without_block_on() { let (tx, m...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/rt_basic.rs
1
60
tokio-rs/tokio:tokio/tests/rt_basic.rs:3
// should have been polled exactly once: the initial poll assert_eq!(npolls.load(SeqCst), 1); tx.send(()).unwrap(); rt.block_on(async { tokio::task::yield_now().await; }); // should have been polled twice more: once to yield Some(), then once to yield Pending assert_eq!(npolls.load(Seq...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/rt_basic.rs
81
140
tokio-rs/tokio:tokio/tests/rt_basic.rs:4
}); // Spawn a task that will never notify rt.spawn(async move { pending::<()>().await; tx1.send(()).unwrap(); }); // Tick the loop rt.block_on(async { task::yield_now().await; }); // Drop the rt drop(rt); } fn rt() -> Runtime { tokio::runtime::Builder::ne...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
8efa62013b551d5130791c3a79ce8ab5cb0b5abf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/rt_basic.rs
121
143
tokio-rs/tokio:tokio/tests/rt_basic.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; use tokio::sync::{mpsc, oneshot}; use tokio_test::{assert_err, assert_ok}; use std::thread; use std::time::Duration; #[test] fn spawned_task_does_not_progress_without_block_on() { let (tx, mut rx) = oneshot::channel(); let rt ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/tests/rt_basic.rs
1
60
tokio-rs/tokio:tokio/tests/rt_basic.rs:2
pin_project! { struct TrackPolls<S> { npolls: Arc<AtomicUsize>, #[pin] s: S, } } impl<S> Stream for TrackPolls<S> where S: Stream, { type Item = S::Item; fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<S...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/tests/rt_basic.rs
41
100
tokio-rs/tokio:tokio/tests/rt_basic.rs:3
}); // should have been polled twice more: once to yield Some(), then once to yield Pending assert_eq!(npolls.load(SeqCst), 1 + 2); drop(tx); rt.block_on(async { tokio::task::yield_now().await; }); // should have been polled once more: to yield None assert_eq!(npolls.load(SeqCst),...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/tests/rt_basic.rs
81
136
tokio-rs/tokio:tokio/tests/rt_basic.rs:4
// Tick the loop rt.block_on(async { task::yield_now().await; }); // Drop the rt drop(rt); } fn rt() -> Runtime { tokio::runtime::Builder::new_current_thread() .enable_all() .build() .unwrap() }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/tests/rt_basic.rs
121
136
tokio-rs/tokio:tokio/tests/rt_basic.rs:3
}); // should have been polled twice more: once to yield Some(), then once to yield Pending assert_eq!(npolls.load(SeqCst), 1 + 2); drop(tx); rt.block_on(async { tokio::task::yield_now().await; }); // should have been polled once more: to yield None assert_eq!(npolls.load(SeqCst),...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
d600ab9a8f37e9eff3fa8587069a816b65b6da0b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/tests/rt_basic.rs
81
137
tokio-rs/tokio:tokio/tests/rt_basic.rs:4
// Tick the loop rt.block_on(async { task::yield_now().await; }); // Drop the rt drop(rt); } fn rt() -> Runtime { tokio::runtime::Builder::new() .basic_scheduler() .enable_all() .build() .unwrap() }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
d600ab9a8f37e9eff3fa8587069a816b65b6da0b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d600ab9a8f37e9eff3fa8587069a816b65b6da0b/tokio/tests/rt_basic.rs
121
137
tokio-rs/tokio:tokio/tests/rt_basic.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; use tokio::sync::{mpsc, oneshot}; use tokio_test::{assert_err, assert_ok}; use std::thread; use std::time::Duration; #[test] fn spawned_task_does_not_progress_without_block_on() { let (tx, mut rx) = oneshot::channel(); let mut...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
6b6e76080afc92450238df69c4edc12ee5f7518d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6b6e76080afc92450238df69c4edc12ee5f7518d/tokio/tests/rt_basic.rs
1
60
tokio-rs/tokio:tokio/tests/rt_basic.rs:2
pin_project! { struct TrackPolls<S> { npolls: Arc<AtomicUsize>, #[pin] s: S, } } impl<S> Stream for TrackPolls<S> where S: Stream, { type Item = S::Item; fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<S...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
6b6e76080afc92450238df69c4edc12ee5f7518d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6b6e76080afc92450238df69c4edc12ee5f7518d/tokio/tests/rt_basic.rs
41
100
tokio-rs/tokio:tokio/tests/rt_basic.rs:3
}); // should have been polled twice more: once to yield Some(), then once to yield Pending assert_eq!(npolls.load(SeqCst), 1 + 2); drop(tx); rt.block_on(async { tokio::task::yield_now().await; }); // should have been polled once more: to yield None assert_eq!(npolls.load(SeqCst),...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
6b6e76080afc92450238df69c4edc12ee5f7518d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6b6e76080afc92450238df69c4edc12ee5f7518d/tokio/tests/rt_basic.rs
81
137
tokio-rs/tokio:tokio/tests/rt_basic.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; use tokio::sync::{mpsc, oneshot}; use tokio_test::{assert_err, assert_ok}; use std::thread; use std::time::Duration; #[test] fn spawned_task_does_not_progress_without_block_on() { let (tx, mut rx) = oneshot::channel(); let mut...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
4010335c84517571e9b2d13f66f7c72170493622
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4010335c84517571e9b2d13f66f7c72170493622/tokio/tests/rt_basic.rs
1
60
tokio-rs/tokio:tokio/tests/rt_basic.rs:2
npolls: Arc<AtomicUsize>, s: S, } impl<S> Stream for TrackPolls<S> where S: Stream, { type Item = S::Item; fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> { // safety: we do not move s let this = unsafe { self....
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
4010335c84517571e9b2d13f66f7c72170493622
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4010335c84517571e9b2d13f66f7c72170493622/tokio/tests/rt_basic.rs
41
100
tokio-rs/tokio:tokio/tests/rt_basic.rs:3
// should have been polled twice more: once to yield Some(), then once to yield Pending assert_eq!(npolls.load(SeqCst), 1 + 2); drop(tx); rt.block_on(async { tokio::task::yield_now().await; }); // should have been polled once more: to yield None assert_eq!(npolls.load(SeqCst), 1 + 2 + ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
4010335c84517571e9b2d13f66f7c72170493622
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4010335c84517571e9b2d13f66f7c72170493622/tokio/tests/rt_basic.rs
81
135
tokio-rs/tokio:tokio/tests/rt_basic.rs:4
rt.block_on(async { task::yield_now().await; }); // Drop the rt drop(rt); } fn rt() -> Runtime { tokio::runtime::Builder::new() .basic_scheduler() .enable_all() .build() .unwrap() }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
4010335c84517571e9b2d13f66f7c72170493622
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4010335c84517571e9b2d13f66f7c72170493622/tokio/tests/rt_basic.rs
121
135
tokio-rs/tokio:tokio/tests/rt_basic.rs:2
npolls: Arc<AtomicUsize>, s: S, } impl<S> Stream for TrackPolls<S> where S: Stream, { type Item = S::Item; fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> { // safety: we do not move s let this = unsafe { self....
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
c1232a65207e3b2d42d82b9144658f6293287089
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c1232a65207e3b2d42d82b9144658f6293287089/tokio/tests/rt_basic.rs
41
100
tokio-rs/tokio:tokio/tests/rt_basic.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; use tokio::sync::oneshot; use tokio_test::{assert_err, assert_ok}; use std::thread; use std::time::Duration; #[test] fn spawned_task_does_not_progress_without_block_on() { let (tx, mut rx) = oneshot::channel(); let mut rt = rt...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
6406328176cdecf15cad69b327597a4d4d0b8e20
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6406328176cdecf15cad69b327597a4d4d0b8e20/tokio/tests/rt_basic.rs
1
60
tokio-rs/tokio:tokio/tests/rt_basic.rs:2
let _ = rx2.await; unreachable!(); }); rt.spawn(async move { let _ = rx1.await; tx2.send(()).unwrap(); unreachable!(); }); // Spawn a task that will never notify rt.spawn(async move { pending::<()>().await; tx1.send(()).unwrap(); }); // Tick...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
6406328176cdecf15cad69b327597a4d4d0b8e20
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6406328176cdecf15cad69b327597a4d4d0b8e20/tokio/tests/rt_basic.rs
41
72
tokio-rs/tokio:tokio/tests/rt_basic.rs:2
let _ = rx2.await; unreachable!(); }); rt.spawn(async move { let _ = rx1.await; tx2.send(()).unwrap(); unreachable!(); }); // Spawn a task that will never notify rt.spawn(async move { pending::<()>().await; tx1.send(()).unwrap(); }); // Tick...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
855d39f849cc16d3c68df5abf0bbb28e3351cdf0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/855d39f849cc16d3c68df5abf0bbb28e3351cdf0/tokio/tests/rt_basic.rs
41
100
tokio-rs/tokio:tokio/tests/rt_basic.rs:3
let mut rt = rt(); let h1 = rt.handle().clone(); rt.handle().spawn(async move { // Ensure a waker gets stored in oneshot 1. let _ = rx1.await; tx3.send(()).unwrap(); }); rt.handle().spawn(async move { // When this task is dropped, we'll be "closing remotes". //...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
855d39f849cc16d3c68df5abf0bbb28e3351cdf0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/855d39f849cc16d3c68df5abf0bbb28e3351cdf0/tokio/tests/rt_basic.rs
81
131
tokio-rs/tokio:tokio/tests/rt_basic.rs:4
// Drop the rt drop(rt); } fn rt() -> Runtime { tokio::runtime::Builder::new() .basic_scheduler() .enable_all() .build() .unwrap() }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
855d39f849cc16d3c68df5abf0bbb28e3351cdf0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/855d39f849cc16d3c68df5abf0bbb28e3351cdf0/tokio/tests/rt_basic.rs
121
131
tokio-rs/tokio:tokio/tests/rt_basic.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; use tokio::sync::oneshot; use tokio_test::{assert_err, assert_ok}; use std::thread; use std::time::Duration; #[test] fn spawned_task_does_not_progress_without_block_on() { let (tx, mut rx) = oneshot::channel(); let mut rt = rt...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
41d15ea212525f4be310d65c29c626488af546e1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/41d15ea212525f4be310d65c29c626488af546e1/tokio/tests/rt_basic.rs
1
60
tokio-rs/tokio:tokio/tests/rt_basic.rs:2
let _ = rx2.await; unreachable!(); }); rt.spawn(async move { let _ = rx1.await; let _ = tx2.send(()).unwrap(); unreachable!(); }); // Spawn a task that will never notify rt.spawn(async move { pending::<()>().await; tx1.send(()).unwrap(); }); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
41d15ea212525f4be310d65c29c626488af546e1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/41d15ea212525f4be310d65c29c626488af546e1/tokio/tests/rt_basic.rs
41
72
tokio-rs/tokio:tokio/tests/rt_basic.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::runtime::Runtime; use tokio::sync::oneshot; use tokio_test::{assert_err, assert_ok}; use std::thread; use std::time::Duration; #[test] fn spawned_task_does_not_progress_without_block_on() { let (tx, mut rx) = oneshot::channel(); let mut rt = rt...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/rt_basic.rs
1
36
tokio-rs/tokio:tokio/tests/rt_basic.rs:1
#![warn(rust_2018_idioms)] use tokio::runtime::Runtime; use tokio::sync::oneshot; use tokio_test::{assert_err, assert_ok}; use std::thread; use std::time::Duration; #[test] fn spawned_task_does_not_progress_without_block_on() { let (tx, mut rx) = oneshot::channel(); let mut rt = rt(); rt.spawn(async mo...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_basic.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/tests/rt_basic.rs
1
35
tokio-rs/tokio:tokio/tests/rt_common.rs:1
#![allow(clippy::needless_range_loop)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(not(miri))] // Tests to run on both current-thread & multi-thread runtime variants. macro_rules! rt_test { ($($t:tt)*) => { mod current_thread_scheduler { $($t)* #[cfg(not(target_os=...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
1
60
tokio-rs/tokio:tokio/tests/rt_common.rs:2
#[cfg(not(target_os = "wasi"))] // Wasi doesn't support threads mod threaded_scheduler_1_thread { $($t)* const NUM_WORKERS: usize = 1; fn rt() -> Arc<Runtime> { tokio::runtime::Builder::new_multi_thread() .worker_threads(1) ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
41
100
tokio-rs/tokio:tokio/tests/rt_common.rs:3
use std::future::{poll_fn, Future}; use std::pin::Pin; #[cfg(not(target_os="wasi"))] use std::sync::mpsc; use std::sync::Arc; use std::task::{Context, Poll}; #[cfg(not(target_os="wasi"))] use std::thread; use std::time::{Duration, Instant}; #[test] fn block_on_sync() { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
81
140
tokio-rs/tokio:tokio/tests/rt_common.rs:4
}); assert_eq!(out, "ZOMG"); } #[test] fn spawn_one_bg() { let rt = rt(); let out = rt.block_on(async { let (tx, rx) = oneshot::channel(); tokio::spawn(async move { tx.send("ZOMG").unwrap(); }); assert_ok!(rx.await)...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
121
180
tokio-rs/tokio:tokio/tests/rt_common.rs:5
}); assert_eq!(out, "ZOMG"); } #[test] fn spawn_two() { let rt = rt(); let out = rt.block_on(async { let (tx1, rx1) = oneshot::channel(); let (tx2, rx2) = oneshot::channel(); tokio::spawn(async move { assert_ok!(tx1.send("ZOMG")...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
161
220
tokio-rs/tokio:tokio/tests/rt_common.rs:6
let mut txs = (0..ITER) .map(|i| { let (tx, rx) = oneshot::channel(); let done_tx = done_tx.clone(); tokio::spawn(async move { let msg = assert_ok!(rx.await); assert_eq!(i, msg); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
201
260
tokio-rs/tokio:tokio/tests/rt_common.rs:7
#[test] fn spawn_many_from_task() { use tokio::sync::mpsc; const ITER: usize = 500; let rt = rt(); let out = rt.block_on(async { tokio::spawn(async move { let (done_tx, mut done_rx) = mpsc::unbounded_channel(); let mut txs = (0..ITER) ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
241
300
tokio-rs/tokio:tokio/tests/rt_common.rs:8
out.sort_unstable(); out }).await.unwrap() }); assert_eq!(ITER, out.len()); for i in 0..ITER { assert_eq!(i, out[i]); } } #[test] fn spawn_one_from_block_on_called_on_handle() { let rt = rt(); let (tx, rx) = oneshot::...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
281
340
tokio-rs/tokio:tokio/tests/rt_common.rs:9
let out = rt.block_on(async { assert_ok!(tokio::spawn(async { assert_ok!(tokio::spawn(async { "hello" }).await) }).await) }); assert_eq!(out, "hello"); } #[test] fn outstanding_tasks_dropped() { let rt = rt...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
321
380
tokio-rs/tokio:tokio/tests/rt_common.rs:10
rt1.block_on(async { rt2.block_on(async { "hello" }) }); } #[test] fn create_rt_in_block_on() { let rt1 = rt(); let rt2 = rt1.block_on(async { rt() }); let out = rt2.block_on(async { "ZOMG" }); assert_eq!(out, "ZOMG"); } #[cfg(not(target_os="wasi"))] // Wasi does n...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
361
420
tokio-rs/tokio:tokio/tests/rt_common.rs:11
rt.block_on(async { let (tx1, rx1) = oneshot::channel(); let (tx2, rx2) = oneshot::channel(); // Spin hard tokio::spawn(async { loop { yield_once().await; } }); thread::spawn(move || { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
401
460
tokio-rs/tokio:tokio/tests/rt_common.rs:12
}); rt.block_on(async move { assert_ok!(rx.await); }); } #[cfg(not(target_os="wasi"))] // Wasi does not support threads #[test] fn spawn_from_other_thread_under_load() { let rt = rt(); let handle = rt.clone(); let (tx, rx) = oneshot::channel(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
441
500
tokio-rs/tokio:tokio/tests/rt_common.rs:13
rt.block_on(async move { time::sleep(dur).await; }); assert!(now.elapsed() >= dur); } #[test] fn sleep_in_spawn() { let rt = rt(); let now = Instant::now(); let dur = Duration::from_millis(50); rt.block_on(async move { let (tx, rx) ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
481
540
tokio-rs/tokio:tokio/tests/rt_common.rs:14
tokio::spawn(async move { let _ = listener.accept().await; tx.send(()).unwrap(); }); TcpStream::connect(&addr).await.unwrap(); rx.await.unwrap(); }); } #[cfg(not(target_os="wasi"))] // Wasi does not support threads #[test] fn ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
521
580
tokio-rs/tokio:tokio/tests/rt_common.rs:15
} #[cfg(not(target_os="wasi"))] // Wasi does not support threads #[test] fn sleep_from_blocking() { let rt = rt(); rt.block_on(async move { assert_ok!(tokio::task::spawn_blocking(|| { let now = std::time::Instant::now(); let dur = Duration::from_...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
561
620
tokio-rs/tokio:tokio/tests/rt_common.rs:16
// Wait for the client to connect let _ = assert_ok!(listener.accept().await); assert_ok!(peer.await); }); } #[cfg(not(target_os="wasi"))] // Wasi does not support threads #[test] fn always_active_parker() { // This test it to show that we will always have ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
601
660
tokio-rs/tokio:tokio/tests/rt_common.rs:17
#[test] // IOCP requires setting the "max thread" concurrency value. The sane, // default, is to set this to the number of cores. Threads that poll I/O // become associated with the IOCP handle. Once those threads sleep for any // reason (mutex), they yield their ownership. // // This test hits ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
641
700
tokio-rs/tokio:tokio/tests/rt_common.rs:18
let (mut stream, _) = assert_ok!(listener.accept().await); assert_ok!(stream.write_all(b"hello world").await); }); let cli = tokio::spawn(async move { let mut stream = assert_ok!(TcpStream::connect(addr).await); let mut dst = vec![0; 11]; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
681
740
tokio-rs/tokio:tokio/tests/rt_common.rs:19
} panic!("yield_defers_until_park is failing consistently"); } /// Same as above, but with cooperative scheduling. #[test] #[cfg(not(target_os="wasi"))] #[cfg_attr(miri, ignore)] // No `socket` in miri. fn coop_yield_defers_until_park() { for _ in 0..10 { if yield_d...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
721
780
tokio-rs/tokio:tokio/tests/rt_common.rs:20
for _ in 0..(NUM_WORKERS-1) { let flag = flag.clone(); let barrier = barrier.clone(); tokio::spawn(async move { barrier.wait(); while !flag.load(SeqCst) { std::thread::sleep(std::time::Duration::from_millis...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
761
820
tokio-rs/tokio:tokio/tests/rt_common.rs:21
if cnt >= 10 { // yielded too many times; report failure and // sleep forever so that the `fail_test` branch // of the `select!` below triggers. let _ = fail_test.send(()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
801
860
tokio-rs/tokio:tokio/tests/rt_common.rs:22
fn client_server_block_on() { let rt = rt(); let (tx, rx) = mpsc::channel(); rt.block_on(async move { client_server(tx).await }); assert_ok!(rx.try_recv()); assert_err!(rx.try_recv()); } #[cfg_attr(target_os = "wasi", ignore = "Wasi does not support threads or panic re...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
841
900
tokio-rs/tokio:tokio/tests/rt_common.rs:23
#[cfg_attr(target_os = "wasi", ignore = "Wasi does not support panic recovery")] fn panic_in_block_on() { let rt = rt(); rt.block_on(async { panic!() }); } #[cfg(not(target_os="wasi"))] // Wasi does not support threads async fn yield_once() { let mut yielded = false; pol...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
881
940
tokio-rs/tokio:tokio/tests/rt_common.rs:24
impl Future for Never { type Output = (); fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<()> { Poll::Pending } } impl Drop for Never { fn drop(&mut self) { self.drop_tx.send(()).unwrap(); } ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
921
980
tokio-rs/tokio:tokio/tests/rt_common.rs:25
impl<F: FnMut()> Drop for OnDrop<F> { fn drop(&mut self) { (self.0)() } } let (tx1, rx1) = oneshot::channel(); let (tx2, rx2) = oneshot::channel(); let barrier = Arc::new(Barrier::new(3)); let barrier1 = barrier.clone(); let barri...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
961
1,020
tokio-rs/tokio:tokio/tests/rt_common.rs:26
drop(rt); } #[cfg(not(target_os="wasi"))] // Wasi doesn't support UDP or bind() #[cfg_attr(miri, ignore)] // No `socket` in miri. #[test] fn io_notify_while_shutting_down() { use tokio::net::UdpSocket; use std::sync::Arc; for _ in 1..10 { let runtime = rt(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
1,001
1,060
tokio-rs/tokio:tokio/tests/rt_common.rs:27
#[cfg(not(target_os="wasi"))] // Wasi does not support threads #[test] fn shutdown_timeout() { let (tx, rx) = oneshot::channel(); let runtime = rt(); runtime.block_on(async move { task::spawn_blocking(move || { tx.send(()).unwrap(); thread::sl...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
1,041
1,100
tokio-rs/tokio:tokio/tests/rt_common.rs:28
}); Arc::try_unwrap(runtime).unwrap().shutdown_timeout(Duration::from_secs(10_000)); } // This test is currently ignored on Windows because of a // rust-lang issue in thread local storage destructors. // See https://github.com/rust-lang/rust/issues/74875 #[test] #[cfg(not(windows))] ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
1,081
1,140
tokio-rs/tokio:tokio/tests/rt_common.rs:29
let (mut socket, _) = server.accept().await.unwrap(); // Write some data socket.write_all(b"hello").await.unwrap(); }); let mut client = TcpStream::connect(&addr).await.unwrap(); let mut buf = vec![]; client.read_to_end(&mut buf).await.unwrap(); assert...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
1,121
1,180
tokio-rs/tokio:tokio/tests/rt_common.rs:30
#[test] fn local_set_client_server_block_on() { let rt = rt(); let (tx, rx) = mpsc::channel(); let local = task::LocalSet::new(); local.block_on(&rt, async move { client_server_local(tx).await }); assert_ok!(rx.try_recv()); assert_err!(rx.try_recv()); } #[...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/rt_common.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_common.rs
1,161
1,220