diff --git a/aci_edge_sandboxes/tests/openvmm_fake.rs b/aci_edge_sandboxes/tests/openvmm_fake.rs index 5e5c10128..2857be24c 100644 --- a/aci_edge_sandboxes/tests/openvmm_fake.rs +++ b/aci_edge_sandboxes/tests/openvmm_fake.rs @@ -1275,9 +1275,15 @@ fn unrecorded_launches_end_once_their_log_is_released() { } assert!(journal.exists()); - // Its release proves it. + // Its release proves it, once a process that a concurrent test spawned, which may still hold + // the log until it executes its program, has done so. drop(log); - nvx.start(&sandbox_id).unwrap(); + let deadline = Instant::now() + Duration::from_secs(10); + while let Err(error) = nvx.start(&sandbox_id) { + assert_eq!(error.code(), ErrorCode::BackendError, "{error}"); + assert!(Instant::now() < deadline, "{error}"); + thread::sleep(Duration::from_millis(25)); + } assert!(!journal.exists()); assert_eq!(run(&nvx, &sandbox_id, "echo started").stdout, b"started\n"); nvx.stop(&sandbox_id).unwrap(); diff --git a/nvx-rs/src/host/store/tests.rs b/nvx-rs/src/host/store/tests.rs index 9459c2343..3ebede73f 100644 --- a/nvx-rs/src/host/store/tests.rs +++ b/nvx-rs/src/host/store/tests.rs @@ -748,9 +748,17 @@ fn an_abandoned_launch_that_spawned_nothing_has_exited() { error.message().contains("must be recovered first"), "{error}" ); - assert_eq!(locked.recover().unwrap(), Recovery::Exited); + // A process that a concurrent test spawned may still hold the log that the launch closed, + // until it executes its program, and a later recovery then ends the launch. + assert!(released(|| locked.recover().unwrap() == Recovery::Exited)); let launch = locked.begin_launch(&runtime(), &CAPABILITY).unwrap(); - assert_eq!(launch.abandon().unwrap(), Recovery::Exited); + match launch.abandon().unwrap() { + Recovery::Exited => {} + Recovery::Indeterminate(_) => { + assert!(released(|| locked.recover().unwrap() == Recovery::Exited)); + } + other => panic!("{other:?}"), + } assert!(store.journal().unwrap().is_none()); assert!(!store.capability_path().exists()); } @@ -783,13 +791,12 @@ fn a_recorded_vmm_that_cannot_be_held_has_exited_once_its_log_is_released() { }; assert!(reason.contains("still holds its log"), "{reason}"); } - // Once nothing holds the log, the launch has exited. + // Once nothing holds the log, the launch has exited. A process that a concurrent test spawned + // may still hold it, until it executes its program. drop(log); for open in opens { - assert_eq!( - locked.end_identified(&journal, &reference, open), - Recovery::Exited - ); + let exited = || locked.end_identified(&journal, &reference, open) == Recovery::Exited; + assert!(released(exited)); } }