VM backends (vfkit, cloudhv) lack build tags: macOS tests compile and fail on Linux (and vice versa) #107
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while verifying the
volumesbranch:go test ./...on Linux failsinternal/agent/vfkitwithlisten unix .../vfkit.sock: socket: operation not permitted. vfkit is the macOS backend — it drives Apple's Virtualization.framework via a macOS-only binary — yet it has no//go:build darwintag, so its tests compile and run on Linux where they can only fail.Asymmetry
The wiring layer already uses build tags, but the backend packages do not:
internal/agent/vfkitrun/wire_darwin.go(//go:build darwin)internal/agent/cloudhvrun/wire_linux.go(//go:build linux)cp --reflink, TAP,syscall.SetsidThe rest of the tree already follows the convention (
netenv/snoop_linux.go,hostinfo/hostinfo_{linux,darwin}.go,run/wire_{linux,darwin}.go). The two backend packages are the holdouts.Consequence
go test ./...on Linux compiles and runs vfkit tests that can never pass (no vfkit binary, no Virtualization.framework, and this sandbox can't evenbinda Unix socket — Python'ssocket.bind('/tmp/x.sock')fails with the same EPERM). Symmetrically, cloudhv tests run on macOS where cloud-hypervisor doesn't exist. A green suite is not a trustworthy signal until these are gated.This is pre-existing (present on
mainat8d30bd3), not introduced by thevolumesbranch.The fix, roughly
Add
//go:build darwinto vfkit's source + test files (exceptconsole_pty_linux_test.go, already//go:build linux), and//go:build linuxto cloudhv's source + test files. Symmetric, small, matches the convention already used innetenv,hostinfo, andrun/wire_*.Why it matters before the workspace work
Building a gondolin-style workspace mount on top of
volumesneeds a test run that actually means something on the platform it runs on. Right now a Linux dev can't tell a real regression from a macOS-only test failing to bind a socket.Migrated from git-collab issue
fb095e7b711cfead2d844af6bb0ea48fa6d9bd08.Original author: a73x dev@a73x.sh.