Testing scrotwmos
This guide is for a developer who runs the test suites. At the end you know which command proves which part, what each one needs, and where its results go. What a build host needs is in building.md.
Before you start
- Clear
LD_PRELOAD. A desktop that preloads a window manager hack library (spectrwm’s libswmhack does) breaks the suites. - A leg whose tool is missing skips and exits 0, so a run can pass and
prove nothing. On a host meant to prove, set
FAIL_ON_SKIP=1. - The VM and container legs run binaries from the tree, so the tree
must be one the launcher trusts. Every directory from the tree up to
/must be owned by root or by you, not writable by group or others, and searchable by others. Build withumask 022. Runchmod -R go-won the tree. Keep it outside a 0700 home (orchmod 711the home). - Do not run the VM, container, cgroup, or compositor suites on a
machine in daily use. They share
/sys/fs/cgroup/scrotwmwith a live session and can end it.
Run every target from the top of the checkout. Each builds what it needs first.
The everyday suites
| Command | What it tests | Needs |
|---|---|---|
make test |
the unit suites and the man page lint | mandoc; Linux 6.16 |
make check-fuzz |
the fuzzers at a fixed seed, swmtool vm’s YAML and QMP readers among them | clang |
make check-x11 |
swm-x11 integration | Xvfb, xdotool, xterm, xdpyinfo |
make check-x11-e2e |
swm-x11’s drawn pixels | Xvfb, xdotool, ImageMagick |
make check-wl |
swm-wl integration, headless | wayland-protocols; for the lock leg, wlrctl, wtype, grim, and make musl-dom0 |
make check-e2e |
compositor, scrotwmd, and a client over the bus |
foot, gvim, chromium if installed |
make check-compositor-e2e |
a full swm-wl tour | grim, wtype, wlrctl, foot, gvim, Xwayland, strace, Xvfb, ImageMagick |
make check-ta-<leg>, make check-ta |
one leg, or every leg, of the installer suite | |
make check-ta-pr |
the installer legs the branch’s change touches | git |
make regress |
swm-x11’s layout against stock spectrwm | spectrwm, Xvfb, xterm, xwininfo, xdpyinfo |
test_tpm2 tests a real TPM only when TPM2_DEV names one. It writes
no NV index and extends no PCR:
sudo env TPM2_DEV=/dev/tpmrm0 build/regress/test_tpm2
make check-all builds everything and runs every suite this box can
run, at once, each after what it tests. It leaves out
check-appliance, check-months, check-sleep-resume,
check-power-off, check-gpu-hold, check-vfio, check-vm-switch,
check-handoff, and regress.
Suites that need root or KVM
These need sudo with no password prompt, /dev/kvm, or both.
| Command | What it tests | Needs |
|---|---|---|
make check-root |
the root halves of the unit suites, with FAIL_ON_SKIP=1 |
the musl root (make musl-root), /dev/kvm, cryptsetup; it makes ttvm’s kernel |
make check-ta-root, make check-ta-root-pr |
the installer legs as root | |
make check-ns |
the namespace audit | a rootfs at ROOTFS (default ~/scrotwmos-root) |
make check-seat |
the root monitor as a seat for libseat | stops the system’s seat manager for the run |
make check-container |
container isolation | grim, wtype, a rootfs with foot and gvim |
make check-kernel |
the signed guest kernel with swm-vmm |
make kernel, make vmm, /dev/kvm, qemu, mkfs.xfs |
make check-vm |
VM sessions under swm-wl | as check-kernel, plus fallocate, a rootfs with foot, gvim, galculator, mousepad, and wmenu, 8 GB free |
make check-backup-vm |
ttvm and its copies | /dev/kvm, mkfs.xfs, device-mapper |
make check-install |
swmtool install on a loop image |
the Void install tools, a reachable mirror |
make check-boot |
the installed image boots, plain and encrypted | a mirror, /dev/kvm, edk2-ovmf |
make check-stub, make check-hostboot |
the stub and the installer loader; the dom0 kernel; under OVMF | qemu, edk2-ovmf; make kernel-host for the second |
make check-gfx |
vmm-gfx on the display GPU |
make musl-dom0, an Intel GPU on i915 |
make check-vm-switch |
the net VM’s switch in nested qemu | nested KVM, a rootfs, a 24 GiB sparse disk in /var/tmp, an L1 VM of 8 CPUs and 12 GiB |
check-root’s test_vm_boot boots this host’s kernel,
/boot/vmlinuz-$(uname -r), and its modules under swmtool vm. It
needs qemu-system-x8664, runit’s runsvdir and sv, modprobe, zstd,
cpio, iproute2, and util-linux’s script and setpriv. Its lan0 leg
makes its tap by swmtool vm run, no qemu-bridge-helper; with a
setuid helper there, its notap leg proves it refuses lan0.
test_byol_lan0 needs dhcpcd, iproute2, util-linux’s unshare and
nsenter, and the kernel’s bridge and tun. test_byol_vmnat needs
iproute2, util-linux’s unshare and nsenter, ping (iputils’, -O),
pgrep, overlayfs (its /etc, for resolv.conf), and the kernel’s bridge,
veth, nftables with NAT and ctnetlink; no nft: its flush is its own
helper’s, natensure -d. Its queries are netprobe’s, its resolvers
dnsserve.
test_byol_hook needs overlayfs, util-linux’s mountpoint, and
coreutils’ sha256sum and sort -V; its seal legs need this box’s TPM
(/dev/tpmrm0) and its event log, as test_byol_totp’s.
check-root’s test_vm_image (create, clone, rm, the seed; no qemu run)
needs qemu-img; test_vm_addr_ns (vm list’s mac and ip) needs
dhcpcd, arping, and runit’s runsv. In make test,
test_vm_image_void builds a Void image offline from a local repo of
stand-ins; it needs xbps, sfdisk, mke2fs, debugfs, qemu-img, grub, the
host’s xbps keys, and an /etc/subuid range. It skips without them.
The image builds for real are opt-in and need the network and
/dev/kvm: make -C regress vm-image-void-live, and
SWM_VM_IMAGE_LIVE=1 make -C regress check-vm-image-fedora-live
(about 2 GB of downloads) or check-vm-image-openbsd-live (about
700 MB). SWM_VM_IMAGE_LIVE=1 make -C regress check-vmnat-live, as
root, builds the three images (or takes SWM_VMNAT_IMAGES) and boots a
VM of each on vmnat0, and a void one on lan0 too, in namespaces of its
own. A guest with no login prompt
in seven minutes (the four together) gets no ssh: its failure shows its
console’s last lines and its VGA text (vga_text, by QMP: SeaBIOS’s and
GRUB’s words).
Build a rootfs with make rootfs ROOTFS=/srv/<label>. To add the test programs to
one that exists:
xbps-install -S -r ~/scrotwmos-root -y foot gvim galculator mousepad wmenu
Long or special suites
These are not in check-all. Run them on a test box.
| Command | What it tests |
|---|---|
make install-proof |
the stick installs onto a blank disk in qemu, and every world opens |
make check-appliance |
make media, then, in qemu, the screen shots, the install proof, and the installs that must fail; it touches no real disk |
make check-months |
92 simulated days of backups; about six hours, 14 GB free |
make check-gpu-hold, make check-vfio, make check-handoff |
the GPU at boot, VFIO, and the GPU hand-off, in nested qemu; each compiles a kernel |
make check-gfx-fuzz |
vmm-gfx under a racing writer; it can hang the GPU |
make check-sleep-resume IMG=path, make check-power-off IMG=path |
sleep and the power button, on a disk the install proof kept (make install-proof PHASE2=0, build/install-proof/w/target.img) |
make swm-wl scrotwmd && make -C regress check-mon-flood |
a container floods its stderr for 60 s; the root monitor keeps its budget |
make -C regress fuzz |
every fuzzer for a minute each |
A root suite by hand
check-root runs each root suite in a box of its own: a cgroup, a
network namespace, and its own /run and /tmp. Runs at the same
time never meet. To run one suite by hand, use the same box. -u runs
the suite as you, for a suite that calls sudo itself:
sudo -n --preserve-env build/regress/runbox build/regress/test_appliance
sudo -n --preserve-env build/regress/runbox -u sh regress/test_boot.sh
A root suite that was killed leaves its state in
/run/scrotwmos-regress/<suite>.state and refuses to run again. Clean
it up with sudo build/regress/<suite> -s.
The installer suite
test_appliance runs in legs: release, nicrom, plan, layout, byol,
answer, fill, update, passwd, cli, and install. TA_LEGS=update,byol
runs those legs alone. make check-ta-pr picks the legs from the
files the branch changed, against origin/main (set TA_BASE for
another base).
Results and logs
- Each suite prints to the terminal. Make runs on every core by default, so suites run at the same time, and each one’s output prints whole when it ends.
- A suite that passed leaves a stamp in
build/regress/ok/(build/regress/ok/root/for root suites). A rerun after a failure runs only what failed or what the build changed. check-vmandcheck-backup-vmmake their volumes underbuild/regress/.- The install proofs write their screen shots and serial logs to
build/install-proof/,build/install-media-shots/, andbuild/install-negative/.