mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
determinism achieved for testing. now to squash some bugs.
This commit is contained in:
parent
37b46fae98
commit
0bd110c163
5 changed files with 5 additions and 5 deletions
|
|
@ -65,7 +65,7 @@ pub fn set_send_addr(send_addr: Sender<SocketAddr>) {
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
use core::sync::atomic::{AtomicU64, Ordering};
|
use core::sync::atomic::{AtomicU64, Ordering};
|
||||||
#[cfg(not(test))]
|
#[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))]
|
#[cfg(not(test))]
|
||||||
fn generate_pid_key() -> [u8; 16] {
|
fn generate_pid_key() -> [u8; 16] {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ static GLOBAL: &StatsAlloc<std::alloc::System> = &INSTRUMENTED_SYSTEM;
|
||||||
const SERVER_SPEC: &str = "127.0.0.1:0";
|
const SERVER_SPEC: &str = "127.0.0.1:0";
|
||||||
|
|
||||||
use core::sync::atomic::{AtomicU64, Ordering};
|
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<()> {
|
fn start_kernel(server_spec: &str) -> JoinHandle<()> {
|
||||||
assert!(
|
assert!(
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ use std::collections::BTreeSet;
|
||||||
const UPPER_BOUND: usize = 9000;
|
const UPPER_BOUND: usize = 9000;
|
||||||
const LOWER_BOUND: usize = 12; // needs to be big enough to compute murmur3 hash + hold checksum
|
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>) {
|
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));
|
let mut rng = ChaCha8Rng::seed_from_u64(RNG_LOCAL_STATE.load(Ordering::SeqCst));
|
||||||
|
|
|
||||||
|
|
@ -328,7 +328,7 @@ impl Drop for Spinor {
|
||||||
use core::sync::atomic::AtomicU64;
|
use core::sync::atomic::AtomicU64;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[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`:
|
// run with `cargo test -- --nocapture --test-threads=1`:
|
||||||
// --nocapture to see the print output (while debugging)
|
// --nocapture to see the print output (while debugging)
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ pub const PDDB_LOC: u32 = 0x0100_0000; // PDDB start
|
||||||
pub const PDDB_LEN: u32 = EC_REGION_LOC - PDDB_LOC;
|
pub const PDDB_LEN: u32 = EC_REGION_LOC - PDDB_LOC;
|
||||||
|
|
||||||
#[cfg(all(any(windows, unix), not(feature = "processes-as-threads")))]
|
#[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 mod exceptions;
|
||||||
pub use exceptions::*;
|
pub use exceptions::*;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue