From dc0e003be05133cabfa00b157319c758f1381877 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 14 Apr 2026 18:19:02 +0200 Subject: [PATCH] block: qcow: Add AlignedBuf size rounding test Verify that AlignedBuf rounds the allocation size up to the requested alignment. Passes under miri. Signed-off-by: Anatol Belski --- block/src/qcow_sync.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/block/src/qcow_sync.rs b/block/src/qcow_sync.rs index e696638eb..44b8efaf5 100644 --- a/block/src/qcow_sync.rs +++ b/block/src/qcow_sync.rs @@ -1903,4 +1903,13 @@ mod unit_tests { assert_eq!(abuf.as_slice(size), &pattern[..]); } } + + #[test] + fn test_aligned_buf_size_rounds_up() { + let abuf = AlignedBuf::new(1, 512).unwrap(); + assert_eq!(abuf.layout().size(), 512); + + let abuf = AlignedBuf::new(513, 512).unwrap(); + assert_eq!(abuf.layout().size(), 1024); + } }