summaryrefslogtreecommitdiffstats
path: root/vendor/crossbeam-channel/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:37 +0000
commit246f239d9f40f633160f0c18f87a20922d4e77bb (patch)
tree5a88572663584b3d4d28e5a20e10abab1be40884 /vendor/crossbeam-channel/tests
parentReleasing progress-linux version 1.64.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-246f239d9f40f633160f0c18f87a20922d4e77bb.tar.xz
rustc-246f239d9f40f633160f0c18f87a20922d4e77bb.zip
Merging debian version 1.65.0+dfsg1-2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/crossbeam-channel/tests')
-rw-r--r--vendor/crossbeam-channel/tests/array.rs6
-rw-r--r--vendor/crossbeam-channel/tests/golang.rs7
-rw-r--r--vendor/crossbeam-channel/tests/list.rs3
-rw-r--r--vendor/crossbeam-channel/tests/mpsc.rs15
-rw-r--r--vendor/crossbeam-channel/tests/select.rs1
-rw-r--r--vendor/crossbeam-channel/tests/select_macro.rs1
-rw-r--r--vendor/crossbeam-channel/tests/thread_locals.rs2
-rw-r--r--vendor/crossbeam-channel/tests/zero.rs8
8 files changed, 17 insertions, 26 deletions
diff --git a/vendor/crossbeam-channel/tests/array.rs b/vendor/crossbeam-channel/tests/array.rs
index de843cd32..6fd8ffcc6 100644
--- a/vendor/crossbeam-channel/tests/array.rs
+++ b/vendor/crossbeam-channel/tests/array.rs
@@ -377,7 +377,7 @@ fn spsc() {
#[test]
fn mpmc() {
#[cfg(miri)]
- const COUNT: usize = 100;
+ const COUNT: usize = 50;
#[cfg(not(miri))]
const COUNT: usize = 25_000;
const THREADS: usize = 4;
@@ -532,16 +532,12 @@ fn drops() {
scope.spawn(|_| {
for _ in 0..steps {
r.recv().unwrap();
- #[cfg(miri)]
- std::thread::yield_now(); // https://github.com/rust-lang/miri/issues/1388
}
});
scope.spawn(|_| {
for _ in 0..steps {
s.send(DropCounter).unwrap();
- #[cfg(miri)]
- std::thread::yield_now(); // https://github.com/rust-lang/miri/issues/1388
}
});
})
diff --git a/vendor/crossbeam-channel/tests/golang.rs b/vendor/crossbeam-channel/tests/golang.rs
index 6a46c0353..8050716c6 100644
--- a/vendor/crossbeam-channel/tests/golang.rs
+++ b/vendor/crossbeam-channel/tests/golang.rs
@@ -959,7 +959,7 @@ mod chan_test {
#[test]
fn test_chan() {
#[cfg(miri)]
- const N: i32 = 20;
+ const N: i32 = 12;
#[cfg(not(miri))]
const N: i32 = 200;
@@ -1489,7 +1489,7 @@ mod chan_test {
fn test_multi_consumer() {
const NWORK: usize = 23;
#[cfg(miri)]
- const NITER: usize = 100;
+ const NITER: usize = 50;
#[cfg(not(miri))]
const NITER: usize = 271828;
@@ -1580,9 +1580,7 @@ mod race_chan_test {
}
// https://github.com/golang/go/blob/master/test/ken/chan.go
-#[cfg(not(miri))] // Miri is too slow
mod chan {
-
use super::*;
const MESSAGES_PER_CHANEL: u32 = 76;
@@ -2052,6 +2050,7 @@ mod chan {
}
#[test]
+ #[cfg_attr(miri, ignore)] // Miri is too slow
fn main() {
let mut ctx = Context {
nproc: Arc::new(Mutex::new(0)),
diff --git a/vendor/crossbeam-channel/tests/list.rs b/vendor/crossbeam-channel/tests/list.rs
index a0b908722..ebe6f6f85 100644
--- a/vendor/crossbeam-channel/tests/list.rs
+++ b/vendor/crossbeam-channel/tests/list.rs
@@ -67,6 +67,7 @@ fn len_empty_full() {
}
#[test]
+#[cfg_attr(miri, ignore)] // this test makes timing assumptions, but Miri is so slow it violates them
fn try_recv() {
let (s, r) = unbounded();
@@ -433,8 +434,6 @@ fn drops() {
scope.spawn(|_| {
for _ in 0..steps {
r.recv().unwrap();
- #[cfg(miri)]
- std::thread::yield_now(); // https://github.com/rust-lang/miri/issues/1388
}
});
diff --git a/vendor/crossbeam-channel/tests/mpsc.rs b/vendor/crossbeam-channel/tests/mpsc.rs
index 3db4812c6..d7cc8e25f 100644
--- a/vendor/crossbeam-channel/tests/mpsc.rs
+++ b/vendor/crossbeam-channel/tests/mpsc.rs
@@ -339,25 +339,22 @@ mod channel_tests {
#[test]
fn stress_shared() {
- #[cfg(miri)]
- const AMT: u32 = 100;
- #[cfg(not(miri))]
- const AMT: u32 = 10000;
- const NTHREADS: u32 = 8;
+ let amt: u32 = if cfg!(miri) { 100 } else { 10_000 };
+ let nthreads: u32 = if cfg!(miri) { 4 } else { 8 };
let (tx, rx) = channel::<i32>();
let t = thread::spawn(move || {
- for _ in 0..AMT * NTHREADS {
+ for _ in 0..amt * nthreads {
assert_eq!(rx.recv().unwrap(), 1);
}
assert!(rx.try_recv().is_err());
});
- let mut ts = Vec::with_capacity(NTHREADS as usize);
- for _ in 0..NTHREADS {
+ let mut ts = Vec::with_capacity(nthreads as usize);
+ for _ in 0..nthreads {
let tx = tx.clone();
let t = thread::spawn(move || {
- for _ in 0..AMT {
+ for _ in 0..amt {
tx.send(1).unwrap();
}
});
diff --git a/vendor/crossbeam-channel/tests/select.rs b/vendor/crossbeam-channel/tests/select.rs
index e7691f52e..bc5824dab 100644
--- a/vendor/crossbeam-channel/tests/select.rs
+++ b/vendor/crossbeam-channel/tests/select.rs
@@ -408,7 +408,6 @@ fn both_ready() {
.unwrap();
}
-#[cfg_attr(miri, ignore)] // Miri is too slow
#[test]
fn loop_try() {
const RUNS: usize = 20;
diff --git a/vendor/crossbeam-channel/tests/select_macro.rs b/vendor/crossbeam-channel/tests/select_macro.rs
index 91c04e1c3..119454cd6 100644
--- a/vendor/crossbeam-channel/tests/select_macro.rs
+++ b/vendor/crossbeam-channel/tests/select_macro.rs
@@ -284,7 +284,6 @@ fn both_ready() {
.unwrap();
}
-#[cfg_attr(miri, ignore)] // Miri is too slow
#[test]
fn loop_try() {
const RUNS: usize = 20;
diff --git a/vendor/crossbeam-channel/tests/thread_locals.rs b/vendor/crossbeam-channel/tests/thread_locals.rs
index effb6a143..fb4e577f2 100644
--- a/vendor/crossbeam-channel/tests/thread_locals.rs
+++ b/vendor/crossbeam-channel/tests/thread_locals.rs
@@ -1,6 +1,6 @@
//! Tests that make sure accessing thread-locals while exiting the thread doesn't cause panics.
-#![cfg(not(miri))] // error: abnormal termination: the evaluated program aborted execution
+#![cfg(not(miri))] // Miri detects that this test is buggy: the destructor of `FOO` uses `std::thread::current()`!
use std::thread;
use std::time::Duration;
diff --git a/vendor/crossbeam-channel/tests/zero.rs b/vendor/crossbeam-channel/tests/zero.rs
index c90d74187..74c9a3e10 100644
--- a/vendor/crossbeam-channel/tests/zero.rs
+++ b/vendor/crossbeam-channel/tests/zero.rs
@@ -328,9 +328,11 @@ fn stress_oneshot() {
}
}
-#[cfg_attr(miri, ignore)] // Miri is too slow
#[test]
fn stress_iter() {
+ #[cfg(miri)]
+ const COUNT: usize = 50;
+ #[cfg(not(miri))]
const COUNT: usize = 1000;
let (request_s, request_r) = bounded(0);
@@ -403,7 +405,7 @@ fn drops() {
#[cfg(not(miri))]
const RUNS: usize = 100;
#[cfg(miri)]
- const STEPS: usize = 500;
+ const STEPS: usize = 100;
#[cfg(not(miri))]
const STEPS: usize = 10_000;
@@ -485,7 +487,7 @@ fn fairness() {
#[test]
fn fairness_duplicates() {
#[cfg(miri)]
- const COUNT: usize = 50;
+ const COUNT: usize = 100;
#[cfg(not(miri))]
const COUNT: usize = 10_000;