dev/system-run-cart #34
@ -487,20 +487,15 @@ fn tick_asset_cancel_invalid_transition_returns_status_not_crash() {
|
||||
|
||||
runtime.initialize_vm(&mut log_service, &mut vm, &cartridge).expect("runtime must initialize");
|
||||
|
||||
let mut asset_ready = false;
|
||||
for _ in 0..1_000 {
|
||||
match platform.local_hardware().assets.status(handle) {
|
||||
LoadStatus::READY => {
|
||||
asset_ready = true;
|
||||
break;
|
||||
let start = Instant::now();
|
||||
let mut status = platform.local_hardware().assets.status(handle);
|
||||
while matches!(status, LoadStatus::PENDING | LoadStatus::LOADING)
|
||||
&& start.elapsed() < std::time::Duration::from_secs(5)
|
||||
{
|
||||
std::thread::sleep(std::time::Duration::from_millis(10));
|
||||
status = platform.local_hardware().assets.status(handle);
|
||||
}
|
||||
LoadStatus::PENDING | LoadStatus::LOADING => {
|
||||
std::thread::yield_now();
|
||||
}
|
||||
other => panic!("unexpected asset status before commit: {:?}", other),
|
||||
}
|
||||
}
|
||||
assert!(asset_ready, "asset did not become ready before commit");
|
||||
assert_eq!(status, LoadStatus::READY, "asset did not become ready before commit");
|
||||
|
||||
assert_eq!(platform.local_hardware().assets.commit(handle), AssetOpStatus::Ok);
|
||||
platform.local_hardware().assets.apply_commits();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user