From 1269475c2aa8894c7a594045e118b5cdcb6b5b7e Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Wed, 15 Apr 2026 11:44:03 +0100 Subject: [PATCH] tests: Remove explicit sleeps from pvpanic test Instead wait for the event to be delivered that it has panicked. Signed-off-by: Rob Bradford --- cloud-hypervisor/tests/common/tests_wrappers.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cloud-hypervisor/tests/common/tests_wrappers.rs b/cloud-hypervisor/tests/common/tests_wrappers.rs index f42fce902..6479f2e2a 100644 --- a/cloud-hypervisor/tests/common/tests_wrappers.rs +++ b/cloud-hypervisor/tests/common/tests_wrappers.rs @@ -3165,17 +3165,14 @@ pub(crate) fn _test_pvpanic(guest: &Guest) { // Trigger guest a panic make_guest_panic(guest); - // Wait a while for guest - thread::sleep(std::time::Duration::new(10, 0)); - + // Wait for the panic event to be recorded let expected_sequential_events = [&MetaEvent { event: "panic".to_string(), device_id: None, }]; - assert!(check_latest_events_exact( - &expected_sequential_events, - &event_path - )); + assert!(wait_until(Duration::from_secs(10), || { + check_latest_events_exact(&expected_sequential_events, &event_path) + })); }); kill_child(&mut child);