mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
pvh: Add integration test to validate PVH boot
Add an integration test that builds cloud-hypervisor with the pvh_boot feature and boots a kernel built with CONFIG_PVH. Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
This commit is contained in:
committed by
Sebastien Boeuf
parent
da084fade7
commit
efb2447801
@@ -1052,6 +1052,51 @@ mod tests {
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "pvh_boot", test)]
|
||||
fn test_pvh_boot() {
|
||||
test_block!(tb, "", {
|
||||
let mut clear = ClearDiskConfig::new();
|
||||
let guest = Guest::new(&mut clear);
|
||||
let mut workload_path = dirs::home_dir().unwrap();
|
||||
workload_path.push("workloads");
|
||||
|
||||
let mut kernel_path = workload_path;
|
||||
kernel_path.push("vmlinux.pvh");
|
||||
|
||||
let mut child = GuestCommand::new(&guest)
|
||||
.args(&["--cpus","boot=1"])
|
||||
.args(&["--memory", "size=512M"])
|
||||
.args(&["--kernel", kernel_path.to_str().unwrap()])
|
||||
.default_disks()
|
||||
.default_net()
|
||||
.args(&["--cmdline", "root=PARTUUID=6fb4d1a8-6c8c-4dd7-9f7c-1fe0b9f2574c console=tty0 console=ttyS0,115200n8 console=hvc0 quiet init=/usr/lib/systemd/systemd-bootchart initcall_debug tsc=reliable no_timer_check noreplace-smp cryptomgr.notests rootfstype=ext4,btrfs,xfs kvm-intel.nested=1 rw"])
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
thread::sleep(std::time::Duration::new(20, 0));
|
||||
|
||||
aver_eq!(tb, guest.get_cpu_count().unwrap_or_default(), 1);
|
||||
aver!(tb, guest.get_total_memory().unwrap_or_default() > 496_000);
|
||||
aver!(tb, guest.get_entropy().unwrap_or_default() >= 900);
|
||||
|
||||
#[cfg(not(feature = "mmio"))]
|
||||
aver_eq!(
|
||||
tb,
|
||||
guest
|
||||
.ssh_command("grep -c PCI-MSI /proc/interrupts")
|
||||
.unwrap_or_default()
|
||||
.trim()
|
||||
.parse::<u32>()
|
||||
.unwrap_or_default(),
|
||||
12
|
||||
);
|
||||
|
||||
let _ = child.kill();
|
||||
let _ = child.wait();
|
||||
Ok(())
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_bzimage_boot() {
|
||||
test_block!(tb, "", {
|
||||
|
||||
Reference in New Issue
Block a user