tests: Wait for VMM to exit in test_serial_file/test_console_file

This should address any flakiness as the VMM process will have
completely terminated and all files closed.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-02-27 13:56:25 +00:00
parent 2f58fb8307
commit c98949bdd3

View File

@ -2087,8 +2087,10 @@ mod tests {
guest.ssh_command("sudo shutdown -h now")?;
thread::sleep(std::time::Duration::new(10, 0));
// Check that the cloud-hypervisor binary actually terminated
if let Ok(status) = child.wait() {
aver_eq!(tb, status.success(), true);
}
// Do this check after shutdown of the VM as an easy way to ensure
// all writes are flushed to disk
let mut f = std::fs::File::open(serial_path)?;
@ -2096,9 +2098,6 @@ mod tests {
f.read_to_string(&mut buf)?;
aver!(tb, buf.contains("cloud login:"));
let _ = child.kill();
let _ = child.wait();
Ok(())
});
}
@ -2170,8 +2169,11 @@ mod tests {
thread::sleep(std::time::Duration::new(20, 0));
guest.ssh_command("sudo shutdown -h now")?;
thread::sleep(std::time::Duration::new(10, 0));
// Check that the cloud-hypervisor binary actually terminated
if let Ok(status) = child.wait() {
aver_eq!(tb, status.success(), true);
}
// Do this check after shutdown of the VM as an easy way to ensure
// all writes are flushed to disk
let mut f = std::fs::File::open(console_path)?;
@ -2179,9 +2181,6 @@ mod tests {
f.read_to_string(&mut buf)?;
aver!(tb, buf.contains("cloud login:"));
let _ = child.kill();
let _ = child.wait();
Ok(())
});
}