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]
|
||||
fn test_initramfs() {
|
||||
test_block!(tb, "", {
|
||||
let mut focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
|
||||
let guest = Guest::new(&mut focal);
|
||||
let mut workload_path = dirs::home_dir().unwrap();
|
||||
@ -4700,15 +4699,15 @@ mod tests {
|
||||
thread::sleep(std::time::Duration::new(20, 0));
|
||||
|
||||
let _ = child.kill();
|
||||
match child.wait_with_output() {
|
||||
Ok(out) => {
|
||||
let s = String::from_utf8_lossy(&out.stdout);
|
||||
aver_ne!(tb, s.lines().position(|line| line == test_string), None);
|
||||
}
|
||||
Err(_) => aver!(tb, false),
|
||||
}
|
||||
let output = child.wait_with_output().unwrap();
|
||||
|
||||
let r = std::panic::catch_unwind(|| {
|
||||
let s = String::from_utf8_lossy(&output.stdout);
|
||||
|
||||
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