notes

The test command: what cargo xtask test runs, and why in that order

Name: provisional, minted 2026-10-24 (UTC) by lane comments/929-xtask-03. Named for the command it describes, cargo xtask test, which script/test wraps.

This note carries the design behind xtask/src/suite.rs. The code keeps each constraint beside the line it governs; the reasons that span the whole command live here.

The order

The host pass runs first. The host crates hold the pure logic and fail in milliseconds with no emulator, so a red host test costs nothing to find (DECISIONS §7 (testing: a QEMU harness and host-testable crates, from commit one)). Only then does the command spend TCG boots: aarch64, riscv64, then x86_64. After the three legs come the boot tour on a ramfb screen for the two boards, and last the host-side image checks.

The flags

Each flag defaults to a full run, so a plain script/test always means the whole suite.

--test selects tests, not architectures. Every leg still runs, because a filter that quietly ran one ISA would be the parity hole DECISIONS §19 (architectural parity is a tenet) distrusts; add --arch to narrow. Under a filter the command also skips the host pass (about 72 seconds here, and the host crates already have cargo test <name>), the root-port and AMD-Vi boots, and the image checks. It drops the scanout and inbound referees' verdicts too. Each of those asserts what unselected tests would have written. A filter that matches nothing in either test image fails the leg rather than reporting a green zero.

The host pass

The host pass is cargo test --workspace less the host-excluded crates. It adds every crate kept in a workspace of its own: the vendored RedoxFS host tool and no_std engine, the glyph atlas generator, the FS server's sans-IO core, and the TLS graph's two crates. A hand-kept list of -p flags drifts, and the crates it misses stay green because nothing runs them.

The host-excluded set is derived by helpers/host-excluded-crates.sh. Every workspace member that reaches crates/user_mode_runtime cannot compile for the host, because svc and ecall there are EL0 system_calls. The whole set must be excluded: --exclude removes a package from the test selection and not from the dependency graph, so cargo still builds an excluded crate that another member needs. On an aarch64 host the bare-metal crates can compile by accident, which hides the gap on CI's aarch64 runners. A derivation takes in the next crate to gain such a dependency without anyone remembering it. kernel and system_tests are excluded by judgment as well, because they are bare metal through kernel and the dependency walk does not see that.

Each leg describes its own machine

Every leg regenerates the disk images it attaches before it boots. The legs share image paths and their tests write those images, so reuse would make a leg's result depend on which leg ran before it. Each leg gets the same known-good fixtures instead, and any one leg can be run alone. The cross-boot write failure this separates out is a tracked item in notes/fs-server.md.

The same rule covers the environment. host::cargo exports NIFE_INITIAL_RAMDISK and NIFE_DISK for aarch64, and a leg that runs later inherits whatever an earlier leg set. The riscv64 and x86_64 legs therefore set the archive, the disk and NIFE_NET themselves. An x86_64 kernel handed an aarch64 archive refuses every program in it with a machine error that names neither.

The suite's devices (a virtio-gpu, a virtio keyboard, two virtio-rngs and an NVMe controller) are set by test and not by cargo(). The benchmark boot uses the same runners, and a device its instrument did not measure before is drift. Each device's test asserts the device is present rather than skipping, so a leg that lost one fails loudly.

The x86_64 leg

The x86_64 leg runs the same suite on a 4-level map, its scheduler and ring 3, exiting through isa-debug-exit. Its archive carries every program in user/, the FS server and mkfs, but no std farm. q35 has no virtio-mmio bus, so the runner derives five sibling images from NIFE_DISK (-pci.img, -redoxfs.img, -redoxfs-crash.img, -gpt.img, -blank.img) and attaches each as a virtio-blk-pci function. The image NIFE_DISK itself names is attached nowhere. NIFE_X86_FIXTURES_REQUIRED tells the system suite the runner owes all five, so a runner that lost a soft-attached disk fails by name instead of skipping green. The NVMe image is the x86_64 and VT-d data point DECISIONS §86 (whether an NVMe driver can leave the kernel) asked for.

After the suite the leg boots the same kernel on three other machines:

The image checks

After the legs, the host tool reopens the images the last leg wrote: x86_64 in a full run, riscv64 when x86_64 was not asked for, aarch64 alone. It checks that the FS server's write persisted and the filesystem parses. It checks that the crash disk holds one payload whole (milestone 37 (prove RedoxFS's crash consistency)). It checks that the blank disk carries the partition table and filesystem the guest wrote (milestone 57 (partitioning and formatting a real drive, and extended attributes)). No crash test runs on x86_64, since its twins are cfg-gated to the other two ISAs. After an x86_64 leg the crash check is skipped, because it would open a pristine disk and pass without witnessing anything.