mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-25 17:31:16 +00:00
ci: Add MQ support in the test cases
The CI need to add MQ support, and the vcpu number should be bigger than or equal to queue number. Signed-off-by: Yang Zhong <yang.zhong@intel.com>
This commit is contained in:
parent
99da1dff90
commit
789a39a2d5
29
src/main.rs
29
src/main.rs
@ -1889,6 +1889,7 @@ mod tests {
|
|||||||
fn prepare_vubd(
|
fn prepare_vubd(
|
||||||
tmp_dir: &TempDir,
|
tmp_dir: &TempDir,
|
||||||
blk_img: &str,
|
blk_img: &str,
|
||||||
|
num_queues: usize,
|
||||||
rdonly: bool,
|
rdonly: bool,
|
||||||
direct: bool,
|
direct: bool,
|
||||||
) -> (std::process::Child, String) {
|
) -> (std::process::Child, String) {
|
||||||
@ -1906,8 +1907,8 @@ mod tests {
|
|||||||
.args(&[
|
.args(&[
|
||||||
"--block-backend",
|
"--block-backend",
|
||||||
format!(
|
format!(
|
||||||
"image={},sock={},readonly={},direct={}",
|
"image={},sock={},num_queues={},readonly={},direct={}",
|
||||||
blk_file_path, vubd_socket_path, rdonly, direct
|
blk_file_path, vubd_socket_path, num_queues, rdonly, direct
|
||||||
)
|
)
|
||||||
.as_str(),
|
.as_str(),
|
||||||
])
|
])
|
||||||
@ -2783,10 +2784,10 @@ mod tests {
|
|||||||
let guest = Guest::new(&mut clear);
|
let guest = Guest::new(&mut clear);
|
||||||
|
|
||||||
let (mut daemon_child, vubd_socket_path) =
|
let (mut daemon_child, vubd_socket_path) =
|
||||||
prepare_vubd(&guest.tmp_dir, "blk.img", false, false);
|
prepare_vubd(&guest.tmp_dir, "blk.img", 2, false, false);
|
||||||
|
|
||||||
let mut cloud_child = Command::new("target/release/cloud-hypervisor")
|
let mut cloud_child = Command::new("target/release/cloud-hypervisor")
|
||||||
.args(&["--cpus", "boot=1"])
|
.args(&["--cpus", "boot=2"])
|
||||||
.args(&["--memory", "size=512M,file=/dev/shm"])
|
.args(&["--memory", "size=512M,file=/dev/shm"])
|
||||||
.args(&["--kernel", guest.fw_path.as_str()])
|
.args(&["--kernel", guest.fw_path.as_str()])
|
||||||
.args(&[
|
.args(&[
|
||||||
@ -2802,7 +2803,7 @@ mod tests {
|
|||||||
)
|
)
|
||||||
.as_str(),
|
.as_str(),
|
||||||
format!(
|
format!(
|
||||||
"vhost_user=true,socket={},num_queues=1,queue_size=128,wce=true",
|
"vhost_user=true,socket={},num_queues=2,queue_size=128,wce=true",
|
||||||
vubd_socket_path
|
vubd_socket_path
|
||||||
)
|
)
|
||||||
.as_str(),
|
.as_str(),
|
||||||
@ -2825,6 +2826,19 @@ mod tests {
|
|||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
|
||||||
|
thread::sleep(std::time::Duration::new(20, 0));
|
||||||
|
// Check if the queue number in /sys/block/vdc/mq is same to 2.
|
||||||
|
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(),
|
||||||
|
2
|
||||||
|
);
|
||||||
|
|
||||||
// Mount the device
|
// Mount the device
|
||||||
guest.ssh_command("mkdir mount_image")?;
|
guest.ssh_command("mkdir mount_image")?;
|
||||||
guest.ssh_command("sudo mount -t ext4 /dev/vdc mount_image/")?;
|
guest.ssh_command("sudo mount -t ext4 /dev/vdc mount_image/")?;
|
||||||
@ -2864,7 +2878,7 @@ mod tests {
|
|||||||
let guest = Guest::new(&mut clear);
|
let guest = Guest::new(&mut clear);
|
||||||
|
|
||||||
let (mut daemon_child, vubd_socket_path) =
|
let (mut daemon_child, vubd_socket_path) =
|
||||||
prepare_vubd(&guest.tmp_dir, "blk.img", true, false);
|
prepare_vubd(&guest.tmp_dir, "blk.img", 1, true, false);
|
||||||
|
|
||||||
let mut cloud_child = Command::new("target/release/cloud-hypervisor")
|
let mut cloud_child = Command::new("target/release/cloud-hypervisor")
|
||||||
.args(&["--cpus", "boot=1"])
|
.args(&["--cpus", "boot=1"])
|
||||||
@ -2938,7 +2952,7 @@ mod tests {
|
|||||||
let guest = Guest::new(&mut clear);
|
let guest = Guest::new(&mut clear);
|
||||||
|
|
||||||
let (mut daemon_child, vubd_socket_path) =
|
let (mut daemon_child, vubd_socket_path) =
|
||||||
prepare_vubd(&guest.tmp_dir, "blk.img", false, true);
|
prepare_vubd(&guest.tmp_dir, "blk.img", 1, false, true);
|
||||||
|
|
||||||
let mut cloud_child = Command::new("target/release/cloud-hypervisor")
|
let mut cloud_child = Command::new("target/release/cloud-hypervisor")
|
||||||
.args(&["--cpus", "boot=1"])
|
.args(&["--cpus", "boot=1"])
|
||||||
@ -3006,6 +3020,7 @@ mod tests {
|
|||||||
.disk(DiskType::RawOperatingSystem)
|
.disk(DiskType::RawOperatingSystem)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.as_str(),
|
.as_str(),
|
||||||
|
1,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user