mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-25 09:21:15 +00:00
tests: Add a "huge" memory test
Now that we have expanded our address space we should add automated testing to try VMs that use a large amount of RAM. As the hypervisor does an anonymous mmap() for the backing of memory and during a typical test boot the guest will not touch it all it should be possible to test large RAM VMs even if that exceeds the RAM of the host machine. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
b488d4859b
commit
5f0337c21d
41
src/main.rs
41
src/main.rs
@ -948,6 +948,47 @@ mod tests {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(not(feature = "mmio"), test)]
|
||||||
|
fn test_huge_memory() {
|
||||||
|
test_block!(tb, "", {
|
||||||
|
let mut clear = ClearDiskConfig::new();
|
||||||
|
let guest = Guest::new(&mut clear);
|
||||||
|
let mut child = Command::new("target/debug/cloud-hypervisor")
|
||||||
|
.args(&["--cpus", "1"])
|
||||||
|
.args(&["--memory", "size=128G"])
|
||||||
|
.args(&["--kernel", guest.fw_path.as_str()])
|
||||||
|
.args(&[
|
||||||
|
"--disk",
|
||||||
|
guest
|
||||||
|
.disk_config
|
||||||
|
.disk(DiskType::OperatingSystem)
|
||||||
|
.unwrap()
|
||||||
|
.as_str(),
|
||||||
|
guest
|
||||||
|
.disk_config
|
||||||
|
.disk(DiskType::CloudInit)
|
||||||
|
.unwrap()
|
||||||
|
.as_str(),
|
||||||
|
])
|
||||||
|
.args(&["--net", guest.default_net_string().as_str()])
|
||||||
|
.spawn()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
thread::sleep(std::time::Duration::new(20, 0));
|
||||||
|
|
||||||
|
aver!(
|
||||||
|
tb,
|
||||||
|
guest.get_total_memory().unwrap_or_default() > 128_000_000
|
||||||
|
);
|
||||||
|
|
||||||
|
guest.ssh_command("sudo shutdown -h now")?;
|
||||||
|
thread::sleep(std::time::Duration::new(10, 0));
|
||||||
|
let _ = child.kill();
|
||||||
|
let _ = child.wait();
|
||||||
|
Ok(())
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "mmio"), test)]
|
#[cfg_attr(not(feature = "mmio"), test)]
|
||||||
fn test_pci_msi() {
|
fn test_pci_msi() {
|
||||||
test_block!(tb, "", {
|
test_block!(tb, "", {
|
||||||
|
Loading…
Reference in New Issue
Block a user