determinism achieved for testing. now to squash some bugs.

This commit is contained in:
bunnie 2021-12-26 01:50:30 +08:00
parent 37b46fae98
commit 0bd110c163
5 changed files with 5 additions and 5 deletions

View file

@ -65,7 +65,7 @@ pub fn set_send_addr(send_addr: Sender<SocketAddr>) {
#[cfg(not(test))]
use core::sync::atomic::{AtomicU64, Ordering};
#[cfg(not(test))]
static LOCAL_RNG_STATE: AtomicU64 = AtomicU64::new(xous_kernel::TESTING_RNG_SEED);
static LOCAL_RNG_STATE: AtomicU64 = AtomicU64::new(xous_kernel::TESTING_RNG_SEED + 2);
#[cfg(not(test))]
fn generate_pid_key() -> [u8; 16] {

View file

@ -17,7 +17,7 @@ static GLOBAL: &StatsAlloc<std::alloc::System> = &INSTRUMENTED_SYSTEM;
const SERVER_SPEC: &str = "127.0.0.1:0";
use core::sync::atomic::{AtomicU64, Ordering};
static RNG_LOCAL_STATE: AtomicU64 = AtomicU64::new(xous::TESTING_RNG_SEED);
static RNG_LOCAL_STATE: AtomicU64 = AtomicU64::new(xous::TESTING_RNG_SEED + 1);
fn start_kernel(server_spec: &str) -> JoinHandle<()> {
assert!(

View file

@ -7,7 +7,7 @@ use std::collections::BTreeSet;
const UPPER_BOUND: usize = 9000;
const LOWER_BOUND: usize = 12; // needs to be big enough to compute murmur3 hash + hold checksum
static RNG_LOCAL_STATE: AtomicU64 = AtomicU64::new(xous::TESTING_RNG_SEED);
static RNG_LOCAL_STATE: AtomicU64 = AtomicU64::new(xous::TESTING_RNG_SEED + 3);
fn gen_key(dictname: &str, keynum: usize, lower_size_bound: usize, upper_size_bound: usize) -> (String, Vec::<u8>) {
let mut rng = ChaCha8Rng::seed_from_u64(RNG_LOCAL_STATE.load(Ordering::SeqCst));

View file

@ -328,7 +328,7 @@ impl Drop for Spinor {
use core::sync::atomic::AtomicU64;
#[cfg(test)]
static TEST_RNG_STATE: AtomicU64 = AtomicU64::new(xous::TESTING_RNG_SEED);
static TEST_RNG_STATE: AtomicU64 = AtomicU64::new(xous::TESTING_RNG_SEED + 4);
// run with `cargo test -- --nocapture --test-threads=1`:
// --nocapture to see the print output (while debugging)

View file

@ -40,7 +40,7 @@ pub const PDDB_LOC: u32 = 0x0100_0000; // PDDB start
pub const PDDB_LEN: u32 = EC_REGION_LOC - PDDB_LOC;
#[cfg(all(any(windows, unix), not(feature = "processes-as-threads")))]
pub const TESTING_RNG_SEED: u64 = 0;
pub const TESTING_RNG_SEED: u64 = 0; // 2 "works"
pub mod exceptions;
pub use exceptions::*;