From f72627157e84052b307c46956582b2ec491ceda3 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 28 Jul 2019 12:17:57 +0200 Subject: [PATCH] debug --- test-cargo-miri/Cargo.toml | 2 +- test-cargo-miri/src/main.rs | 21 +++++++++++---------- travis.sh | 5 +++-- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/test-cargo-miri/Cargo.toml b/test-cargo-miri/Cargo.toml index 3abb437049..1706235aac 100644 --- a/test-cargo-miri/Cargo.toml +++ b/test-cargo-miri/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] byteorder = "1.0" +rand = { version = "0.7", features = ["small_rng"] } [dev-dependencies] -rand = { version = "0.7", features = ["small_rng"] } num_cpus = "1.10.1" diff --git a/test-cargo-miri/src/main.rs b/test-cargo-miri/src/main.rs index d3663ec849..41c092de83 100644 --- a/test-cargo-miri/src/main.rs +++ b/test-cargo-miri/src/main.rs @@ -1,16 +1,17 @@ -use byteorder::{BigEndian, ByteOrder}; +use rand::{SeedableRng, Rng, rngs::SmallRng}; fn main() { - // Exercise external crate, printing to stdout. - let buf = &[1,2,3,4]; - let n = ::read_u32(buf); - assert_eq!(n, 0x01020304); - println!("{:#010x}", n); + // Try seeding with "real" entropy. + let mut rng = SmallRng::from_entropy(); + let _val = rng.gen::(); + let _val = rng.gen::(); + let _val = rng.gen::(); - // Access program arguments, printing to stderr. - for arg in std::env::args() { - eprintln!("{}", arg); - } + // Also try per-thread RNG. + let mut rng = rand::thread_rng(); + let _val = rng.gen::(); + let _val = rng.gen::(); + let _val = rng.gen::(); } #[cfg(test)] diff --git a/travis.sh b/travis.sh index c06dbaee36..f2af9efa30 100755 --- a/travis.sh +++ b/travis.sh @@ -17,10 +17,11 @@ echo # Test function run_tests { - ./miri test + # FIXME debugging + # ./miri test # "miri test" has built the sysroot for us, now this should pass without # any interactive questions. - test-cargo-miri/run-test.py + MIRI_LOG=info test-cargo-miri/run-test.py } echo "Test host architecture"