From c1a3827bd5360f74a4ffe71cae3bbd90312d0f8a Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 26 Jun 2022 15:25:46 -0400 Subject: [PATCH 1/2] Miri has gained some more features --- src/imp_std.rs | 1 - tests/it.rs | 3 --- 2 files changed, 4 deletions(-) diff --git a/src/imp_std.rs b/src/imp_std.rs index c01078c..2bbe5b7 100644 --- a/src/imp_std.rs +++ b/src/imp_std.rs @@ -281,7 +281,6 @@ mod tests { } #[test] - #[cfg(not(miri))] fn stampede_once() { static O: OnceCell<()> = OnceCell::new(); static mut RUN: bool = false; diff --git a/tests/it.rs b/tests/it.rs index 95483bd..4fd6643 100644 --- a/tests/it.rs +++ b/tests/it.rs @@ -331,7 +331,6 @@ mod sync { } #[test] - #[cfg_attr(miri, ignore)] // miri doesn't support Barrier fn get_or_init_stress() { use std::sync::Barrier; let n_threads = 1_000; @@ -577,7 +576,6 @@ mod sync { } #[test] - #[cfg_attr(miri, ignore)] // FIXME: deadlocks, likely caused by https://github.com/rust-lang/miri/issues/1388 fn once_cell_does_not_leak_partially_constructed_boxes() { let n_tries = 100; let n_readers = 10; @@ -604,7 +602,6 @@ mod sync { } #[test] - #[cfg_attr(miri, ignore)] // miri doesn't support Barrier fn get_does_not_block() { use std::sync::Barrier; From b7839edeb61603ac29dc165c43eb94f2f9bbaa0e Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 26 Jun 2022 15:31:23 -0400 Subject: [PATCH 2/2] reduce iteration counts for Miri --- tests/it.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/it.rs b/tests/it.rs index 4fd6643..476f14b 100644 --- a/tests/it.rs +++ b/tests/it.rs @@ -333,8 +333,8 @@ mod sync { #[test] fn get_or_init_stress() { use std::sync::Barrier; - let n_threads = 1_000; - let n_cells = 1_000; + let n_threads = if cfg!(miri) { 30 } else { 1_000 }; + let n_cells = if cfg!(miri) { 30 } else { 1_000 }; let cells: Vec<_> = std::iter::repeat_with(|| (Barrier::new(n_threads), OnceCell::new())) .take(n_cells) .collect(); @@ -577,7 +577,7 @@ mod sync { #[test] fn once_cell_does_not_leak_partially_constructed_boxes() { - let n_tries = 100; + let n_tries = if cfg!(miri) { 10 } else { 100 }; let n_readers = 10; let n_writers = 3; const MSG: &str = "Hello, World";