mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: raw: Add resize test
Verify that resize succeeds and updates the logical size. Assisted-by: Claude:Opus-4.6 Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
@@ -151,7 +151,7 @@ mod unit_tests {
|
|||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::async_io::AsyncIo;
|
use crate::async_io::AsyncIo;
|
||||||
use crate::disk_file::{AsyncDiskFile, DiskSize};
|
use crate::disk_file::{AsyncDiskFile, DiskSize, Resizable};
|
||||||
|
|
||||||
const TEST_SIZE: u64 = 0x1122_3344;
|
const TEST_SIZE: u64 = 0x1122_3344;
|
||||||
|
|
||||||
@@ -240,4 +240,13 @@ mod unit_tests {
|
|||||||
let disk = RawDisk::new(file, RawBackend::IoUring);
|
let disk = RawDisk::new(file, RawBackend::IoUring);
|
||||||
assert_try_clone(&disk, RawBackend::IoUring);
|
assert_try_clone(&disk, RawBackend::IoUring);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn resize_changes_file_size() {
|
||||||
|
let file = make_raw_file();
|
||||||
|
let mut disk = RawDisk::new(file, RawBackend::Aio);
|
||||||
|
let new_size = TEST_SIZE * 2;
|
||||||
|
disk.resize(new_size).unwrap();
|
||||||
|
assert_eq!(disk.logical_size().unwrap(), new_size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user