From 5f7d520dc1d20e04d87e9042aa72153c92a394bb Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Wed, 12 Jun 2019 18:45:41 -0700 Subject: [PATCH] tests: Add split_irqchip test Based on the newly added code, we expect the split irqchip to be used. This means we should not see any "timer" or "cascade" components attached to the IOAPIC since our userspace IOAPIC does not advertise those. Signed-off-by: Sebastien Boeuf --- src/main.rs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/main.rs b/src/main.rs index 1a7081b5b..8dc7db2a9 100755 --- a/src/main.rs +++ b/src/main.rs @@ -416,4 +416,44 @@ mod tests { Ok(()) }); } + + #[test] + fn test_split_irqchip() { + test_block!(tb, "", { + let (disks, fw_path) = prepare_files(); + let mut child = Command::new("target/debug/cloud-hypervisor") + .args(&["--cpus", "1"]) + .args(&["--memory", "512"]) + .args(&["--kernel", fw_path.as_str()]) + .args(&["--disk", disks[0], disks[1]]) + .args(&["--net", "tap=,mac=,ip=192.168.2.1,mask=255.255.255.0"]) + .spawn() + .unwrap(); + + thread::sleep(std::time::Duration::new(10, 0)); + + aver_eq!( + tb, + ssh_command("cat /proc/interrupts | grep 'IO-APIC' | grep -c 'timer'") + .trim() + .parse::() + .unwrap(), + 0 + ); + aver_eq!( + tb, + ssh_command("cat /proc/interrupts | grep 'IO-APIC' | grep -c 'cascade'") + .trim() + .parse::() + .unwrap(), + 0 + ); + + ssh_command("sudo reboot"); + thread::sleep(std::time::Duration::new(10, 0)); + let _ = child.kill(); + let _ = child.wait(); + Ok(()) + }); + } }