mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-26 09:51:15 +00:00
ci: Add integration test for virtio-blk multiqueue support
Just add a new integration test to verify that multiqueue support is correctly supported and that we can find the right amount of queues in the guest. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
f5b53ae4be
commit
a33e8342ee
66
src/main.rs
66
src/main.rs
@ -2670,6 +2670,72 @@ mod tests {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(not(feature = "mmio"), test)]
|
||||||
|
fn test_virtio_blk_mq() {
|
||||||
|
test_block!(tb, "", {
|
||||||
|
let mut clear = ClearDiskConfig::new();
|
||||||
|
let guest = Guest::new(&mut clear);
|
||||||
|
let mut blk_file_path = dirs::home_dir().unwrap();
|
||||||
|
blk_file_path.push("workloads");
|
||||||
|
blk_file_path.push("blk.img");
|
||||||
|
|
||||||
|
let mut cloud_child = Command::new("target/release/cloud-hypervisor")
|
||||||
|
.args(&["--cpus", "boot=4"])
|
||||||
|
.args(&["--memory", "size=512M,file=/dev/shm"])
|
||||||
|
.args(&["--kernel", guest.fw_path.as_str()])
|
||||||
|
.args(&[
|
||||||
|
"--disk",
|
||||||
|
format!(
|
||||||
|
"path={}",
|
||||||
|
guest.disk_config.disk(DiskType::OperatingSystem).unwrap()
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
|
format!(
|
||||||
|
"path={}",
|
||||||
|
guest.disk_config.disk(DiskType::CloudInit).unwrap()
|
||||||
|
)
|
||||||
|
.as_str(),
|
||||||
|
format!("path={},num_queues=4", blk_file_path.to_str().unwrap()).as_str(),
|
||||||
|
])
|
||||||
|
.args(&["--net", guest.default_net_string().as_str()])
|
||||||
|
.spawn()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
thread::sleep(std::time::Duration::new(20, 0));
|
||||||
|
|
||||||
|
// Check both if /dev/vdc exists and if the block size is 16M.
|
||||||
|
aver_eq!(
|
||||||
|
tb,
|
||||||
|
guest
|
||||||
|
.ssh_command("lsblk | grep vdc | grep -c 16M")
|
||||||
|
.unwrap_or_default()
|
||||||
|
.trim()
|
||||||
|
.parse::<u32>()
|
||||||
|
.unwrap_or_default(),
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
// Check if the number of queues is 4.
|
||||||
|
aver_eq!(
|
||||||
|
tb,
|
||||||
|
guest
|
||||||
|
.ssh_command("ls -ll /sys/block/vdc/mq | grep ^d | wc -l")
|
||||||
|
.unwrap_or_default()
|
||||||
|
.trim()
|
||||||
|
.parse::<u32>()
|
||||||
|
.unwrap_or_default(),
|
||||||
|
4
|
||||||
|
);
|
||||||
|
|
||||||
|
guest.ssh_command("sudo shutdown -h now")?;
|
||||||
|
thread::sleep(std::time::Duration::new(5, 0));
|
||||||
|
let _ = cloud_child.kill();
|
||||||
|
let _ = cloud_child.wait();
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "mmio"), test)]
|
#[cfg_attr(not(feature = "mmio"), test)]
|
||||||
fn test_vhost_user_net() {
|
fn test_vhost_user_net() {
|
||||||
test_block!(tb, "", {
|
test_block!(tb, "", {
|
||||||
|
Loading…
Reference in New Issue
Block a user