From 10de8de3de1d5b15ac7600a1d0494c7d6890e3bd Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Tue, 11 Oct 2022 17:00:33 -0400 Subject: [PATCH] Add option to disable network tests `cargo xtask run` now takes a `--disable-network` arg that turns off the network protocol tests by not creating a network device. The purpose of this flag is to make the QEMU tests faster when iterating on something locally. Disabling the network stuff drops the time down from ~12.5s to ~4.5s. The extra time doesn't matter when running in CI, but for quick local testing it can add up. --- xtask/src/opt.rs | 4 ++++ xtask/src/qemu.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/xtask/src/opt.rs b/xtask/src/opt.rs index 5b7e8c0ae..4567d42bd 100644 --- a/xtask/src/opt.rs +++ b/xtask/src/opt.rs @@ -101,6 +101,10 @@ pub struct QemuOpt { #[clap(long, action)] pub disable_kvm: bool, + /// Disable network tests. + #[clap(long, action)] + pub disable_network: bool, + /// Disable some tests that don't work in the CI. #[clap(long, action)] pub ci: bool, diff --git a/xtask/src/qemu.rs b/xtask/src/qemu.rs index d10ea09c6..b92f0dd3a 100644 --- a/xtask/src/qemu.rs +++ b/xtask/src/qemu.rs @@ -523,7 +523,7 @@ pub fn run_qemu(arch: UefiArch, opt: &QemuOpt) -> Result<()> { // Attach network device with DHCP configured for PXE. Skip this for // examples since it slows down the boot some. - let echo_service = if opt.example.is_none() { + let echo_service = if !opt.disable_network && opt.example.is_none() { cmd.args([ "-nic", "user,model=e1000,net=192.168.17.0/24,tftp=uefi-test-runner/tftp/,bootfile=fake-boot-file",