tstest/natlab/vmtest: don't require KVM; use TCG on macOS

startCloudQEMU hardcoded -machine q35,accel=kvm and -cpu host,
which fails on any host without KVM (notably macOS). Replace
with a qemuAccelArgs helper that probes /dev/kvm and falls back
to QEMU's TCG software emulation, matching the pattern already
used by tstest/integration/nat. Also wire the helper into
startGokrazyQEMU so gokrazy VMs pick up KVM when available.

Updates #13038

Change-Id: I7745518db823279b1880957bb14ca2ffdaab4c50
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2026-05-11 17:53:45 -07:00
committed by Brad Fitzpatrick
parent e062b46984
commit f4c5613156
2 changed files with 22 additions and 4 deletions
+2 -2
View File
@@ -7,7 +7,7 @@
// and multi-NIC configurations for scenarios like subnet routing.
//
// Prerequisites:
// - qemu-system-x86_64 and KVM access (typically the "kvm" group; no root required)
// - qemu-system-x86_64 (KVM is used automatically on Linux when /dev/kvm is accessible)
// - A built gokrazy natlabapp image (auto-built on first run via "make natlab" in gokrazy/)
//
// Run tests with:
@@ -52,7 +52,7 @@ import (
)
var (
runVMTests = flag.Bool("run-vm-tests", false, "run tests that require VMs with KVM")
runVMTests = flag.Bool("run-vm-tests", false, "run tests that require QEMU VMs")
verboseVMDebug = flag.Bool("verbose-vm-debug", false, "enable verbose debug logging for VM tests")
testVersion = flag.String("test-version", "", `if non-empty, download tailscale & tailscaled at the given release version (e.g. "1.97.255", "unstable", or "stable") instead of building from the source tree`)
)