From 7494fafb89a75e7b9b3bcc7a6eae0f4cd6da2d4d Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Sat, 12 Sep 2026 08:19:55 +1000 Subject: [PATCH] test: strip mode-forcing env from nested compositor spawns A leaked WLR_BACKENDS (e.g. drm,libinput) or KICK_MODE in the ambient environment flips spawned nested compositors to standalone, where the DRM backend fails and every test dies at boot for reasons unrelated to what it asserts. Seen when running the suite from a shell carrying the agent session's own WLR_BACKENDS export. Strip just those two (host connection and socket dir must pass through); precedent: kick-in-kick pops and standalone env -i. --- tests/test_smoke.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/test_smoke.py b/tests/test_smoke.py index 66ceb97..d9f550a 100644 --- a/tests/test_smoke.py +++ b/tests/test_smoke.py @@ -50,6 +50,18 @@ XR = os.path.join(ROOT, "build", "xreqs") LOG = "/tmp/tabtest.log" _log_seq = [0] +# Nested compositors must boot nested even when the ambient environment +# leaks mode-forcing variables (a WLR_BACKENDS=drm,libinput left over from +# VT standalone experiments, or KICK_MODE): the leak flips the spawned +# compositor to standalone, its DRM backend fails on the busy seat, and the +# test dies at boot ("startup tab never mapped") for reasons unrelated to +# what it asserts. Strip just those two; the host connection +# (WAYLAND_DISPLAY) and socket dir (XDG_RUNTIME_DIR) must pass through, so +# `env -i` (as standalone_session uses) is wrong here. Precedent: the +# kick-in-kick spawn already pops both via an env dict, and KICK_LIBDECOR +# passes through only when set. +_NESTED_ENV_STRIP = ["-u", "WLR_BACKENDS", "-u", "KICK_MODE"] + def _fresh_log(): """A unique per-spawn log path. @@ -683,7 +695,8 @@ def session(): dump_dir = _mk_dump_dir() proc = subprocess.Popen( - ["env", "KICK_LOG=2", "KICK_SYNTH_INPUT=1", + ["env"] + _NESTED_ENV_STRIP + [ + "KICK_LOG=2", "KICK_SYNTH_INPUT=1", "KICK_DUMP_DIR=" + dump_dir, "KICK_REPEAT_DELAY_MS=" + KICK_REPEAT_TEST_DELAY, "stdbuf", "-oL", BIN, f"{WL} '{RED}'", f"{WL} '{BLUE}'"], @@ -2996,7 +3009,8 @@ def _nested_session(*tabs, extra_args=(), repeat_off=True): # KICK_LIBDECOR passes through only when set: an empty value would # force the libdecor path (any non-"0" value does), so default runs # must not see the variable at all. - cmd = ["env", "KICK_LOG=2", "KICK_SYNTH_INPUT=1", + cmd = ["env"] + _NESTED_ENV_STRIP + [ + "KICK_LOG=2", "KICK_SYNTH_INPUT=1", "KICK_DUMP_DIR=" + dump_dir, "KICK_REPEAT_DELAY_MS=" + (KICK_REPEAT_TEST_DELAY if repeat_off else KICK_REPEAT_DEFAULT)] @@ -3724,7 +3738,8 @@ def test_no_args_opens_terminal(): log = _fresh_log() dump_dir = _mk_dump_dir() proc = subprocess.Popen( - ["env", "KICK_LOG=2", "KICK_SYNTH_INPUT=1", + ["env"] + _NESTED_ENV_STRIP + [ + "KICK_LOG=2", "KICK_SYNTH_INPUT=1", f"TERMINAL={WL} '{RED}'", "KICK_DUMP_DIR=" + dump_dir, "KICK_REPEAT_DELAY_MS=" + KICK_REPEAT_TEST_DELAY, "stdbuf", "-oL", BIN],