mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-07-15 13:47:14 +00:00
tests: Port test_memory_mergeable to new methodology
As a compromise we only print out the first child's output. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
9dd4625fb4
commit
dd39aedde1
@ -1881,7 +1881,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn test_memory_mergeable(mergeable: bool) {
|
fn test_memory_mergeable(mergeable: bool) {
|
||||||
test_block!(tb, "", {
|
|
||||||
let memory_param = if mergeable {
|
let memory_param = if mergeable {
|
||||||
"mergeable=on"
|
"mergeable=on"
|
||||||
} else {
|
} else {
|
||||||
@ -1919,6 +1918,7 @@ mod tests {
|
|||||||
.default_disks()
|
.default_disks()
|
||||||
.args(&["--net", guest2.default_net_string().as_str()])
|
.args(&["--net", guest2.default_net_string().as_str()])
|
||||||
.args(&["--serial", "tty", "--console", "off"])
|
.args(&["--serial", "tty", "--console", "off"])
|
||||||
|
.capture_output()
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -1926,7 +1926,7 @@ mod tests {
|
|||||||
// sure KSM has enough time to merge identical pages between the
|
// sure KSM has enough time to merge identical pages between the
|
||||||
// 2 VMs.
|
// 2 VMs.
|
||||||
thread::sleep(std::time::Duration::new(60, 0));
|
thread::sleep(std::time::Duration::new(60, 0));
|
||||||
|
let r = std::panic::catch_unwind(|| {
|
||||||
// Get new PSS
|
// Get new PSS
|
||||||
let new_pss = get_pss(child1.id());
|
let new_pss = get_pss(child1.id());
|
||||||
|
|
||||||
@ -1937,17 +1937,19 @@ mod tests {
|
|||||||
println!("old PSS {}, new PSS {}", old_pss, new_pss);
|
println!("old PSS {}, new PSS {}", old_pss, new_pss);
|
||||||
|
|
||||||
if mergeable {
|
if mergeable {
|
||||||
aver!(tb, new_pss < (old_pss * 0.95));
|
assert!(new_pss < (old_pss * 0.95));
|
||||||
} else {
|
} else {
|
||||||
aver!(tb, (old_pss * 0.95) < new_pss && new_pss < (old_pss * 1.05));
|
assert!((old_pss * 0.95) < new_pss && new_pss < (old_pss * 1.05));
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
let _ = child1.kill();
|
let _ = child1.kill();
|
||||||
let _ = child2.kill();
|
let _ = child2.kill();
|
||||||
let _ = child1.wait();
|
|
||||||
let _ = child2.wait();
|
let output = child1.wait_with_output().unwrap();
|
||||||
Ok(())
|
child2.wait().unwrap();
|
||||||
});
|
|
||||||
|
handle_child_output(r, &output);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn _get_vmm_overhead(pid: u32, guest_memory_size: u32) -> HashMap<String, u32> {
|
fn _get_vmm_overhead(pid: u32, guest_memory_size: u32) -> HashMap<String, u32> {
|
||||||
|
Loading…
Reference in New Issue
Block a user