mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-22 04:25:21 +00:00
tests: Enable serial test cases for AArch64
Enabled all "ttyS0" related test cases: - test_serial_off - test_serial_tty - test_serial_file Enabled mandatory guest kernel driver for "ns16550a" on AArch64. Signed-off-by: Michael Zhao <michael.zhao@arm.com>
This commit is contained in:
parent
ee7fcdb3cf
commit
c3a75dafc5
@ -1444,7 +1444,7 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=1
|
||||
CONFIG_SERIAL_8250_FSL=y
|
||||
# CONFIG_SERIAL_8250_DW is not set
|
||||
# CONFIG_SERIAL_8250_RT288X is not set
|
||||
# CONFIG_SERIAL_OF_PLATFORM is not set
|
||||
CONFIG_SERIAL_OF_PLATFORM=y
|
||||
|
||||
#
|
||||
# Non-8250 serial port support
|
||||
|
@ -108,6 +108,11 @@ mod tests {
|
||||
const DIRECT_KERNEL_BOOT_CMDLINE: &str =
|
||||
"root=/dev/vda1 console=hvc0 rw systemd.journald.forward_to_console=1";
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
const GREP_SERIAL_IRQ_CMD: &str = "cat /proc/interrupts | grep 'IO-APIC' | grep -c 'ttyS0'";
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
const GREP_SERIAL_IRQ_CMD: &str = "cat /proc/interrupts | grep 'GICv3' | grep -c 'ttyS0'";
|
||||
|
||||
const PIPE_SIZE: i32 = 32 << 20;
|
||||
|
||||
impl UbuntuDiskConfig {
|
||||
@ -3558,20 +3563,13 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn test_serial_off() {
|
||||
let mut focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
|
||||
let guest = Guest::new(&mut focal);
|
||||
let mut workload_path = dirs::home_dir().unwrap();
|
||||
workload_path.push("workloads");
|
||||
|
||||
let mut kernel_path = workload_path;
|
||||
kernel_path.push("bzImage");
|
||||
|
||||
let mut child = GuestCommand::new(&guest)
|
||||
.args(&["--cpus", "boot=1"])
|
||||
.args(&["--memory", "size=512M"])
|
||||
.args(&["--kernel", kernel_path.to_str().unwrap()])
|
||||
.args(&["--kernel", direct_kernel_boot_path().to_str().unwrap()])
|
||||
.args(&["--cmdline", DIRECT_KERNEL_BOOT_CMDLINE])
|
||||
.default_disks()
|
||||
.default_net()
|
||||
@ -3586,7 +3584,7 @@ mod tests {
|
||||
// Test that there is no ttyS0
|
||||
assert_eq!(
|
||||
guest
|
||||
.ssh_command("cat /proc/interrupts | grep 'IO-APIC' | grep -c 'ttyS0'")
|
||||
.ssh_command(GREP_SERIAL_IRQ_CMD)
|
||||
.unwrap()
|
||||
.trim()
|
||||
.parse::<u32>()
|
||||
@ -3626,11 +3624,10 @@ mod tests {
|
||||
let r = std::panic::catch_unwind(|| {
|
||||
guest.wait_vm_boot(None).unwrap();
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
// Test that there is a ttyS0
|
||||
assert_eq!(
|
||||
guest
|
||||
.ssh_command("cat /proc/interrupts | grep 'IO-APIC' | grep -c 'ttyS0'")
|
||||
.ssh_command(GREP_SERIAL_IRQ_CMD)
|
||||
.unwrap()
|
||||
.trim()
|
||||
.parse::<u32>()
|
||||
@ -3651,7 +3648,6 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn test_serial_tty() {
|
||||
let mut focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
|
||||
let guest = Guest::new(&mut focal);
|
||||
@ -3685,7 +3681,7 @@ mod tests {
|
||||
// Test that there is a ttyS0
|
||||
assert_eq!(
|
||||
guest
|
||||
.ssh_command("cat /proc/interrupts | grep 'IO-APIC' | grep -c 'ttyS0'")
|
||||
.ssh_command(GREP_SERIAL_IRQ_CMD)
|
||||
.unwrap()
|
||||
.trim()
|
||||
.parse::<u32>()
|
||||
@ -3709,7 +3705,6 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn test_serial_file() {
|
||||
let mut focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
|
||||
let guest = Guest::new(&mut focal);
|
||||
@ -3741,7 +3736,7 @@ mod tests {
|
||||
// Test that there is a ttyS0
|
||||
assert_eq!(
|
||||
guest
|
||||
.ssh_command("cat /proc/interrupts | grep 'IO-APIC' | grep -c 'ttyS0'")
|
||||
.ssh_command(GREP_SERIAL_IRQ_CMD)
|
||||
.unwrap()
|
||||
.trim()
|
||||
.parse::<u32>()
|
||||
|
Loading…
x
Reference in New Issue
Block a user