summaryrefslogtreecommitdiffstats
path: root/vendor/crossbeam-deque/tests/lifo.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:03:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:03:36 +0000
commit17d40c6057c88f4c432b0d7bac88e1b84cb7e67f (patch)
tree3f66c4a5918660bb8a758ab6cda5ff8ee4f6cdcd /vendor/crossbeam-deque/tests/lifo.rs
parentAdding upstream version 1.64.0+dfsg1. (diff)
downloadrustc-f7f0cc2a5d72e2c61c1f6900e70eec992bea4273.tar.xz
rustc-f7f0cc2a5d72e2c61c1f6900e70eec992bea4273.zip
Adding upstream version 1.65.0+dfsg1.upstream/1.65.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/crossbeam-deque/tests/lifo.rs')
-rw-r--r--vendor/crossbeam-deque/tests/lifo.rs23
1 files changed, 22 insertions, 1 deletions
diff --git a/vendor/crossbeam-deque/tests/lifo.rs b/vendor/crossbeam-deque/tests/lifo.rs
index 3e99e95c5..c1a65cd2e 100644
--- a/vendor/crossbeam-deque/tests/lifo.rs
+++ b/vendor/crossbeam-deque/tests/lifo.rs
@@ -71,6 +71,9 @@ fn is_empty() {
#[test]
fn spsc() {
+ #[cfg(miri)]
+ const STEPS: usize = 500;
+ #[cfg(not(miri))]
const STEPS: usize = 50_000;
let w = Worker::new_lifo();
@@ -84,6 +87,8 @@ fn spsc() {
assert_eq!(i, v);
break;
}
+ #[cfg(miri)]
+ std::hint::spin_loop();
}
}
@@ -100,6 +105,9 @@ fn spsc() {
#[test]
fn stampede() {
const THREADS: usize = 8;
+ #[cfg(miri)]
+ const COUNT: usize = 500;
+ #[cfg(not(miri))]
const COUNT: usize = 50_000;
let w = Worker::new_lifo();
@@ -141,6 +149,9 @@ fn stampede() {
#[test]
fn stress() {
const THREADS: usize = 8;
+ #[cfg(miri)]
+ const COUNT: usize = 500;
+ #[cfg(not(miri))]
const COUNT: usize = 50_000;
let w = Worker::new_lifo();
@@ -197,6 +208,7 @@ fn stress() {
.unwrap();
}
+#[cfg_attr(miri, ignore)] // Miri is too slow
#[test]
fn no_starvation() {
const THREADS: usize = 8;
@@ -258,8 +270,17 @@ fn no_starvation() {
#[test]
fn destructors() {
+ #[cfg(miri)]
+ const THREADS: usize = 2;
+ #[cfg(not(miri))]
const THREADS: usize = 8;
+ #[cfg(miri)]
+ const COUNT: usize = 500;
+ #[cfg(not(miri))]
const COUNT: usize = 50_000;
+ #[cfg(miri)]
+ const STEPS: usize = 100;
+ #[cfg(not(miri))]
const STEPS: usize = 1000;
struct Elem(usize, Arc<Mutex<Vec<usize>>>);
@@ -330,7 +351,7 @@ fn destructors() {
{
let mut v = dropped.lock().unwrap();
assert_eq!(v.len(), rem);
- v.sort();
+ v.sort_unstable();
for pair in v.windows(2) {
assert_eq!(pair[0] + 1, pair[1]);
}