From 8a4cd9b15d69d8e41ae7621bb2c9009a820d9223 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 22 Apr 2026 23:52:20 +0200 Subject: [PATCH] block: vhd: Test that try_clone preserves backend dispatch Verify that a cloned disk produces the same async I/O backend as the original for both sync and io_uring paths. Assisted-by: Claude:Opus-4.6 Signed-off-by: Anatol Belski --- block/src/fixed_vhd_disk.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/block/src/fixed_vhd_disk.rs b/block/src/fixed_vhd_disk.rs index ee43c10ed..5d6258636 100644 --- a/block/src/fixed_vhd_disk.rs +++ b/block/src/fixed_vhd_disk.rs @@ -187,4 +187,21 @@ mod unit_tests { let disk = FixedVhdDisk::new(file, true).unwrap(); assert_async_io(&disk, true); } + + #[test] + fn try_clone_preserves_sync_dispatch() { + let file = make_vhd_file(); + let disk = FixedVhdDisk::new(file, false).unwrap(); + let cloned = disk.try_clone().unwrap(); + assert_async_io_from_dyn(cloned.as_ref(), false); + } + + #[cfg(feature = "io_uring")] + #[test] + fn try_clone_preserves_io_uring_dispatch() { + let file = make_vhd_file(); + let disk = FixedVhdDisk::new(file, true).unwrap(); + let cloned = disk.try_clone().unwrap(); + assert_async_io_from_dyn(cloned.as_ref(), true); + } }