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/process_issue_2174.rs:1 | #![cfg(feature = "process")]
#![warn(rust_2018_idioms)]
// This test reveals a difference in behavior of kqueue on FreeBSD. When the
// reader disconnects, there does not seem to be an `EVFILT_WRITE` filter that
// is returned.
//
// It is expected that `EVFILT_WRITE` would be returned with either the
// `EV_EOF` or `E... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_2174.rs | MIT | 78f2340d259487d4470681f97cc4b5eac719e178 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/78f2340d259487d4470681f97cc4b5eac719e178/tokio/tests/process_issue_2174.rs | 1 | 45 |
tokio-rs/tokio:tokio/tests/process_issue_2174.rs:1 | #![cfg(feature = "process")]
#![warn(rust_2018_idioms)]
// This test reveals a difference in behavior of kqueue on FreeBSD. When the
// reader disconnects, there does not seem to be an `EVFILT_WRITE` filter that
// is returned.
//
// It is expected that `EVFILT_WRITE` would be returned with either the
// `EV_EOF` or `E... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_2174.rs | MIT | 53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/process_issue_2174.rs | 1 | 45 |
tokio-rs/tokio:tokio/tests/process_issue_2174.rs:1 | #![cfg(feature = "process")]
#![warn(rust_2018_idioms)]
// This test reveals a difference in behavior of kqueue on FreeBSD. When the
// reader disconnects, there does not seem to be an `EVFILT_WRITE` filter that
// is returned.
//
// It is expected that `EVFILT_WRITE` would be returned with either the
// `EV_EOF` or `E... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_2174.rs | MIT | 7c254eca446e56bbc41cbc309c2588f2d241f46a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c254eca446e56bbc41cbc309c2588f2d241f46a/tokio/tests/process_issue_2174.rs | 1 | 45 |
tokio-rs/tokio:tokio/tests/process_issue_2174.rs:1 | #![cfg(feature = "process")]
#![warn(rust_2018_idioms)]
// This test reveals a difference in behavior of kqueue on FreeBSD. When the
// reader disconnects, there does not seem to be an `EVFILT_WRITE` filter that
// is returned.
//
// It is expected that `EVFILT_WRITE` would be returned with either the
// `EV_EOF` or `E... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_2174.rs | MIT | 842d5565bdd4310cd96386a8ffa9949b24c5856f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/842d5565bdd4310cd96386a8ffa9949b24c5856f/tokio/tests/process_issue_2174.rs | 1 | 46 |
tokio-rs/tokio:tokio/tests/process_issue_2174.rs:1 | #![cfg(feature = "process")]
#![warn(rust_2018_idioms)]
// This test reveals a difference in behavior of kqueue on FreeBSD. When the
// reader disconnects, there does not seem to be an `EVFILT_WRITE` filter that
// is returned.
//
// It is expected that `EVFILT_WRITE` would be returned with either the
// `EV_EOF` or `E... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_2174.rs | MIT | 10f1507cf44b62f4b126ecdd28351e4a4a1ce3f7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10f1507cf44b62f4b126ecdd28351e4a4a1ce3f7/tokio/tests/process_issue_2174.rs | 1 | 46 |
tokio-rs/tokio:tokio/tests/process_issue_42.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(not(miri))]
use futures::future::join_all;
use std::process::Stdio;
use tokio::process::Command;
use tokio::task;
#[tokio::test]
async fn issue_42() {
// We spawn a many batches of processes which should exit at roughly the
// same time... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_42.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/process_issue_42.rs | 1 | 39 |
tokio-rs/tokio:tokio/tests/process_issue_42.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
#![cfg(not(miri))]
use futures::future::join_all;
use std::process::Stdio;
use tokio::process::Command;
use tokio::task;
#[tokio::test]
async fn issue_42() {
// We spawn a many batches of processes which should exit at roughly the
// same time... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_42.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/process_issue_42.rs | 1 | 39 |
tokio-rs/tokio:tokio/tests/process_issue_42.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use futures::future::join_all;
use std::process::Stdio;
use tokio::process::Command;
use tokio::task;
#[tokio::test]
async fn issue_42() {
// We spawn a many batches of processes which should exit at roughly the
// same time (modulo OS schedul... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_42.rs | MIT | 842d5565bdd4310cd96386a8ffa9949b24c5856f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/842d5565bdd4310cd96386a8ffa9949b24c5856f/tokio/tests/process_issue_42.rs | 1 | 38 |
tokio-rs/tokio:tokio/tests/process_issue_42.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use futures::future::join_all;
use std::process::Stdio;
use tokio::process::Command;
use tokio::task;
#[tokio::test]
async fn issue_42() {
// We spawn a many batches of processes which should exit at roughly the
// same time (modulo OS schedul... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_42.rs | MIT | d593c5b051f07bde5117122216a356632986b6dd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/tests/process_issue_42.rs | 1 | 36 |
tokio-rs/tokio:tokio/tests/process_issue_42.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use futures::future::join_all;
use std::process::Stdio;
use tokio::process::Command;
use tokio::task;
#[tokio::test]
async fn issue_42() {
// We spawn a many batches of processes which should exit at roughly the
// same time (modulo OS schedul... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_42.rs | MIT | 939a0dd7b0c0f0c82d335a1a6038877aa90df01a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/939a0dd7b0c0f0c82d335a1a6038877aa90df01a/tokio/tests/process_issue_42.rs | 1 | 36 |
tokio-rs/tokio:tokio/tests/process_issue_42.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use tokio::process::Command;
use tokio::runtime;
use futures::future::FutureExt;
use futures::stream::FuturesOrdered;
use std::process::Stdio;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::thread;
use std::time::Duration;... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_42.rs | MIT | e20dff39ce3eaba7ec40e3ecbbd5e737d07427eb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e20dff39ce3eaba7ec40e3ecbbd5e737d07427eb/tokio/tests/process_issue_42.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/process_issue_42.rs:2 | }
});
drop(rt);
finished_clone.store(true, Ordering::SeqCst);
});
thread::sleep(Duration::from_millis(1000));
assert!(
finished.load(Ordering::SeqCst),
"FINISHED flag not set, maybe we deadlocked?"
);
}
#[test]
fn issue_42() {
let max = 10;
for i in 0..... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_42.rs | MIT | e20dff39ce3eaba7ec40e3ecbbd5e737d07427eb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e20dff39ce3eaba7ec40e3ecbbd5e737d07427eb/tokio/tests/process_issue_42.rs | 41 | 62 |
tokio-rs/tokio:tokio/tests/process_issue_42.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(unix)]
use tokio::process::Command;
use tokio::runtime;
use futures::future::FutureExt;
use futures::stream::FuturesOrdered;
use std::process::Stdio;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::thread;
use std::time::Duration;... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_42.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/process_issue_42.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/process_issue_42.rs:2 | });
drop(rt);
finished_clone.store(true, Ordering::SeqCst);
});
thread::sleep(Duration::from_millis(1000));
assert!(
finished.load(Ordering::SeqCst),
"FINISHED flag not set, maybe we deadlocked?"
);
}
#[test]
fn issue_42() {
let max = 10;
for i in 0..max {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_42.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/process_issue_42.rs | 41 | 61 |
tokio-rs/tokio:tokio/tests/process_issue_42.rs:1 | #![cfg(feature = "process")]
#![cfg(unix)]
#![warn(rust_2018_idioms)]
use tokio::process::Command;
use tokio::runtime;
use futures::future::FutureExt;
use futures::stream::FuturesOrdered;
use std::process::Stdio;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::thread;
use std::time::Durati... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_42.rs | MIT | 8546ff826db8dba1e39b4119ad909fb6cab2492a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/tests/process_issue_42.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/process_issue_42.rs:1 | #![cfg(feature = "process")]
#![cfg(unix)]
#![warn(rust_2018_idioms)]
use tokio::process::Command;
use tokio::runtime;
use futures::future::FutureExt;
use futures::stream::FuturesOrdered;
use std::process::Stdio;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::thread;
use std::time::Durati... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_42.rs | MIT | 3f0eabe7798de624f5ee9c7562803bfb97e6088f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3f0eabe7798de624f5ee9c7562803bfb97e6088f/tokio/tests/process_issue_42.rs | 1 | 57 |
tokio-rs/tokio:tokio/tests/process_issue_42.rs:1 | #![cfg(feature = "process")]
#![cfg(unix)]
#![warn(rust_2018_idioms)]
use tokio::process::Command;
use tokio::runtime;
use futures::future::FutureExt;
use futures::stream::FuturesOrdered;
use std::process::Stdio;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::thread;
use std::time::Durati... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_42.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/process_issue_42.rs | 1 | 57 |
tokio-rs/tokio:tokio/tests/process_issue_42.rs:1 | #![cfg(feature = "process")]
#![cfg(unix)]
#![warn(rust_2018_idioms)]
use tokio::process::Command;
use tokio::runtime;
use futures_util::future::FutureExt;
use futures_util::stream::FuturesOrdered;
use std::process::Stdio;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::thread;
use std::ti... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_42.rs | MIT | d70c928d88dff9e3e8d673b8ee02bce131598550 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d70c928d88dff9e3e8d673b8ee02bce131598550/tokio/tests/process_issue_42.rs | 1 | 57 |
tokio-rs/tokio:tokio/tests/process_issue_7144.rs:1 | #![cfg(feature = "process")]
#![warn(rust_2018_idioms)]
#![cfg(target_os = "linux")]
#![cfg(not(miri))]
use tokio::process::Command;
use tokio::time::{sleep, Duration};
#[tokio::test]
async fn issue_7144() {
let mut threads = vec![];
for _ in 0..20 {
threads.push(tokio::spawn(test_one()));
}
f... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_7144.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/process_issue_7144.rs | 1 | 36 |
tokio-rs/tokio:tokio/tests/process_issue_7144.rs:1 | #![cfg(feature = "process")]
#![warn(rust_2018_idioms)]
#![cfg(target_os = "linux")]
#![cfg(not(miri))]
use tokio::process::Command;
use tokio::time::{sleep, Duration};
#[tokio::test]
async fn issue_7144() {
let mut threads = vec![];
for _ in 0..20 {
threads.push(tokio::spawn(test_one()));
}
f... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_issue_7144.rs | MIT | 1979615cbf1cc4b4d296814957394703827362d0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1979615cbf1cc4b4d296814957394703827362d0/tokio/tests/process_issue_7144.rs | 1 | 28 |
tokio-rs/tokio:tokio/tests/process_kill_after_wait.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi/Miri cannot run system commands
use tokio::process::Command;
#[tokio::test]
async fn kill_after_wait() {
let mut cmd;
if cfg!(windows) {
cmd = Command::new("cmd");
cmd.arg("/c");
} else {... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_kill_after_wait.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/process_kill_after_wait.rs | 1 | 27 |
tokio-rs/tokio:tokio/tests/process_kill_after_wait.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi cannot run system commands
use tokio::process::Command;
#[tokio::test]
async fn kill_after_wait() {
let mut cmd;
if cfg!(windows) {
cmd = Command::new("cmd");
cmd.arg("/c");
} else {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_kill_after_wait.rs | MIT | 13fbdace6632cda301d8816d715cc929edf9b3f0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/13fbdace6632cda301d8816d715cc929edf9b3f0/tokio/tests/process_kill_after_wait.rs | 1 | 27 |
tokio-rs/tokio:tokio/tests/process_kill_on_drop.rs:1 | #![cfg(all(unix, feature = "process", not(miri)))]
#![warn(rust_2018_idioms)]
use std::io::ErrorKind;
use std::process::Stdio;
use std::time::Duration;
use tokio::io::AsyncReadExt;
use tokio::process::Command;
use tokio::time::sleep;
use tokio_test::assert_ok;
#[tokio::test]
async fn kill_on_drop() {
let mut cmd ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_kill_on_drop.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/process_kill_on_drop.rs | 1 | 44 |
tokio-rs/tokio:tokio/tests/process_kill_on_drop.rs:1 | #![cfg(all(unix, feature = "process"))]
#![warn(rust_2018_idioms)]
use std::io::ErrorKind;
use std::process::Stdio;
use std::time::Duration;
use tokio::io::AsyncReadExt;
use tokio::process::Command;
use tokio::time::sleep;
use tokio_test::assert_ok;
#[tokio::test]
async fn kill_on_drop() {
let mut cmd = Command::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_kill_on_drop.rs | MIT | 0c8e8248f8de281f22ad6f30b967053f44fff66e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0c8e8248f8de281f22ad6f30b967053f44fff66e/tokio/tests/process_kill_on_drop.rs | 1 | 44 |
tokio-rs/tokio:tokio/tests/process_kill_on_drop.rs:1 | #![cfg(all(unix, feature = "process"))]
#![warn(rust_2018_idioms)]
use std::io::ErrorKind;
use std::process::Stdio;
use std::time::Duration;
use tokio::io::AsyncReadExt;
use tokio::process::Command;
use tokio::time::sleep;
use tokio_test::assert_ok;
#[tokio::test]
async fn kill_on_drop() {
let mut cmd = Command::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_kill_on_drop.rs | MIT | b67d46403fd7d1df364ff5319231630f6bbc8779 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b67d46403fd7d1df364ff5319231630f6bbc8779/tokio/tests/process_kill_on_drop.rs | 1 | 44 |
tokio-rs/tokio:tokio/tests/process_kill_on_drop.rs:1 | #![cfg(all(unix, feature = "process"))]
#![warn(rust_2018_idioms)]
use std::process::Stdio;
use std::time::Duration;
use tokio::io::AsyncReadExt;
use tokio::process::Command;
use tokio::time::sleep;
use tokio_test::assert_ok;
#[tokio::test]
async fn kill_on_drop() {
let mut cmd = Command::new("bash");
cmd.arg... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_kill_on_drop.rs | MIT | 7ae8135b62057be6b1691f04b27eabe285b05efd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7ae8135b62057be6b1691f04b27eabe285b05efd/tokio/tests/process_kill_on_drop.rs | 1 | 42 |
tokio-rs/tokio:tokio/tests/process_kill_on_drop.rs:1 | #![cfg(all(unix, feature = "process"))]
#![warn(rust_2018_idioms)]
use std::process::Stdio;
use std::time::Duration;
use tokio::io::AsyncReadExt;
use tokio::process::Command;
use tokio::time::sleep;
use tokio_test::assert_ok;
#[tokio::test]
async fn kill_on_drop() {
let mut cmd = Command::new("sh");
cmd.args(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_kill_on_drop.rs | MIT | 53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5/tokio/tests/process_kill_on_drop.rs | 1 | 42 |
tokio-rs/tokio:tokio/tests/process_kill_on_drop.rs:1 | #![cfg(all(unix, feature = "process"))]
#![warn(rust_2018_idioms)]
use std::process::Stdio;
use std::time::Duration;
use tokio::io::AsyncReadExt;
use tokio::process::Command;
use tokio::time::delay_for;
use tokio_test::assert_ok;
#[tokio::test]
async fn kill_on_drop() {
let mut cmd = Command::new("sh");
cmd.a... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_kill_on_drop.rs | MIT | 188fc6e0d24acf2cf1b51209e058a5c1a1d50dca | github | async-runtime | https://github.com/tokio-rs/tokio/blob/188fc6e0d24acf2cf1b51209e058a5c1a1d50dca/tokio/tests/process_kill_on_drop.rs | 1 | 42 |
tokio-rs/tokio:tokio/tests/process_kill_on_drop.rs:1 | #![cfg(all(unix, feature = "process"))]
#![warn(rust_2018_idioms)]
use std::process::Stdio;
use std::time::Duration;
use tokio::io::AsyncReadExt;
use tokio::process::Command;
use tokio::time::delay_for;
use tokio_test::assert_ok;
#[tokio::test]
async fn kill_on_drop() {
let mut cmd = Command::new("sh");
cmd.a... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_kill_on_drop.rs | MIT | e20dff39ce3eaba7ec40e3ecbbd5e737d07427eb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e20dff39ce3eaba7ec40e3ecbbd5e737d07427eb/tokio/tests/process_kill_on_drop.rs | 1 | 42 |
tokio-rs/tokio:tokio/tests/process_raw_handle.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(windows)]
#![cfg(not(miri))]
use tokio::process::Command;
use windows_sys::Win32::System::Threading::GetProcessId;
#[tokio::test]
async fn obtain_raw_handle() {
let mut cmd = Command::new("cmd");
cmd.kill_on_drop(true);
cmd.arg("/c");
cmd.arg... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_raw_handle.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/process_raw_handle.rs | 1 | 24 |
tokio-rs/tokio:tokio/tests/process_raw_handle.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(windows)]
use tokio::process::Command;
use windows_sys::Win32::System::Threading::GetProcessId;
#[tokio::test]
async fn obtain_raw_handle() {
let mut cmd = Command::new("cmd");
cmd.kill_on_drop(true);
cmd.arg("/c");
cmd.arg("pause");
let... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_raw_handle.rs | MIT | 299bd6aee3f0ff30a719b327759c088a10813ac8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/299bd6aee3f0ff30a719b327759c088a10813ac8/tokio/tests/process_raw_handle.rs | 1 | 23 |
tokio-rs/tokio:tokio/tests/process_raw_handle.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(windows)]
use tokio::process::Command;
use winapi::um::processthreadsapi::GetProcessId;
#[tokio::test]
async fn obtain_raw_handle() {
let mut cmd = Command::new("cmd");
cmd.kill_on_drop(true);
cmd.arg("/c");
cmd.arg("pause");
let child =... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_raw_handle.rs | MIT | f957f7f9a7363db3a2640b55354c38958acc9c79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f957f7f9a7363db3a2640b55354c38958acc9c79/tokio/tests/process_raw_handle.rs | 1 | 23 |
tokio-rs/tokio:tokio/tests/process_smoke.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi/Miri cannot run system commands
use tokio::process::Command;
use tokio_test::assert_ok;
#[tokio::test]
async fn simple() {
let mut cmd;
if cfg!(windows) {
cmd = Command::new("cmd");
cmd.arg("... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_smoke.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/process_smoke.rs | 1 | 34 |
tokio-rs/tokio:tokio/tests/process_smoke.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi cannot run system commands
use tokio::process::Command;
use tokio_test::assert_ok;
#[tokio::test]
async fn simple() {
let mut cmd;
if cfg!(windows) {
cmd = Command::new("cmd");
cmd.arg("/c");... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_smoke.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/process_smoke.rs | 1 | 34 |
tokio-rs/tokio:tokio/tests/process_smoke.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi cannot run system commands
use tokio::process::Command;
use tokio_test::assert_ok;
#[tokio::test]
async fn simple() {
let mut cmd;
if cfg!(windows) {
cmd = Command::new("cmd");
cmd.arg("/c");
} else... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_smoke.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/process_smoke.rs | 1 | 34 |
tokio-rs/tokio:tokio/tests/process_smoke.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi cannot run system commands
use tokio::process::Command;
use tokio_test::assert_ok;
#[tokio::test]
async fn simple() {
let mut cmd;
if cfg!(windows) {
cmd = Command::new("cmd");
cmd.arg("/c");
} else {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_smoke.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/process_smoke.rs | 1 | 34 |
tokio-rs/tokio:tokio/tests/process_smoke.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::process::Command;
use tokio_test::assert_ok;
#[tokio::test]
async fn simple() {
let mut cmd;
if cfg!(windows) {
cmd = Command::new("cmd");
cmd.arg("/c");
} else {
cmd = Command::new("sh");
cmd.arg("-c");
}... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_smoke.rs | MIT | 842d5565bdd4310cd96386a8ffa9949b24c5856f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/842d5565bdd4310cd96386a8ffa9949b24c5856f/tokio/tests/process_smoke.rs | 1 | 34 |
tokio-rs/tokio:tokio/tests/process_smoke.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::process::Command;
use tokio_test::assert_ok;
#[tokio::test]
async fn simple() {
let mut cmd;
if cfg!(windows) {
cmd = Command::new("cmd");
cmd.arg("/c");
} else {
cmd = Command::new("sh");
cmd.arg("-c");
}... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/process_smoke.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/process_smoke.rs | 1 | 29 |
tokio-rs/tokio:tokio/tests/reactor.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "default")]
use tokio_net::driver::Reactor;
use tokio_net::tcp::TcpListener;
use tokio_test::{assert_ok, assert_pending};
use futures_util::task::{waker_ref, ArcWake};
use std::future::Future;
use std::net::TcpStream;
use std::pin::Pin;
use std::sync::{mpsc, Arc, Mutex};
us... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c/tokio/tests/reactor.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/reactor.rs:2 | // that same lock in order to clean up state.
//
// To simulate this case, we create a fake executor that does nothing when
// the task is notified. This simulates an executor in the process of
// shutting down. Then, when the task handle is dropped, the task itself is
// dropped.
let mut react... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc1640891e1cb4a2bf1ab032452e0e3ef6daf22c/tokio/tests/reactor.rs | 41 | 84 |
tokio-rs/tokio:tokio/tests/reactor.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "default")]
use tokio_net::driver::Reactor;
use tokio_net::tcp::TcpListener;
use tokio_test::{assert_ok, assert_pending};
use futures_util::task::{waker_ref, ArcWake};
use std::future::Future;
use std::net::TcpStream;
use std::pin::Pin;
use std::sync::{mpsc, Arc, Mutex};
us... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | a791f4a758604768463d3ca2162b913dcea34c40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a791f4a758604768463d3ca2162b913dcea34c40/tokio/tests/reactor.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/reactor.rs:2 | // that same lock in order to clean up state.
//
// To simulate this case, we create a fake executor that does nothing when
// the task is notified. This simulates an executor in the process of
// shutting down. Then, when the task handle is dropped, the task itself is
// dropped.
let mut react... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | a791f4a758604768463d3ca2162b913dcea34c40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a791f4a758604768463d3ca2162b913dcea34c40/tokio/tests/reactor.rs | 41 | 85 |
tokio-rs/tokio:tokio/tests/reactor.rs:1 | #![feature(async_await)]
#![warn(rust_2018_idioms)]
#![cfg(feature = "default")]
use tokio_net::driver::Reactor;
use tokio_net::tcp::TcpListener;
use tokio_test::{assert_ok, assert_pending};
use futures_util::task::{waker_ref, ArcWake};
use std::future::Future;
use std::net::TcpStream;
use std::pin::Pin;
use std::syn... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | 4788d3a9e3dd037424442c98e9f26b93a33a2077 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4788d3a9e3dd037424442c98e9f26b93a33a2077/tokio/tests/reactor.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/reactor.rs:2 | // notifying, held a lock and the task being dropped attempted to acquire
// that same lock in order to clean up state.
//
// To simulate this case, we create a fake executor that does nothing when
// the task is notified. This simulates an executor in the process of
// shutting down. Then, when the... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | 4788d3a9e3dd037424442c98e9f26b93a33a2077 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4788d3a9e3dd037424442c98e9f26b93a33a2077/tokio/tests/reactor.rs | 41 | 86 |
tokio-rs/tokio:tokio/tests/reactor.rs:1 | #![feature(async_await)]
#![warn(rust_2018_idioms)]
#![cfg(feature = "default")]
use tokio_net::driver::Reactor;
use tokio_tcp::TcpListener;
use tokio_test::{assert_ok, assert_pending};
use futures_util::task::{waker_ref, ArcWake};
use std::future::Future;
use std::net::TcpStream;
use std::pin::Pin;
use std::sync::{m... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | f1f61a3b15d17767b12bfd8c0c5712db1b089b0b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f1f61a3b15d17767b12bfd8c0c5712db1b089b0b/tokio/tests/reactor.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/reactor.rs:1 | #![feature(async_await)]
#![warn(rust_2018_idioms)]
#![cfg(feature = "default")]
use tokio_net::Reactor;
use tokio_tcp::TcpListener;
use tokio_test::{assert_ok, assert_pending};
use futures_util::task::{waker_ref, ArcWake};
use std::future::Future;
use std::net::TcpStream;
use std::pin::Pin;
use std::sync::{mpsc, Arc... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | 37131b21144de133628b54a1de500b623058f8cf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/37131b21144de133628b54a1de500b623058f8cf/tokio/tests/reactor.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/reactor.rs:2 | // notifying, held a lock and the task being dropped attempted to acquire
// that same lock in order to clean up state.
//
// To simulate this case, we create a fake executor that does nothing when
// the task is notified. This simulates an executor in the process of
// shutting down. Then, when the... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | 37131b21144de133628b54a1de500b623058f8cf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/37131b21144de133628b54a1de500b623058f8cf/tokio/tests/reactor.rs | 41 | 86 |
tokio-rs/tokio:tokio/tests/reactor.rs:2 | // notifying, held a lock and the task being dropped attempted to acquire
// that same lock in order to clean up state.
//
// To simulate this case, we create a fake executor that does nothing when
// the task is notified. This simulates an executor in the process of
// shutting down. Then, when the... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | 8538c25170240fa46313ffe9d4a9a2f9ba2536e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8538c25170240fa46313ffe9d4a9a2f9ba2536e5/tokio/tests/reactor.rs | 41 | 84 |
tokio-rs/tokio:tokio/tests/reactor.rs:1 | #![feature(async_await)]
#![warn(rust_2018_idioms)]
#![cfg(feature = "default")]
use tokio_reactor::Reactor;
use tokio_tcp::TcpListener;
use tokio_test::{assert_ok, assert_pending};
use futures_util::task::{waker_ref, ArcWake};
use std::future::Future;
use std::net::TcpStream;
use std::pin::Pin;
use std::sync::{mpsc,... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | 930cce86771d318c640a16483b8b27d48844a8d7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/930cce86771d318c640a16483b8b27d48844a8d7/tokio/tests/reactor.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/reactor.rs:2 | // notifying, held a lock and the task being dropped attempted to acquire
// that same lock in order to clean up state.
//
// To simulate this case, we create a fake executor that does nothing when
// the task is notified. This simulates an executor in the process of
// shutting down. Then, when the... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | 930cce86771d318c640a16483b8b27d48844a8d7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/930cce86771d318c640a16483b8b27d48844a8d7/tokio/tests/reactor.rs | 41 | 84 |
tokio-rs/tokio:tokio/tests/reactor.rs:1 | #![feature(async_await)]
#![warn(rust_2018_idioms)]
#![cfg(feature = "default")]
use tokio_reactor::Reactor;
use tokio_tcp::TcpListener;
use tokio_test::{assert_ok, assert_pending};
use futures_util::task::ArcWake;
use std::future::Future;
use std::net::TcpStream;
use std::pin::Pin;
use std::sync::{mpsc, Arc, Mutex};... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | 73102760cfe1632b6b8073dfa5a506c0e69e4b5e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/73102760cfe1632b6b8073dfa5a506c0e69e4b5e/tokio/tests/reactor.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/reactor.rs:2 | // notifying, held a lock and the task being dropped attempted to acquire
// that same lock in order to clean up state.
//
// To simulate this case, we create a fake executor that does nothing when
// the task is notified. This simulates an executor in the process of
// shutting down. Then, when the... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | 73102760cfe1632b6b8073dfa5a506c0e69e4b5e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/73102760cfe1632b6b8073dfa5a506c0e69e4b5e/tokio/tests/reactor.rs | 41 | 84 |
tokio-rs/tokio:tokio/tests/reactor.rs:1 | #![feature(async_await)]
#![deny(warnings, rust_2018_idioms)]
#![cfg(feature = "default")]
use tokio_reactor::Reactor;
use tokio_tcp::TcpListener;
use tokio_test::{assert_ok, assert_pending};
use futures_util::task::ArcWake;
use std::future::Future;
use std::net::TcpStream;
use std::pin::Pin;
use std::sync::{mpsc, Ar... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | 962521f449dead58eb37eb46857bc6c52ee3a8da | github | async-runtime | https://github.com/tokio-rs/tokio/blob/962521f449dead58eb37eb46857bc6c52ee3a8da/tokio/tests/reactor.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/reactor.rs:1 | #![cfg(feature = "broken")]
#![deny(warnings, rust_2018_idioms)]
use futures::executor::{spawn, Notify, Spawn};
use futures::{Future, Stream};
use std::mem;
use std::net::TcpStream;
use std::sync::{Arc, Mutex};
use tokio_executor;
use tokio_reactor;
use tokio_reactor::Reactor;
use tokio_tcp::TcpListener;
#[test]
fn t... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/reactor.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/reactor.rs:2 | mem::forget(task.clone());
mem::forget(task);
id
}
fn drop_id(&self, id: usize) {
let ptr = id as *const Task;
let _ = unsafe { Arc::from_raw(ptr) };
}
}
let addr = "127.0.0.1:0".parse().unwrap();
let mut reactor = Reactor::new().unw... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | 29e417c257c62ae95cfa73f6b56825b3f833dde8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/29e417c257c62ae95cfa73f6b56825b3f833dde8/tokio/tests/reactor.rs | 41 | 89 |
tokio-rs/tokio:tokio/tests/reactor.rs:1 | #![deny(warnings, rust_2018_idioms)]
use futures::executor::{spawn, Notify, Spawn};
use futures::{Future, Stream};
use std::mem;
use std::net::TcpStream;
use std::sync::{Arc, Mutex};
use tokio_executor;
use tokio_reactor;
use tokio_reactor::Reactor;
use tokio_tcp::TcpListener;
#[test]
fn test_drop_on_notify() {
/... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/reactor.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/reactor.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/read_to_string.rs:1 | use std::io;
use tokio::io::AsyncReadExt;
use tokio_test::io::Builder;
#[tokio::test]
async fn to_string_does_not_truncate_on_utf8_error() {
let data = vec![0xff, 0xff, 0xff];
let mut s = "abc".to_string();
match AsyncReadExt::read_to_string(&mut data.as_slice(), &mut s).await {
Ok(len) => panic!... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/read_to_string.rs | MIT | 2da15b5f246f25138edcddced725b71f1b2b7cc9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2da15b5f246f25138edcddced725b71f1b2b7cc9/tokio/tests/read_to_string.rs | 1 | 49 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::runtime::{self, 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};
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_basic.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:2 | let out = rt.block_on(async { assert_ok!(rx.await) });
assert_eq!(out, "hello");
}
#[test]
fn no_extra_poll() {
use pin_project_lite::pin_project;
use std::pin::Pin;
use std::sync::{
atomic::{AtomicUsize, Ordering::SeqCst},
Arc,
};
use std::task::{Context, Poll};
use tokio_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_basic.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:3 | s: rx,
};
let npolls = Arc::clone(&rx.npolls);
let rt = rt();
// TODO: could probably avoid this, but why not.
let mut rx = Box::pin(rx);
rt.spawn(async move { while rx.next().await.is_some() {} });
rt.block_on(async {
tokio::task::yield_now().await;
});
// should have be... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_basic.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:4 | let (tx2, rx2) = oneshot::channel();
let rt = rt();
rt.spawn(async move {
let _ = rx2.await;
unreachable!();
});
rt.spawn(async move {
let _ = rx1.await;
tx2.send(()).unwrap();
unreachable!();
});
// Spawn a task that will never notify
rt.spawn(asy... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_basic.rs | 121 | 180 |
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 | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_basic.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:6 | // dropped.
rt.spawn(async move {
let _wake_on_drop = WakeOnDrop(Some(tx2));
let _ = rx1.await;
unreachable!()
});
rt.spawn(async move {
let _wake_on_drop = WakeOnDrop(Some(tx1));
let _ = rx2.await;
unreachable!()
});
rt.block_on(async {
toki... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_basic.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:7 | assert_eq!(0, metrics.remote_schedule_count());
let mut local = 0;
for i in 0..metrics.num_workers() {
local += metrics.worker_local_schedule_count(i);
}
assert_eq!(2, local);
}
}
#[cfg_attr(target_os = "wasi", ignore = "WASI: std::thread::spawn not supported")]
#[test... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_basic.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:8 | local += metrics.worker_local_schedule_count(i);
}
assert_eq!(1, local);
}
}
#[test]
#[cfg_attr(target_os = "wasi", ignore = "Wasi does not support panic recovery")]
#[should_panic(
expected = "A Tokio 1.x context was found, but timers are disabled. Call `enable_time` on the runtime builder to... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_basic.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:9 | assert_ne!(rt1.handle().name().unwrap(), rt2.handle().name().unwrap());
}
#[cfg(tokio_unstable)]
mod unstable {
use tokio::runtime::{Builder, RngSeed, UnhandledPanic};
#[test]
#[should_panic(
expected = "a spawned task panicked and the runtime is configured to shut down on unhandled panic"
)]
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_basic.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:10 | let _ = std::thread::spawn(move || {
rt2.block_on(async {
tokio::spawn(async {
panic!("boom");
});
futures::future::pending::<()>().await;
})
})
.join();
let task = rt1.spawn(async {});
let res ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_basic.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:11 | }
for _ in 0..N {
rx.recv().unwrap();
}
rt.spawn(async {
panic!("boom");
});
for thread in threads {
assert!(thread.join().is_err());
}
}
#[test]
fn rng_seed() {
let seed = b"bytes used to generate seed";
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_basic.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:12 | assert_eq!(rt1_values, rt2_values);
}
#[test]
fn rng_seed_multi_enter() {
let seed = b"bytes used to generate seed";
fn two_rand_values() -> (u32, u32) {
let rand_1 = tokio::macros::support::thread_rng_n(100);
let rand_2 = tokio::macros::support::thread_rng_n(100);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_basic.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:13 | #[test]
fn before_park_yields() {
use futures::task::ArcWake;
use std::sync::Arc;
use tokio::runtime::Builder;
use tokio::sync::Notify;
struct MyWaker(Notify);
impl ArcWake for MyWaker {
fn wake_by_ref(arc_self: &Arc<Self>) {
arc_self.0.notify_one();
}
}
le... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/rt_basic.rs | 481 | 520 |
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 | 934f68d91c90777235e119f4b42f3de660c45bd0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/934f68d91c90777235e119f4b42f3de660c45bd0/tokio/tests/rt_basic.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:8 | local += metrics.worker_local_schedule_count(i);
}
assert_eq!(1, local);
}
}
#[test]
#[cfg_attr(target_os = "wasi", ignore = "Wasi does not support panic recovery")]
#[should_panic(
expected = "A Tokio 1.x context was found, but timers are disabled. Call `enable_time` on the runtime builder to... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | 934f68d91c90777235e119f4b42f3de660c45bd0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/934f68d91c90777235e119f4b42f3de660c45bd0/tokio/tests/rt_basic.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:9 | });
futures::future::pending::<()>().await;
})
}
#[test]
#[cfg_attr(target_os = "wasi", ignore = "Wasi does not support panic recovery")]
fn spawns_do_nothing() {
use std::sync::Arc;
let rt = Builder::new_current_thread()
.unhandled_panic(UnhandledPanic... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | 934f68d91c90777235e119f4b42f3de660c45bd0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/934f68d91c90777235e119f4b42f3de660c45bd0/tokio/tests/rt_basic.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:10 | let rt = Builder::new_current_thread()
.unhandled_panic(UnhandledPanic::ShutdownRuntime)
.build()
.unwrap();
let rt = Arc::new(rt);
let mut threads = vec![];
let (tx, rx) = mpsc::channel();
for _ in 0..N {
let rt = rt.clone();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | 934f68d91c90777235e119f4b42f3de660c45bd0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/934f68d91c90777235e119f4b42f3de660c45bd0/tokio/tests/rt_basic.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:11 | .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 rt2 = tokio::runtime::Builder::new_current_thread()
.rng_see... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | 934f68d91c90777235e119f4b42f3de660c45bd0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/934f68d91c90777235e119f4b42f3de660c45bd0/tokio/tests/rt_basic.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:12 | 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.block_on(async { two_rand_values() });
assert_eq!(rt1_values_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | 934f68d91c90777235e119f4b42f3de660c45bd0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/934f68d91c90777235e119f4b42f3de660c45bd0/tokio/tests/rt_basic.rs | 441 | 499 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:13 | let rt = Builder::new_current_thread()
.enable_all()
.on_thread_park(move || {
if !woken2.swap(true, Ordering::SeqCst) {
let mut cx = Context::from_waker(&waker);
// `yield_now` pushes the waker to the defer slot.
let fut = std::pin::pin!(tokio... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | 934f68d91c90777235e119f4b42f3de660c45bd0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/934f68d91c90777235e119f4b42f3de660c45bd0/tokio/tests/rt_basic.rs | 481 | 499 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:11 | .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 rt2 = tokio::runtime::Builder::new_current_thread()
.rng_see... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | a708ad19cb9ae652d8a813554e68cb1d86593eb9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a708ad19cb9ae652d8a813554e68cb1d86593eb9/tokio/tests/rt_basic.rs | 401 | 458 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:12 | 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.block_on(async { two_rand_values() });
assert_eq!(rt1_values_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | a708ad19cb9ae652d8a813554e68cb1d86593eb9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a708ad19cb9ae652d8a813554e68cb1d86593eb9/tokio/tests/rt_basic.rs | 441 | 458 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:9 | });
futures::future::pending::<()>().await;
})
}
#[test]
#[cfg_attr(target_os = "wasi", ignore = "Wasi does not support panic recovery")]
fn spawns_do_nothing() {
use std::sync::Arc;
let rt = Builder::new_current_thread()
.unhandled_panic(UnhandledPanic... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | c03a37fa0b88ec20df22bec2b035852fd1eab44e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/rt_basic.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:10 | let rt = Builder::new_current_thread()
.unhandled_panic(UnhandledPanic::ShutdownRuntime)
.build()
.unwrap();
let rt = Arc::new(rt);
let mut ths = vec![];
let (tx, rx) = mpsc::channel();
for _ in 0..N {
let rt = rt.clone();
let... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | c03a37fa0b88ec20df22bec2b035852fd1eab44e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c03a37fa0b88ec20df22bec2b035852fd1eab44e/tokio/tests/rt_basic.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(not(miri))] // Possible bug on Miri.
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, Orderin... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | 7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/rt_basic.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:2 | assert_err!(rx.try_recv());
let out = rt.block_on(async { assert_ok!(rx.await) });
assert_eq!(out, "hello");
}
#[test]
fn no_extra_poll() {
use pin_project_lite::pin_project;
use std::pin::Pin;
use std::sync::{
atomic::{AtomicUsize, Ordering::SeqCst},
Arc,
};
use std::task... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | 7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/rt_basic.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:3 | npolls: Arc::new(AtomicUsize::new(0)),
s: rx,
};
let npolls = Arc::clone(&rx.npolls);
let rt = rt();
// TODO: could probably avoid this, but why not.
let mut rx = Box::pin(rx);
rt.spawn(async move { while rx.next().await.is_some() {} });
rt.block_on(async {
tokio::task::yi... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | 7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/rt_basic.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:4 | let (tx1, rx1) = oneshot::channel();
let (tx2, rx2) = oneshot::channel();
let rt = rt();
rt.spawn(async move {
let _ = rx2.await;
unreachable!();
});
rt.spawn(async move {
let _ = rx1.await;
tx2.send(()).unwrap();
unreachable!();
});
// Spawn a tas... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | 7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/rt_basic.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:5 | fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<()> {
Poll::Pending
}
}
impl Drop for ContextOnDrop {
fn drop(&mut self) {
if tokio::runtime::Handle::try_current().is_ok() {
SUCCESS.store(true, Ordering::SeqCst);
}
}
}... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | 7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/rt_basic.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:6 | // handling the "boom" panic, no matter the order in which the tasks are
// dropped.
rt.spawn(async move {
let _wake_on_drop = WakeOnDrop(Some(tx2));
let _ = rx1.await;
unreachable!()
});
rt.spawn(async move {
let _wake_on_drop = WakeOnDrop(Some(tx1));
let _ = rx... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | 7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/rt_basic.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:7 | drop(rt);
assert_eq!(0, metrics.remote_schedule_count());
let mut local = 0;
for i in 0..metrics.num_workers() {
local += metrics.worker_local_schedule_count(i);
}
assert_eq!(2, local);
}
}
#[cfg_attr(target_os = "wasi", ignore = "WASI: std::thread::spawn not s... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | 7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/rt_basic.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:8 | for i in 0..metrics.num_workers() {
local += metrics.worker_local_schedule_count(i);
}
assert_eq!(1, local);
}
}
#[test]
#[cfg_attr(target_os = "wasi", ignore = "Wasi does not support panic recovery")]
#[should_panic(
expected = "A Tokio 1.x context was found, but timers are disabl... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | 7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/rt_basic.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:9 | panic!("boom");
});
futures::future::pending::<()>().await;
})
}
#[test]
#[cfg_attr(target_os = "wasi", ignore = "Wasi does not support panic recovery")]
fn spawns_do_nothing() {
use std::sync::Arc;
let rt = Builder::new_current_thread()
.un... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | 7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/rt_basic.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:10 | use std::sync::{mpsc, Arc};
let rt = Builder::new_current_thread()
.unhandled_panic(UnhandledPanic::ShutdownRuntime)
.build()
.unwrap();
let rt = Arc::new(rt);
let mut ths = vec![];
let (tx, rx) = mpsc::channel();
for _ in 0..N {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | 7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/rt_basic.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:11 | .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 rt2 = tokio::runtime::Builder::new_current_thread()... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/rt_basic.rs | MIT | 7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/rt_basic.rs | 401 | 459 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:1 | #![allow(unknown_lints, unexpected_cfgs)]
#![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![cfg(not(miri))] // Possible bug on Miri.
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;
u... | 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 | 1 | 60 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:2 | assert_err!(rx.try_recv());
let out = rt.block_on(async { assert_ok!(rx.await) });
assert_eq!(out, "hello");
}
#[test]
fn no_extra_poll() {
use pin_project_lite::pin_project;
use std::pin::Pin;
use std::sync::{
atomic::{AtomicUsize, Ordering::SeqCst},
Arc,
};
use std::task... | 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 | 41 | 100 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:3 | let rx = TrackPolls {
npolls: Arc::new(AtomicUsize::new(0)),
s: rx,
};
let npolls = Arc::clone(&rx.npolls);
let rt = rt();
// TODO: could probably avoid this, but why not.
let mut rx = Box::pin(rx);
rt.spawn(async move { while rx.next().await.is_some() {} });
rt.block_on(a... | 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 | 81 | 140 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:6 | // second task. This ensures that we trigger a wakeup on a live task while
// handling the "boom" panic, no matter the order in which the tasks are
// dropped.
rt.spawn(async move {
let _wake_on_drop = WakeOnDrop(Some(tx2));
let _ = rx1.await;
unreachable!()
});
rt.spawn(asy... | 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 | 201 | 260 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:7 | let metrics = rt.metrics();
drop(rt);
assert_eq!(0, metrics.remote_schedule_count());
let mut local = 0;
for i in 0..metrics.num_workers() {
local += metrics.worker_local_schedule_count(i);
}
assert_eq!(2, local);
}
}
#[cfg_attr(target_os = "wasi", igno... | 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 | 241 | 300 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:8 | let mut local = 0;
for i in 0..metrics.num_workers() {
local += metrics.worker_local_schedule_count(i);
}
assert_eq!(1, local);
}
}
#[test]
#[cfg_attr(target_os = "wasi", ignore = "Wasi does not support panic recovery")]
#[should_panic(
expected = "A Tokio 1.x context was f... | 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 | 281 | 340 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:9 | tokio::spawn(async {
panic!("boom");
});
futures::future::pending::<()>().await;
})
}
#[test]
#[cfg_attr(target_os = "wasi", ignore = "Wasi does not support panic recovery")]
fn spawns_do_nothing() {
use std::sync::Arc;
let rt = Builder:... | 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 | 321 | 380 |
tokio-rs/tokio:tokio/tests/rt_basic.rs:10 | const N: usize = 2;
use std::sync::{mpsc, Arc};
let rt = Builder::new_current_thread()
.unhandled_panic(UnhandledPanic::ShutdownRuntime)
.build()
.unwrap();
let rt = Arc::new(rt);
let mut ths = vec![];
let (tx, rx) = mpsc::channel();
... | 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 | 361 | 420 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.