mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: fix cargo test -p block
`RawBackend::IoUring` is only available when `io_uring` feature is defined. Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
@@ -33,5 +33,8 @@ vm-virtio = { path = "../vm-virtio" }
|
||||
vmm-sys-util = { workspace = true }
|
||||
zstd = "0.13"
|
||||
|
||||
[dev-dependencies]
|
||||
cfg-if = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -170,10 +170,15 @@ mod unit_tests {
|
||||
|
||||
fn assert_async_io_from_dyn(disk: &dyn AsyncDiskFile, expect_backend: RawBackend) {
|
||||
let io: Box<dyn AsyncIo> = disk.create_async_io(128).unwrap();
|
||||
assert_eq!(
|
||||
io.batch_requests_enabled(),
|
||||
expect_backend == RawBackend::IoUring
|
||||
);
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "io_uring")] {
|
||||
let expected_batch_requests = expect_backend == RawBackend::IoUring;
|
||||
} else {
|
||||
let _ = expect_backend;
|
||||
let expected_batch_requests = false;
|
||||
}
|
||||
}
|
||||
assert_eq!(io.batch_requests_enabled(), expected_batch_requests);
|
||||
}
|
||||
|
||||
fn assert_sync_backend(disk: &RawDisk) {
|
||||
|
||||
Reference in New Issue
Block a user