mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-03 03:15:20 +00:00
tests: Add direct boot test using bzImage
This supplements our direct booting test that uses vmlinux. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
429b53a672
commit
226d3366d2
42
src/main.rs
42
src/main.rs
@ -374,4 +374,46 @@ mod tests {
|
|||||||
Ok(())
|
Ok(())
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_bzimage_boot() {
|
||||||
|
test_block!(tb, "", {
|
||||||
|
let (disks, _) = prepare_files();
|
||||||
|
let mut workload_path = dirs::home_dir().unwrap();
|
||||||
|
workload_path.push("workloads");
|
||||||
|
|
||||||
|
let mut kernel_path = workload_path.clone();
|
||||||
|
kernel_path.push("bzImage");
|
||||||
|
|
||||||
|
let mut child = Command::new("target/debug/cloud-hypervisor")
|
||||||
|
.args(&["--cpus", "1"])
|
||||||
|
.args(&["--memory", "512"])
|
||||||
|
.args(&["--kernel", kernel_path.to_str().unwrap()])
|
||||||
|
.args(&["--disk", disks[0], disks[1]])
|
||||||
|
.args(&["--net", "tap=,mac=,ip=192.168.2.1,mask=255.255.255.0"])
|
||||||
|
.args(&["--cmdline", "root=PARTUUID=3cb0e0a5-925d-405e-bc55-edf0cec8f10a 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(10, 0));
|
||||||
|
|
||||||
|
aver_eq!(tb, get_cpu_count(), 1);
|
||||||
|
aver!(tb, get_total_memory() > 496_000);
|
||||||
|
aver!(tb, get_entropy() >= 1000);
|
||||||
|
aver_eq!(
|
||||||
|
tb,
|
||||||
|
ssh_command("grep -c PCI-MSI /proc/interrupts")
|
||||||
|
.trim()
|
||||||
|
.parse::<u32>()
|
||||||
|
.unwrap(),
|
||||||
|
8
|
||||||
|
);
|
||||||
|
|
||||||
|
ssh_command("sudo reboot");
|
||||||
|
thread::sleep(std::time::Duration::new(10, 0));
|
||||||
|
let _ = child.kill();
|
||||||
|
let _ = child.wait();
|
||||||
|
Ok(())
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user