From a77b6231b45e4530971b326476d315e2c390d6b5 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Mon, 20 Apr 2026 12:21:25 +0100 Subject: [PATCH] tests: Ensure that virtiofsd has exited before hotplugging Fix test flakiness where the virtiofsd daemon was still running and hotplugging was trying to reach the old version. Cleanup the socket so that waiting for it actually waits for the new instance. Signed-off-by: Rob Bradford --- cloud-hypervisor/tests/common/tests_wrappers.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cloud-hypervisor/tests/common/tests_wrappers.rs b/cloud-hypervisor/tests/common/tests_wrappers.rs index 71087a900..67033956e 100644 --- a/cloud-hypervisor/tests/common/tests_wrappers.rs +++ b/cloud-hypervisor/tests/common/tests_wrappers.rs @@ -1060,6 +1060,11 @@ pub(crate) fn _test_virtio_fs( }); let (r, hotplug_daemon_child) = if r.is_ok() && hotplug { + let _ = daemon_child.kill(); + let _ = daemon_child.wait(); + // Remove the stale socket so wait_for_virtiofsd_socket actually waits + let _ = std::fs::remove_file(&virtiofsd_socket_path); + let (daemon_child, virtiofsd_socket_path) = prepare_daemon(&guest.tmp_dir, shared_dir.to_str().unwrap());