organize pass-dep tests more by the crate they test
This commit is contained in:
parent
382475d406
commit
6e907fa6ec
@ -12,8 +12,8 @@ edition = "2021"
|
||||
libc = "0.2"
|
||||
num_cpus = "1.10.1"
|
||||
|
||||
getrandom_1 = { package = "getrandom", version = "0.1" }
|
||||
getrandom = { version = "0.2", features = ["js"] }
|
||||
getrandom_01 = { package = "getrandom", version = "0.1" }
|
||||
getrandom_02 = { package = "getrandom", version = "0.2", features = ["js"] }
|
||||
rand = { version = "0.8", features = ["small_rng"] }
|
||||
|
||||
[target.'cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))'.dependencies]
|
||||
|
9
src/tools/miri/tests/pass-dep/getrandom.rs
Normal file
9
src/tools/miri/tests/pass-dep/getrandom.rs
Normal file
@ -0,0 +1,9 @@
|
||||
// mac-os `getrandom_01` does some pointer shenanigans
|
||||
//@compile-flags: -Zmiri-permissive-provenance
|
||||
|
||||
/// Test direct calls of getrandom 0.1 and 0.2
|
||||
fn main() {
|
||||
let mut data = vec![0; 16];
|
||||
getrandom_01::getrandom(&mut data).unwrap();
|
||||
getrandom_02::getrandom(&mut data).unwrap();
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
// mac-os `getrandom_1` does some pointer shenanigans
|
||||
//@compile-flags: -Zmiri-permissive-provenance
|
||||
|
||||
/// Test old version of `getrandom`.
|
||||
fn main() {
|
||||
let mut data = vec![0; 16];
|
||||
getrandom_1::getrandom(&mut data).unwrap();
|
||||
}
|
@ -1,10 +1,13 @@
|
||||
//@compile-flags: -Zmiri-strict-provenance
|
||||
use rand::{rngs::SmallRng, Rng, SeedableRng};
|
||||
use rand::prelude::*;
|
||||
|
||||
// Test using the `rand` crate to generate randomness.
|
||||
fn main() {
|
||||
// Test `getrandom` directly.
|
||||
let mut data = vec![0; 16];
|
||||
getrandom::getrandom(&mut data).unwrap();
|
||||
// Fully deterministic seeding.
|
||||
let mut rng = SmallRng::seed_from_u64(42);
|
||||
let _val = rng.gen::<i32>();
|
||||
let _val = rng.gen::<isize>();
|
||||
let _val = rng.gen::<i128>();
|
||||
|
||||
// Try seeding with "real" entropy.
|
||||
let mut rng = SmallRng::from_entropy();
|
Loading…
Reference in New Issue
Block a user