tests: Enable test cases checking PCI MSI on AArch64

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
This commit is contained in:
Michael Zhao 2020-08-28 16:36:43 +08:00 committed by Sebastien Boeuf
parent 2b8e08bd36
commit a1c4c77cd8

View File

@ -1132,16 +1132,22 @@ mod tests {
// 1 virtio-net with 5 vectors: config, Rx (2), Tx (2) // 1 virtio-net with 5 vectors: config, Rx (2), Tx (2)
// Based on the above, the total vectors should 14. // Based on the above, the total vectors should 14.
// This is a PCI only feature. // This is a PCI only feature.
#[cfg(all(not(feature = "mmio"), feature = "acpi"))] #[cfg(not(feature = "mmio"))]
assert_eq!( {
guest #[cfg(target_arch = "x86_64")]
.ssh_command("grep -c PCI-MSI /proc/interrupts") let grep_cmd = "grep -c PCI-MSI /proc/interrupts";
.unwrap_or_default() #[cfg(target_arch = "aarch64")]
.trim() let grep_cmd = "grep -c ITS-MSI /proc/interrupts";
.parse::<u32>() assert_eq!(
.unwrap_or_default(), guest
10 + (num_queues as u32) .ssh_command(grep_cmd)
); .unwrap_or_default()
.trim()
.parse::<u32>()
.unwrap_or_default(),
10 + (num_queues as u32)
);
}
// ACPI is not built with mmio, hence we can't test the resize // ACPI is not built with mmio, hence we can't test the resize
// feature for mmio. // feature for mmio.
@ -2259,26 +2265,32 @@ mod tests {
} }
#[cfg_attr(not(feature = "mmio"), test)] #[cfg_attr(not(feature = "mmio"), test)]
#[cfg(target_arch = "x86_64")]
fn test_pci_msi() { fn test_pci_msi() {
test_block!(tb, "", { 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 child = GuestCommand::new(&guest) let mut cmd = GuestCommand::new(&guest);
.args(&["--cpus", "boot=1"]) cmd.args(&["--cpus", "boot=1"])
.args(&["--memory", "size=512M"]) .args(&["--memory", "size=512M"])
.args(&["--kernel", guest.fw_path.as_str()]) .args(&["--kernel", guest.fw_path.as_str()])
.default_disks() .default_disks()
.default_net() .default_net();
.spawn()
.unwrap(); #[cfg(target_arch = "aarch64")]
cmd.args(&["--cmdline", DIRECT_KERNEL_BOOT_CMDLINE]);
let mut child = cmd.spawn().unwrap();
thread::sleep(std::time::Duration::new(20, 0)); thread::sleep(std::time::Duration::new(20, 0));
#[cfg(target_arch = "x86_64")]
let grep_cmd = "grep -c PCI-MSI /proc/interrupts";
#[cfg(target_arch = "aarch64")]
let grep_cmd = "grep -c ITS-MSI /proc/interrupts";
aver_eq!( aver_eq!(
tb, tb,
guest guest
.ssh_command("grep -c PCI-MSI /proc/interrupts") .ssh_command(grep_cmd)
.unwrap_or_default() .unwrap_or_default()
.trim() .trim()
.parse::<u32>() .parse::<u32>()