aboutsummaryrefslogtreecommitdiff
path: root/tests/ready.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ready.rs')
-rw-r--r--tests/ready.rs28
1 files changed, 23 insertions, 5 deletions
diff --git a/tests/ready.rs b/tests/ready.rs
index 700f487..d8dd6ce 100644
--- a/tests/ready.rs
+++ b/tests/ready.rs
@@ -1,5 +1,7 @@
//! Tests for channel readiness using the `Select` struct.
+#![allow(clippy::drop_copy)]
+
use std::any::Any;
use std::cell::Cell;
use std::thread;
@@ -490,6 +492,9 @@ fn nesting() {
#[test]
fn stress_recv() {
+ #[cfg(miri)]
+ const COUNT: usize = 100;
+ #[cfg(not(miri))]
const COUNT: usize = 10_000;
let (s1, r1) = unbounded();
@@ -527,6 +532,9 @@ fn stress_recv() {
#[test]
fn stress_send() {
+ #[cfg(miri)]
+ const COUNT: usize = 100;
+ #[cfg(not(miri))]
const COUNT: usize = 10_000;
let (s1, r1) = bounded(0);
@@ -561,6 +569,9 @@ fn stress_send() {
#[test]
fn stress_mixed() {
+ #[cfg(miri)]
+ const COUNT: usize = 100;
+ #[cfg(not(miri))]
const COUNT: usize = 10_000;
let (s1, r1) = bounded(0);
@@ -606,8 +617,7 @@ fn stress_timeout_two_threads() {
thread::sleep(ms(500));
}
- let done = false;
- while !done {
+ loop {
let mut sel = Select::new();
sel.send(&s);
match sel.ready_timeout(ms(100)) {
@@ -628,15 +638,14 @@ fn stress_timeout_two_threads() {
thread::sleep(ms(500));
}
- let mut done = false;
- while !done {
+ loop {
let mut sel = Select::new();
sel.recv(&r);
match sel.ready_timeout(ms(100)) {
Err(_) => {}
Ok(0) => {
assert_eq!(r.try_recv(), Ok(i));
- done = true;
+ break;
}
Ok(_) => panic!(),
}
@@ -668,6 +677,9 @@ fn send_recv_same_channel() {
#[test]
fn channel_through_channel() {
+ #[cfg(miri)]
+ const COUNT: usize = 100;
+ #[cfg(not(miri))]
const COUNT: usize = 1000;
type T = Box<dyn Any + Send>;
@@ -724,6 +736,9 @@ fn channel_through_channel() {
#[test]
fn fairness1() {
+ #[cfg(miri)]
+ const COUNT: usize = 100;
+ #[cfg(not(miri))]
const COUNT: usize = 10_000;
let (s1, r1) = bounded::<()>(COUNT);
@@ -769,6 +784,9 @@ fn fairness1() {
#[test]
fn fairness2() {
+ #[cfg(miri)]
+ const COUNT: usize = 100;
+ #[cfg(not(miri))]
const COUNT: usize = 100_000;
let (s1, r1) = unbounded::<()>();