mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-22 04:25:21 +00:00
tests: Port test_initramfs to new methodology
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
dd39aedde1
commit
fd48779a0d
@ -4666,7 +4666,6 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_initramfs() {
|
fn test_initramfs() {
|
||||||
test_block!(tb, "", {
|
|
||||||
let mut focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
|
let mut focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
|
||||||
let guest = Guest::new(&mut focal);
|
let guest = Guest::new(&mut focal);
|
||||||
let mut workload_path = dirs::home_dir().unwrap();
|
let mut workload_path = dirs::home_dir().unwrap();
|
||||||
@ -4700,15 +4699,15 @@ mod tests {
|
|||||||
thread::sleep(std::time::Duration::new(20, 0));
|
thread::sleep(std::time::Duration::new(20, 0));
|
||||||
|
|
||||||
let _ = child.kill();
|
let _ = child.kill();
|
||||||
match child.wait_with_output() {
|
let output = child.wait_with_output().unwrap();
|
||||||
Ok(out) => {
|
|
||||||
let s = String::from_utf8_lossy(&out.stdout);
|
let r = std::panic::catch_unwind(|| {
|
||||||
aver_ne!(tb, s.lines().position(|line| line == test_string), None);
|
let s = String::from_utf8_lossy(&output.stdout);
|
||||||
}
|
|
||||||
Err(_) => aver!(tb, false),
|
assert_ne!(s.lines().position(|line| line == test_string), None);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
Ok(())
|
|
||||||
|
handle_child_output(r, &output);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user