1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
|
Index: tokio/tests/task_join_set.rs
===================================================================
--- tokio.orig/tests/task_join_set.rs
+++ tokio/tests/task_join_set.rs
@@ -14,6 +14,7 @@ fn rt() -> tokio::runtime::Runtime {
}
#[tokio::test(start_paused = true)]
+#[cfg(feature = "test-util")]
async fn test_with_sleep() {
let mut set = JoinSet::new();
@@ -107,6 +108,7 @@ async fn alternating() {
}
#[tokio::test(start_paused = true)]
+#[cfg(feature = "test-util")]
async fn abort_tasks() {
let mut set = JoinSet::new();
let mut num_canceled = 0;
@@ -173,6 +175,7 @@ async fn join_all() {
#[cfg(panic = "unwind")]
#[tokio::test(start_paused = true)]
+#[cfg(feature = "test-util")]
async fn task_panics() {
let mut set: JoinSet<()> = JoinSet::new();
@@ -197,6 +200,7 @@ async fn task_panics() {
}
#[tokio::test(start_paused = true)]
+#[cfg(feature = "test-util")]
async fn abort_all() {
let mut set: JoinSet<()> = JoinSet::new();
Index: tokio/tests/test_clock.rs
===================================================================
--- tokio.orig/tests/test_clock.rs
+++ tokio/tests/test_clock.rs
@@ -1,5 +1,5 @@
#![warn(rust_2018_idioms)]
-#![cfg(feature = "full")]
+#![cfg(all(feature = "full",feature = "test-util"))]
use tokio::time::{self, Duration, Instant};
Index: tokio/src/runtime/time/tests/mod.rs
===================================================================
--- tokio.orig/src/runtime/time/tests/mod.rs
+++ tokio/src/runtime/time/tests/mod.rs
@@ -32,6 +32,7 @@ fn model(f: impl Fn() + Send + Sync + 's
f();
}
+#[cfg(feature = "test-util")]
fn rt(start_paused: bool) -> crate::runtime::Runtime {
crate::runtime::Builder::new_current_thread()
.enable_time()
@@ -41,6 +42,7 @@ fn rt(start_paused: bool) -> crate::runt
}
#[test]
+#[cfg(feature = "test-util")]
fn single_timer() {
model(|| {
let rt = rt(false);
@@ -72,6 +74,7 @@ fn single_timer() {
}
#[test]
+#[cfg(feature = "test-util")]
fn drop_timer() {
model(|| {
let rt = rt(false);
@@ -106,6 +109,7 @@ fn drop_timer() {
}
#[test]
+#[cfg(feature = "test-util")]
fn change_waker() {
model(|| {
let rt = rt(false);
@@ -139,6 +143,7 @@ fn change_waker() {
}
#[test]
+#[cfg(feature = "test-util")]
fn reset_future() {
model(|| {
let finished_early = Arc::new(AtomicBool::new(false));
@@ -204,6 +209,7 @@ fn normal_or_miri<T>(normal: T, miri: T)
#[test]
#[cfg(not(loom))]
+#[cfg(feature = "test-util")]
fn poll_process_levels() {
let rt = rt(true);
let handle = rt.handle();
@@ -239,6 +245,7 @@ fn poll_process_levels() {
#[test]
#[cfg(not(loom))]
+#[cfg(feature = "test-util")]
fn poll_process_levels_targeted() {
let mut context = Context::from_waker(noop_waker_ref());
@@ -261,6 +268,7 @@ fn poll_process_levels_targeted() {
#[test]
#[cfg(not(loom))]
+#[cfg(feature = "test-util")]
fn instant_to_tick_max() {
use crate::runtime::time::entry::MAX_SAFE_MILLIS_DURATION;
Index: tokio/tests/async_send_sync.rs
===================================================================
--- tokio.orig/tests/async_send_sync.rs
+++ tokio/tests/async_send_sync.rs
@@ -556,6 +556,7 @@ assert_value!(tokio::time::Timeout<BoxFu
assert_value!(tokio::time::Timeout<BoxFuture<()>>: !Send & !Sync & !Unpin);
assert_value!(tokio::time::error::Elapsed: Send & Sync & Unpin);
assert_value!(tokio::time::error::Error: Send & Sync & Unpin);
+#[cfg(feature = "test-util")]
async_assert_fn!(tokio::time::advance(Duration): Send & Sync & !Unpin);
async_assert_fn!(tokio::time::sleep(Duration): Send & Sync & !Unpin);
async_assert_fn!(tokio::time::sleep_until(Instant): Send & Sync & !Unpin);
Index: tokio/tests/rt_time_start_paused.rs
===================================================================
--- tokio.orig/tests/rt_time_start_paused.rs
+++ tokio/tests/rt_time_start_paused.rs
@@ -1,4 +1,4 @@
-#![cfg(feature = "full")]
+#![cfg(all(feature = "full", feature = "test-util"))]
use tokio::time::{Duration, Instant};
Index: tokio/tests/sync_mpsc.rs
===================================================================
--- tokio.orig/tests/sync_mpsc.rs
+++ tokio/tests/sync_mpsc.rs
@@ -985,7 +985,7 @@ fn try_recv_close_while_empty_unbounded(
}
#[tokio::test(start_paused = true)]
-#[cfg(feature = "full")]
+#[cfg(all(feature = "test-util",feature = "full"))]
async fn recv_timeout() {
use tokio::sync::mpsc::error::SendTimeoutError::{Closed, Timeout};
use tokio::time::Duration;
Index: tokio/tests/sync_once_cell.rs
===================================================================
--- tokio.orig/tests/sync_once_cell.rs
+++ tokio/tests/sync_once_cell.rs
@@ -1,5 +1,5 @@
#![warn(rust_2018_idioms)]
-#![cfg(feature = "full")]
+#![cfg(all(feature = "full", feature = "test-util"))]
use std::mem;
use std::sync::atomic::{AtomicU32, Ordering};
Index: tokio/tests/time_interval.rs
===================================================================
--- tokio.orig/tests/time_interval.rs
+++ tokio/tests/time_interval.rs
@@ -1,5 +1,5 @@
#![warn(rust_2018_idioms)]
-#![cfg(feature = "full")]
+#![cfg(all(feature = "full", feature = "test-util"))]
use std::pin::Pin;
use std::task::{Context, Poll};
Index: tokio/tests/time_panic.rs
===================================================================
--- tokio.orig/tests/time_panic.rs
+++ tokio/tests/time_panic.rs
@@ -14,6 +14,7 @@ mod support {
use support::panic::test_panic;
#[test]
+#[cfg(feature = "test-util")]
fn pause_panic_caller() -> Result<(), Box<dyn Error>> {
let panic_location_file = test_panic(|| {
let rt = current_thread();
@@ -31,6 +32,7 @@ fn pause_panic_caller() -> Result<(), Bo
}
#[test]
+#[cfg(feature = "test-util")]
fn resume_panic_caller() -> Result<(), Box<dyn Error>> {
let panic_location_file = test_panic(|| {
let rt = current_thread();
Index: tokio/tests/time_pause.rs
===================================================================
--- tokio.orig/tests/time_pause.rs
+++ tokio/tests/time_pause.rs
@@ -1,5 +1,5 @@
#![warn(rust_2018_idioms)]
-#![cfg(feature = "full")]
+#![cfg(all(feature = "full", feature = "test-util"))]
#![cfg(not(miri))] // Too slow on miri.
use rand::SeedableRng;
Index: tokio/tests/time_sleep.rs
===================================================================
--- tokio.orig/tests/time_sleep.rs
+++ tokio/tests/time_sleep.rs
@@ -1,5 +1,5 @@
#![warn(rust_2018_idioms)]
-#![cfg(feature = "full")]
+#![cfg(all(feature = "full", feature = "test-util"))]
#![cfg(not(miri))] // Too slow on Miri.
use std::future::Future;
Index: tokio/tests/time_timeout.rs
===================================================================
--- tokio.orig/tests/time_timeout.rs
+++ tokio/tests/time_timeout.rs
@@ -1,5 +1,5 @@
#![warn(rust_2018_idioms)]
-#![cfg(feature = "full")]
+#![cfg(all(feature = "full",feature = "test-util"))]
use tokio::sync::oneshot;
use tokio::time::{self, timeout, timeout_at, Instant};
|