RediWM is a Wayland compositor written in Zig (OpenGL ES) that includes everything in one process
Testing
umask 077
zig build
zig build -Doptimize=ReleaseSafe --prefix zig-out/release-safe
zig build test
python3 tests/<name>.py
The long-running Files benchmarks are skipped by default. To include the transfer and end-to-end copy benchmarks in the full test run, use:
REDIWM_RUN_BENCHMARKS=1 zig build test
zig build test-wlroots checks the complete exported wlroots API against the
installed headers and tests embedded input-device lifecycles; it is included
in zig build test.
zig build test-platform runs the OS-specific parts (src/platform/: child
handles, file watching, own executable path) against real processes and
temporary directories.
zig build test-login-manager tests ConsoleKit2 session ownership, identity
rejection and private user-bus startup against independent private-bus peers.
tools/freebsd-cross/check.sh [-Doptimize=ReleaseSafe | test] cross-builds the
tree for FreeBSD on this host (Arch, bwrap); run it after touching OS
interfaces, C headers or src/platform/. It proves compilation only.
Run affected integration suites after building. Find suites and flags in
tests/ and build targets in build/tests.zig.
Compare failures with a clean HEAD worktree before calling them regressions.
Integration dependencies: Python 3 + Pillow, C compiler, wayland-scanner,
wayland-protocols and GLES2; D-Bus suites also need PyGObject,
dbus-run-session and busctl. Check each suite for extra dependencies.
App checks include calculator, editor,
editor visuals and
Files input methods.
Application colors: python3 tests/app_colors.py checks snapshot exports and
opt-in following with a private bus, scratch HOME/XDG directories, and real
GTK3/GTK4/Qt5/Qt6 palette probes when installed. It keeps clients open across
theme changes, closes Settings, checks portal publication and compositor restart,
and verifies that disabling following stops exports. Qt probes that preload a
stand-in libqt<N>_shim.so check the Chromium colours, also after Dark mode is
switched in Settings. Repeat with
REDIWM_TEST_SCALE=1.5. Browser chrome still needs a visual check with isolated
profiles in GTK/Qt/System/Linux theme mode; never use the host browser profile.
For Brave, check the tab strip against the active tab, a context menu's
shortcuts and disabled items, and the print preview (Ctrl+P) with a dropdown
open, with Dark mode both off and on, under a real xdg-desktop-portal with the
rediwm and gtk backends. Brave's Qt mode reads Qt colours only at startup.
SSH keys: zig build test-keys and
dbus-run-session -- python3 tests/keys_settings.py (repeat with
REDIWM_TEST_SCALE=1.5). Fixtures generate OpenSSH and legacy RSA keys in a
scratch home, compare fingerprints with OpenSSH, verify passphrase changes,
and exercise the real Settings fields. They never use the host's keys or
agent. Requires OpenSSH, OpenSSL and gio; GIO_USE_VFS=local keeps Trash
within the fixture. --helper-only skips the compositor; --bin-dir selects
the helper and compositor builds together.
Firewall: zig build test-firewall (parsers, validation, nftables/pf
rendering), python3 tests/firewall_helper.py (the real helper as namespace
root in unshare -rmn, against real nftables in an empty network namespace;
config and run directories on tmpfs, nmcli/systemctl/ufw/firewall-cmd
hidden) and python3 tests/firewall_settings.py (Settings with a fake pkexec
and helper in a private mount namespace; needs a /etc/subuid range; repeat
with REDIWM_TEST_SCALE=1.5, FIREWALL_TEST_SHOTS=<dir> keeps screenshots).
Neither touches the host firewall. pf output is checked on FreeBSD with
pfctl -nf.
Keyboard layouts and input methods: python3 tests/input_sources.py starts
its own dbus-run-session with a fake Fcitx5 controller; it never reaches the
host's Fcitx. Layout labels need libxkbregistry.
Isolation and harness
- Use a private headless compositor, temporary home/XDG directories and private
D-Bus services (
DBUS_SYSTEM_BUS_ADDRESSpoints to the fixture bus). Never touch host displays, buses, audio, power, printers or real credentials. - Keep runtime directories private (
umask 077); isolateXDG_STATE_HOME(layout autosave),XDG_DATA_HOME(recent files) andXDG_CACHE_HOME. Files suites setREDIWM_FILES_DEVICES=0to avoid host disks. - Reuse ipc_client.py:
IPCClient,spawn_compositor,stop_process. Custom launch environments needREDIWM_IPC_AUTOMATION=1. Prefer IPC state/events andwait_for_frameover pixels or sleeps; wait forwindow_geometry_settledbefore pointer input or geometry checks. - Select
WLR_RENDER_DRM_DEVICEon multi-GPU machines; without hardware use Mesa llvmpipe (WLR_RENDERER_ALLOW_SOFTWARE=1). Use output screenshots for pixels: GLES2 can release CPU buffers after upload. - Repeat UI checks at
REDIWM_TEST_SCALE=1.5; supporting suites also acceptREDIWM_TEST_OUTPUTS=2. Check script-specific arguments. Fractional GLES2 pixels may differ by one level. zig build -Ddamage-audit=truechecks missed damage and stale resolve groups; keep logs withREDIWM_TEST_LOG_DIR. It disrupts timing-sensitive tests.- Update IPC expectations explicitly in
src/ipc_serializers.jsonlandtests/msg_v1.json; never derive expected results from the implementation.
Languages and locale correctness
Run zig build i18n-check, zig build i18n-lint, zig build test-i18n and
python3 tests/i18n.py. Follow translation review; generate
private locales with localedef + LOCPATH, never change host locales.
Further checks
Measure performance with ReleaseSafe and identical renderer/scale/input settings;
see scene_baseline.py, motion_perf.py
and startup_perf.py. Stats requests enable timers and
add overhead; keep CPU comparisons free of them. frame_time_ms is the commit
interval; CPU and GPU work overlap, so do not add their timings.
Measure frame scheduling (frame event, render start, commit, presentation, age
of the content shown) with a -Dframe-trace=true build and
frame_latency.py, which runs an isolated session or
analyses a traced compositor's log. The option compiles the trace in; normal
builds contain none of it. Headless presents synchronously, so only the cost
columns mean anything there; presentation latency needs DRM (a spare VT) and
the present flags line showing vsync with a hardware clock.
Audit memory retention with memory_retention.py:
python3 tests/memory_retention.py --app files --cycles 50 --out /tmp/files-retention.json
python3 tests/memory_retention.py --app control-center --cycles 50 --out /tmp/settings-retention.json
The default binary is zig-out/release-safe/bin/rediwm; apps come from the same
directory. Each run uses one private compositor, five warm-up cycles, then
repeatedly opens and closes the same app. It waits for client exit, close
animation teardown and frame barriers before recording PSS, private clean +
dirty memory, swap, scene-node counts, FDs and DRM fdinfo counters. JSON includes
every cycle, growth and slope, baseline/final smaps, binary hash and shutdown
logs. --scale 1.5, --close-mode kill, --no-animations and --no-glass
exercise other paths; --settle controls the post-close delay (default 1 s).
Scene counts must return to the warmed baseline. Optional
--max-private-growth-kib (last five samples' median minus baseline) and
--max-pss-slope-kib set machine-specific memory gates. Compare identical builds,
renderer, scale and workload settings: allocator/driver caches can retain a
bounded high-water mark, and PSS varies with other processes sharing pages.
DRM counters are per client (duplicate FDs removed); shared objects can still
appear in multiple clients, and PSS alone cannot establish GPU retention.
Restarting an app measures retention in the compositor, not leaks within a
long-lived app process. Use Debug separately to check shutdown leak reports.
Hardware, login, browser/OBS sharing and toolkit IME checks remain manual. See rendering, tiling qualification and printer qualification.
Pointer settings: python3 tests/input_persistence.py drives the real Settings,
reload, hotplug and restart paths with a noninstalled libinput fixture. Repeat
with REDIWM_TEST_SCALE=1.5; set WLR_RENDER_DRM_DEVICE on multi-GPU hosts as
above. No host input devices are configured. For manual hardware qualification,
select a touchpad and external mouse in Settings, give them opposite natural
scrolling and different speeds, and verify both in a client. Check tapping,
tap-drag and disable-while-typing on supported hardware. Unplug the selected
mouse with the selector open, reconnect, reload configuration and restart the
compositor; verify each device's values and behavior again. A device identified
by physical path follows its port; see configuration
for identity limitations.
Check the type icon and friendly name (including a trackball, if available).
An edited control should switch from Default to Custom. Reset one device and
verify that it returns to Default immediately while the others remain unchanged;
then change a global default and check that the reset device inherits it after
reload, reconnection and restart.
Power policy: python3 tests/power_settings.py uses private PowerProfiles and
logind services, fake sysfs events, and a fake brightnessctl. Repeat with
REDIWM_TEST_SCALE=1.5. Also run tests/idle.py, tests/power.py,
tests/power_profiles.py, tests/battery_popup.py, tests/control_center.py,
tests/hardware_keys.py, tests/greeter.py, and tests/i18n.py. On hardware,
qualify lid close/open, external-monitor removal with the lid closed, suspend
and resume after unplugging, keyboard lighting and firmware charging-limit
readback. Keep real power actions out of automated tests.
Canvas overview: python3 tests/overview.py checks the rendered 2×2 and
2+3 grids, live minimized previews, restoration, pointer and keyboard selection,
hover and wheel magnification of a preview,
consumed input, client teardown, config reload and reduced motion in a private headless session. Repeat with
REDIWM_TEST_SCALE=1.5 REDIWM_TEST_OUTPUTS=2. Also run focus_zoom.py,
desktop_zoom.py, keyboard_shortcuts.py, shortcuts_inhibit.py,
pointer_constraints.py and switcher_ime.py after changing its input routing.