mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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 <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
a84a0b8b25
commit
dc0e003be0
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user