mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: factory: Add test for sync fallback
Verify that open_disk() falls back to synchronous backend when both io_uring and AIO are disabled, and that the returned disk reports the correct logical size. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
37693aa141
commit
03a5c29c48
@@ -262,4 +262,24 @@ mod unit_tests {
|
||||
let opened = open_disk(&options).unwrap();
|
||||
assert_eq!(opened.image_type, ImageType::Raw);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sync_fallback_when_async_disabled() {
|
||||
let tmp = TempFile::new().unwrap();
|
||||
let size = 1u64 << 20;
|
||||
tmp.as_file().set_len(size).unwrap();
|
||||
let path = tmp.as_path().to_owned();
|
||||
let options = DiskOpenOptions {
|
||||
path: &path,
|
||||
readonly: false,
|
||||
direct: false,
|
||||
sparse: false,
|
||||
backing_files: false,
|
||||
disable_io_uring: true,
|
||||
disable_aio: true,
|
||||
};
|
||||
let opened = open_disk(&options).unwrap();
|
||||
assert_eq!(opened.image_type, ImageType::Raw);
|
||||
assert_eq!(opened.disk.logical_size().unwrap(), size);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user