make the susres test a bit more difficult to pass

This commit is contained in:
bunnie 2023-01-31 18:21:55 +08:00
parent 19667800cb
commit e97c99b435

View file

@ -87,11 +87,12 @@ impl<'a> ShellCmdApi<'a> for Sleep {
let llio = llio::Llio::new(&xns);
let susres = susres::Susres::new_without_hook(&xns).unwrap();
let ticktimer = ticktimer_server::Ticktimer::new().unwrap();
let trng = trng::Trng::new(&xns).unwrap();
ticktimer.sleep_ms(1500).unwrap();
let mut iters = 0;
loop {
log::info!("suspend/resume cycle: {}", iters);
llio.set_wakeup_alarm(4).unwrap();
llio.set_wakeup_alarm(5).unwrap();
ticktimer.sleep_ms(1000).unwrap();
match susres.initiate_suspend() {
Err(xous::Error::Timeout) => {
@ -102,7 +103,7 @@ impl<'a> ShellCmdApi<'a> for Sleep {
log::error!("Unknown error on suspend: {:?}", e);
}
}
ticktimer.sleep_ms(7000).unwrap();
ticktimer.sleep_ms(3000 + (trng.get_u32().unwrap() % 7000) as usize).unwrap();
iters += 1;
}
}