tests: Port test_initramfs to new methodology

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-08-12 12:20:14 +01:00 committed by Sebastien Boeuf
parent dd39aedde1
commit fd48779a0d

View File

@ -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);
});
}