block: qcow_async: Add large sequential I/O test

Write a distinct byte pattern into each of eight consecutive
clusters in a single operation, then read the full range back
and verify per cluster contents.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski
2026-03-30 23:51:03 +02:00
committed by Rob Bradford
parent 072b3a85d2
commit bb833a90e5

View File

@@ -923,4 +923,28 @@ mod unit_tests {
let buf = async_read(&disk, offset, new_data.len());
assert_eq!(buf, new_data, "should read new data after rewrite");
}
#[test]
fn test_qcow_async_large_sequential_io() {
let cluster_size = 64 * 1024;
let num_clusters = 8;
let total_len = cluster_size * num_clusters;
let offset = 0u64;
let mut data = vec![0u8; total_len];
for (i, chunk) in data.chunks_mut(cluster_size).enumerate() {
chunk.fill((i + 1) as u8);
}
let (_temp, disk) = create_disk_with_data(100 * 1024 * 1024, &data, offset, true);
let buf = async_read(&disk, offset, total_len);
assert_eq!(buf.len(), total_len);
for (i, chunk) in buf.chunks(cluster_size).enumerate() {
assert!(
chunk.iter().all(|&b| b == (i + 1) as u8),
"cluster {i} mismatch"
);
}
}
}