mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-20 15:01:16 +00:00
tests: Port test_serial_null to the new methodology
Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
4bb00224b4
commit
4e0e3d6221
@ -3120,7 +3120,6 @@ mod tests {
|
|||||||
|
|
||||||
#[cfg_attr(not(feature = "mmio"), test)]
|
#[cfg_attr(not(feature = "mmio"), test)]
|
||||||
fn test_serial_null() {
|
fn test_serial_null() {
|
||||||
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 cmd = GuestCommand::new(&guest);
|
let mut cmd = GuestCommand::new(&guest);
|
||||||
@ -3141,10 +3140,10 @@ mod tests {
|
|||||||
|
|
||||||
thread::sleep(std::time::Duration::new(20, 0));
|
thread::sleep(std::time::Duration::new(20, 0));
|
||||||
|
|
||||||
|
let r = std::panic::catch_unwind(|| {
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
// Test that there is a ttyS0
|
// Test that there is a ttyS0
|
||||||
aver_eq!(
|
assert_eq!(
|
||||||
tb,
|
|
||||||
guest
|
guest
|
||||||
.ssh_command("cat /proc/interrupts | grep 'IO-APIC' | grep -c 'ttyS0'")
|
.ssh_command("cat /proc/interrupts | grep 'IO-APIC' | grep -c 'ttyS0'")
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
@ -3153,19 +3152,17 @@ mod tests {
|
|||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
});
|
||||||
|
|
||||||
let _ = child.kill();
|
let _ = child.kill();
|
||||||
match child.wait_with_output() {
|
let output = child.wait_with_output().unwrap();
|
||||||
Ok(out) => {
|
handle_child_output(r, &output);
|
||||||
aver!(
|
|
||||||
tb,
|
let r = std::panic::catch_unwind(|| {
|
||||||
!String::from_utf8_lossy(&out.stdout).contains("cloud login:")
|
assert!(!String::from_utf8_lossy(&output.stdout).contains("cloud login:"));
|
||||||
);
|
|
||||||
}
|
|
||||||
Err(_) => aver!(tb, false),
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
handle_child_output(r, &output);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "mmio"), test)]
|
#[cfg_attr(not(feature = "mmio"), test)]
|
||||||
|
Loading…
Reference in New Issue
Block a user