summaryrefslogtreecommitdiffstats
path: root/vendor/futures-channel/tests/mpsc.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
commit1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch)
tree3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /vendor/futures-channel/tests/mpsc.rs
parentReleasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz
rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/futures-channel/tests/mpsc.rs')
-rw-r--r--vendor/futures-channel/tests/mpsc.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/vendor/futures-channel/tests/mpsc.rs b/vendor/futures-channel/tests/mpsc.rs
index 88cdef13d..444c8e10f 100644
--- a/vendor/futures-channel/tests/mpsc.rs
+++ b/vendor/futures-channel/tests/mpsc.rs
@@ -200,7 +200,7 @@ fn tx_close_gets_none() {
#[test]
fn stress_shared_unbounded() {
- const AMT: u32 = 10000;
+ const AMT: u32 = if cfg!(miri) { 100 } else { 10000 };
const NTHREADS: u32 = 8;
let (tx, rx) = mpsc::unbounded::<i32>();
@@ -229,7 +229,7 @@ fn stress_shared_unbounded() {
#[test]
fn stress_shared_bounded_hard() {
- const AMT: u32 = 10000;
+ const AMT: u32 = if cfg!(miri) { 100 } else { 10000 };
const NTHREADS: u32 = 8;
let (tx, rx) = mpsc::channel::<i32>(0);
@@ -259,7 +259,7 @@ fn stress_shared_bounded_hard() {
#[allow(clippy::same_item_push)]
#[test]
fn stress_receiver_multi_task_bounded_hard() {
- const AMT: usize = 10_000;
+ const AMT: usize = if cfg!(miri) { 100 } else { 10_000 };
const NTHREADS: u32 = 2;
let (mut tx, rx) = mpsc::channel::<usize>(0);
@@ -327,6 +327,8 @@ fn stress_receiver_multi_task_bounded_hard() {
/// after sender dropped.
#[test]
fn stress_drop_sender() {
+ const ITER: usize = if cfg!(miri) { 100 } else { 10000 };
+
fn list() -> impl Stream<Item = i32> {
let (tx, rx) = mpsc::channel(1);
thread::spawn(move || {
@@ -335,7 +337,7 @@ fn stress_drop_sender() {
rx
}
- for _ in 0..10000 {
+ for _ in 0..ITER {
let v: Vec<_> = block_on(list().collect());
assert_eq!(v, vec![1, 2, 3]);
}
@@ -382,7 +384,9 @@ fn stress_close_receiver_iter() {
#[test]
fn stress_close_receiver() {
- for _ in 0..10000 {
+ const ITER: usize = if cfg!(miri) { 50 } else { 10000 };
+
+ for _ in 0..ITER {
stress_close_receiver_iter();
}
}
@@ -397,7 +401,7 @@ async fn stress_poll_ready_sender(mut sender: mpsc::Sender<u32>, count: u32) {
#[allow(clippy::same_item_push)]
#[test]
fn stress_poll_ready() {
- const AMT: u32 = 1000;
+ const AMT: u32 = if cfg!(miri) { 100 } else { 1000 };
const NTHREADS: u32 = 8;
/// Run a stress test using the specified channel capacity.
@@ -426,7 +430,7 @@ fn stress_poll_ready() {
#[test]
fn try_send_1() {
- const N: usize = 3000;
+ const N: usize = if cfg!(miri) { 100 } else { 3000 };
let (mut tx, rx) = mpsc::channel(0);
let t = thread::spawn(move || {