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 <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2019-06-12 18:45:41 -07:00 committed by Samuel Ortiz
parent 5e803ab18f
commit 5f7d520dc1

View File

@ -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::<u32>()
.unwrap(),
0
);
aver_eq!(
tb,
ssh_command("cat /proc/interrupts | grep 'IO-APIC' | grep -c 'cascade'")
.trim()
.parse::<u32>()
.unwrap(),
0
);
ssh_command("sudo reboot");
thread::sleep(std::time::Duration::new(10, 0));
let _ = child.kill();
let _ = child.wait();
Ok(())
});
}
}