From 71d911b3aabc07e9f2bb035fb2c88f09d842e157 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 10 Mar 2022 09:09:00 +0000 Subject: [PATCH] tests: Add test for virtio-net control queue Use ethtool to trigger an event on the control queue. Signed-off-by: Rob Bradford --- tests/integration.rs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/integration.rs b/tests/integration.rs index a59d1b9ca..a9da06406 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -2195,6 +2195,46 @@ mod parallel { handle_child_output(r, &output); } + #[test] + fn test_virtio_net_ctrl_queue() { + let focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string()); + let guest = Guest::new(Box::new(focal)); + let mut cmd = GuestCommand::new(&guest); + cmd.args(&["--cpus", "boot=1"]) + .args(&["--memory", "size=512M"]) + .args(&["--kernel", direct_kernel_boot_path().to_str().unwrap()]) + .args(&["--cmdline", DIRECT_KERNEL_BOOT_CMDLINE]) + .capture_output() + .default_disks() + .default_net(); + + let mut child = cmd.spawn().unwrap(); + + guest.wait_vm_boot(None).unwrap(); + + #[cfg(target_arch = "aarch64")] + let iface = "enp0s4"; + #[cfg(target_arch = "x86_64")] + let iface = "ens4"; + + let r = std::panic::catch_unwind(|| { + assert_eq!( + guest + .ssh_command( + format!("sudo ethtool -K {} rx-gro-hw off && echo success", iface).as_str() + ) + .unwrap() + .trim(), + "success" + ); + }); + + let _ = child.kill(); + let output = child.wait_with_output().unwrap(); + + handle_child_output(r, &output); + } + #[test] #[cfg(not(feature = "mshv"))] fn test_pci_multiple_segments() {