try to really fix tests on macOS

This commit is contained in:
Ralf Jung 2019-04-16 20:36:33 +02:00
parent 341798f09d
commit 54039cafa8

View file

@ -20,15 +20,18 @@ fn fixed_rng() {
}
#[test]
#[cfg(not(target_os="macos"))] // FIXME entropy does not work on macOS
fn entropy_rng() {
// Use this opportunity to test querying the RNG (needs an external crate, hence tested here and not in the compiletest suite)
let mut rng = SmallRng::from_entropy();
let _val = rng.gen::<i32>();
#[cfg(not(target_os="macos"))] // FIXME entropy does not work on macOS
// (Not disabling the entire test as that would change the output.)
{
// Use this opportunity to test querying the RNG (needs an external crate, hence tested here and not in the compiletest suite)
let mut rng = SmallRng::from_entropy();
let _val = rng.gen::<i32>();
// Also try per-thread RNG.
let mut rng = rand::thread_rng();
let _val = rng.gen::<i32>();
// Also try per-thread RNG.
let mut rng = rand::thread_rng();
let _val = rng.gen::<i32>();
}
}
// A test that won't work on miri