wayland: add WMAKER_USE_WAYLAND backend selector and split smoke tests

- startup.c: include wl_backend.h when USE_WAYLAND_BACKEND is defined;
  select wl_backend when WMAKER_USE_WAYLAND env var is set, otherwise
  fall back to x11_backend (no-op for non-Wayland builds)
- tests/smoke-test.sh renamed to tests/x11-smoke-test.sh (X11-only path)
- tests/wl-smoke-test.sh: new Wayland smoke test; currently verifies
  wl_backend symbol presence and wlroots linkage; headless compositor
  tests will be added as vtable slots are implemented

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-03-27 22:29:27 +01:00
parent d2632b8487
commit e8e230b2db
3 changed files with 50 additions and 1 deletions

View File

@ -49,6 +49,9 @@
#include "session.h"
#include "defaults.h"
#include "backend/x11/x11_backend.h"
#ifdef USE_WAYLAND_BACKEND
#include "backend/wayland/wl_backend.h"
#endif
#include "properties.h"
#include "dialog.h"
#include "wmspec.h"
@ -520,7 +523,12 @@ void StartUp(Bool defaultScreenOnly)
w_global.screen_count = 0;
/* Select the display backend before any screen is initialized. */
wm_backend = &x11_backend;
#ifdef USE_WAYLAND_BACKEND
if (getenv("WMAKER_USE_WAYLAND"))
wm_backend = &wl_backend;
else
#endif
wm_backend = &x11_backend;
/* Check if TIFF images are supported */
formats = RSupportedFileFormats();

41
tests/wl-smoke-test.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
# tests/wl-smoke-test.sh
#
# Wayland backend smoke test for Window Maker.
# Uses the wlroots headless compositor (no display hardware needed).
#
# Currently verifies:
# 1. wmaker was built with Wayland backend support (symbol present)
# 2. wmaker links against wlroots
#
# This test grows as wl_backend vtable slots are implemented.
# When the compositor can open a headless display, tests for window
# management, EWMH properties, etc. will be added here in the same
# style as tests/x11-smoke-test.sh.
#
# Exit 0 = PASS, non-zero = FAIL.
set -e
# Use the real ELF binary (src/wmaker is a libtool wrapper script)
WMAKER=src/.libs/wmaker
[ -x "$WMAKER" ] || WMAKER=src/wmaker
die() {
echo "FAIL: $*" >&2
exit 1
}
# -- 1. Build check: wl_backend symbol must be present --------------------
[ -x "$WMAKER" ] || die "wmaker binary not found (tried src/.libs/wmaker and src/wmaker)"
nm "$WMAKER" 2>/dev/null | grep -q 'wl_backend' \
|| die "wl_backend symbol not found in $WMAKER (built without --enable-wayland-backend?)"
# -- 2. Link check: wlroots library must be linked in ---------------------
ldd "$WMAKER" 2>/dev/null | grep -qi 'wlroots\|libwlr' \
|| die "wmaker does not link against wlroots"
# -- Done (headless compositor tests to be added as vtable is implemented) --
echo "PASS (wl_backend symbol + wlroots link verified; full headless tests pending)"
exit 0