Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions aci_edge_sandboxes/tests/openvmm_fake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
21 changes: 14 additions & 7 deletions nvx-rs/src/host/store/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -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));
}
}

Expand Down
Loading