Skip to content

Commit 4dd10bc

Browse files
authored
Merge pull request #915 from RalfJung/miri
better way to ignore tests in Miri
2 parents 0a85d63 + bd5f321 commit 4dd10bc

File tree

9 files changed

+17
-17
lines changed

9 files changed

+17
-17
lines changed

src/distributions/bernoulli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ mod test {
137137
}
138138

139139
#[test]
140-
#[cfg(not(miri))] // Miri is too slow
140+
#[cfg_attr(miri, ignore)] // Miri is too slow
141141
fn test_average() {
142142
const P: f64 = 0.3;
143143
const NUM: u32 = 3;

src/distributions/binomial.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ mod test {
288288
}
289289

290290
#[test]
291-
#[cfg(not(miri))] // Miri is too slow
291+
#[cfg_attr(miri, ignore)] // Miri is too slow
292292
fn test_binomial() {
293293
let mut rng = crate::test::rng(351);
294294
test_binomial_mean_and_variance(150, 0.1, &mut rng);

src/distributions/poisson.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ mod test {
109109
use super::Poisson;
110110

111111
#[test]
112-
#[cfg(not(miri))] // Miri is too slow
112+
#[cfg_attr(miri, ignore)] // Miri is too slow
113113
fn test_poisson_10() {
114114
let poisson = Poisson::new(10.0);
115115
let mut rng = crate::test::rng(123);

src/distributions/uniform.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ mod tests {
959959
}
960960

961961
#[test]
962-
#[cfg(not(miri))] // Miri is too slow
962+
#[cfg_attr(miri, ignore)] // Miri is too slow
963963
fn test_integers() {
964964
use core::{i8, i16, i32, i64, isize};
965965
use core::{u8, u16, u32, u64, usize};
@@ -1044,7 +1044,7 @@ mod tests {
10441044
}
10451045

10461046
#[test]
1047-
#[cfg(not(miri))] // Miri is too slow
1047+
#[cfg_attr(miri, ignore)] // Miri is too slow
10481048
fn test_floats() {
10491049
let mut rng = crate::test::rng(252);
10501050
let mut zero_rng = StepRng::new(0, 0);
@@ -1183,7 +1183,7 @@ mod tests {
11831183

11841184

11851185
#[test]
1186-
#[cfg(not(miri))] // Miri is too slow
1186+
#[cfg_attr(miri, ignore)] // Miri is too slow
11871187
fn test_durations() {
11881188
#[cfg(feature = "std")]
11891189
use std::time::Duration;

src/distributions/weighted/alias_method.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ mod test {
370370
use super::*;
371371

372372
#[test]
373-
#[cfg(not(miri))] // Miri is too slow
373+
#[cfg_attr(miri, ignore)] // Miri is too slow
374374
fn test_weighted_index_f32() {
375375
test_weighted_index(f32::into);
376376

@@ -399,14 +399,14 @@ mod test {
399399

400400
#[cfg(not(target_os = "emscripten"))]
401401
#[test]
402-
#[cfg(not(miri))] // Miri is too slow
402+
#[cfg_attr(miri, ignore)] // Miri is too slow
403403
fn test_weighted_index_u128() {
404404
test_weighted_index(|x: u128| x as f64);
405405
}
406406

407407
#[cfg(all(rustc_1_26, not(target_os = "emscripten")))]
408408
#[test]
409-
#[cfg(not(miri))] // Miri is too slow
409+
#[cfg_attr(miri, ignore)] // Miri is too slow
410410
fn test_weighted_index_i128() {
411411
test_weighted_index(|x: i128| x as f64);
412412

@@ -422,13 +422,13 @@ mod test {
422422
}
423423

424424
#[test]
425-
#[cfg(not(miri))] // Miri is too slow
425+
#[cfg_attr(miri, ignore)] // Miri is too slow
426426
fn test_weighted_index_u8() {
427427
test_weighted_index(u8::into);
428428
}
429429

430430
#[test]
431-
#[cfg(not(miri))] // Miri is too slow
431+
#[cfg_attr(miri, ignore)] // Miri is too slow
432432
fn test_weighted_index_i8() {
433433
test_weighted_index(i8::into);
434434

src/distributions/weighted/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ mod test {
237237
use super::*;
238238

239239
#[test]
240-
#[cfg(not(miri))] // Miri is too slow
240+
#[cfg_attr(miri, ignore)] // Miri is too slow
241241
fn test_weightedindex() {
242242
let mut r = crate::test::rng(700);
243243
const N_REPS: u32 = 5000;

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ mod test {
697697
}
698698

699699
#[test]
700-
#[cfg(not(miri))] // Miri is too slow
700+
#[cfg_attr(miri, ignore)] // Miri is too slow
701701
fn test_gen_ratio_average() {
702702
const NUM: u32 = 3;
703703
const DENOM: u32 = 10;

src/seq/index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ mod test {
373373
}
374374

375375
#[test]
376-
#[cfg(not(miri))] // Miri is too slow
376+
#[cfg_attr(miri, ignore)] // Miri is too slow
377377
fn test_sample_alg() {
378378
let seed_rng = crate::test::rng;
379379

src/seq/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ mod test {
614614
}
615615

616616
#[test]
617-
#[cfg(not(miri))] // Miri is too slow
617+
#[cfg_attr(miri, ignore)] // Miri is too slow
618618
fn test_iterator_choose() {
619619
let r = &mut crate::test::rng(109);
620620
fn test_iter<R: Rng + ?Sized, Iter: Iterator<Item=usize> + Clone>(r: &mut R, iter: Iter) {
@@ -646,7 +646,7 @@ mod test {
646646
}
647647

648648
#[test]
649-
#[cfg(not(miri))] // Miri is too slow
649+
#[cfg_attr(miri, ignore)] // Miri is too slow
650650
fn test_shuffle() {
651651
let mut r = crate::test::rng(108);
652652
let empty: &mut [isize] = &mut [];
@@ -734,7 +734,7 @@ mod test {
734734

735735
#[test]
736736
#[cfg(feature = "alloc")]
737-
#[cfg(not(miri))] // Miri is too slow
737+
#[cfg_attr(miri, ignore)] // Miri is too slow
738738
fn test_weighted() {
739739
let mut r = crate::test::rng(406);
740740
const N_REPS: u32 = 3000;

0 commit comments

Comments
 (0)