mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
tests: extract _test_memory_overhead to tests_wrappers
Extract test logic from test_memory_overhead into a shared _test_memory_overhead wrapper function in tests_wrappers.rs. The custom memory size is set in the parent test case via with_memory(). The wrapper uses default_kernel_cmdline() and default_memory() for setup. Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
b478fa0ffd
commit
af7fabd2c6
@@ -2552,3 +2552,28 @@ pub(crate) fn _test_pci_bar_reprogramming(guest: &Guest) {
|
||||
|
||||
handle_child_output(r, &output);
|
||||
}
|
||||
|
||||
pub(crate) fn _test_memory_overhead(guest: &Guest, guest_memory_size_kb: u32) {
|
||||
let mut child = GuestCommand::new(guest)
|
||||
.default_cpus()
|
||||
.default_memory()
|
||||
.default_kernel_cmdline()
|
||||
.default_net()
|
||||
.default_disks()
|
||||
.capture_output()
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
guest.wait_vm_boot().unwrap();
|
||||
|
||||
let r = std::panic::catch_unwind(|| {
|
||||
let overhead = get_vmm_overhead(child.id(), guest_memory_size_kb);
|
||||
eprintln!("Guest memory overhead: {overhead} vs {MAXIMUM_VMM_OVERHEAD_KB}");
|
||||
assert!(overhead <= MAXIMUM_VMM_OVERHEAD_KB);
|
||||
});
|
||||
|
||||
kill_child(&mut child);
|
||||
let output = child.wait_with_output().unwrap();
|
||||
|
||||
handle_child_output(r, &output);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user