From 19572a13c78f0f2423a60c006bdf872c5f25b833 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 9 Aug 2026 04:28:11 -0700 Subject: [PATCH] Skip compositor tests without recording a failure Two problems made a missing Wayland compositor look like broken tests. The cleanup traps ended on a bare conditional, so when a test skipped before creating its TMPDIR the trap's last command returned 1 and, under set -e, that overrode the explicit exit 0. Six tests that launch quickshell had no compositor guard at all, so they ran anyway and failed on the Qt platform plugin. Co-Authored-By: Claude Opus 5 (1M context) --- test/shell.d/bar-icon-geometry-test.sh | 5 +++++ test/shell.d/button-border-stability-test.sh | 9 ++++++++- test/shell.d/chromium-copy-url-test.sh | 4 +++- test/shell.d/chromium-ytdlp-test.sh | 4 +++- test/shell.d/indicator-contract-test.sh | 9 ++++++++- test/shell.d/lock-fingerprint-indicator-test.sh | 4 +++- test/shell.d/lock-password-overflow-test.sh | 4 +++- test/shell.d/manifest-entrypoints-test.sh | 4 +++- test/shell.d/plugin-registry-contract-test.sh | 9 ++++++++- test/shell.d/pointer-move-gate-test.sh | 5 +++++ test/shell.d/screenshot-sanity-test.sh | 4 +++- test/shell.d/toggle-test.sh | 4 +++- test/shell.d/tray-menu-test.sh | 5 +++++ 13 files changed, 60 insertions(+), 10 deletions(-) diff --git a/test/shell.d/bar-icon-geometry-test.sh b/test/shell.d/bar-icon-geometry-test.sh index d4ab370b..cbdd8da3 100644 --- a/test/shell.d/bar-icon-geometry-test.sh +++ b/test/shell.d/bar-icon-geometry-test.sh @@ -4,6 +4,11 @@ set -euo pipefail source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" +if [[ -z ${WAYLAND_DISPLAY:-} ]]; then + pass "no Wayland compositor; skipping bar icon geometry test" + exit 0 +fi + if ! command -v quickshell >/dev/null 2>&1; then pass "quickshell not installed; skipping bar icon geometry test" exit 0 diff --git a/test/shell.d/button-border-stability-test.sh b/test/shell.d/button-border-stability-test.sh index 8f5b4ce1..6a1b9eee 100644 --- a/test/shell.d/button-border-stability-test.sh +++ b/test/shell.d/button-border-stability-test.sh @@ -17,6 +17,11 @@ assert( ) JS +if [[ -z ${WAYLAND_DISPLAY:-} ]]; then + pass "no Wayland compositor; skipping Button hover geometry runtime test" + exit 0 +fi + if ! command -v quickshell >/dev/null 2>&1; then pass "quickshell not installed; skipping Button hover geometry runtime test" exit 0 @@ -24,7 +29,9 @@ fi TMPDIR=$(mktemp -d) cleanup() { - [[ -d $TMPDIR ]] && rm -rf "$TMPDIR" + if [[ -d $TMPDIR ]]; then + rm -rf "$TMPDIR" + fi } trap cleanup EXIT diff --git a/test/shell.d/chromium-copy-url-test.sh b/test/shell.d/chromium-copy-url-test.sh index 85929946..7e64a08e 100644 --- a/test/shell.d/chromium-copy-url-test.sh +++ b/test/shell.d/chromium-copy-url-test.sh @@ -7,7 +7,9 @@ export PATH="$ROOT/bin:$PATH" TMPDIR="" cleanup() { - [[ -n $TMPDIR && -d $TMPDIR ]] && rm -rf "$TMPDIR" + if [[ -n $TMPDIR && -d $TMPDIR ]]; then + rm -rf "$TMPDIR" + fi } trap cleanup EXIT diff --git a/test/shell.d/chromium-ytdlp-test.sh b/test/shell.d/chromium-ytdlp-test.sh index 3d33494f..3e17cb86 100755 --- a/test/shell.d/chromium-ytdlp-test.sh +++ b/test/shell.d/chromium-ytdlp-test.sh @@ -9,7 +9,9 @@ TMPDIR="" export PATH="$ROOT/bin:$PATH" cleanup() { - [[ -n $TMPDIR && -d $TMPDIR ]] && rm -rf "$TMPDIR" + if [[ -n $TMPDIR && -d $TMPDIR ]]; then + rm -rf "$TMPDIR" + fi } trap cleanup EXIT diff --git a/test/shell.d/indicator-contract-test.sh b/test/shell.d/indicator-contract-test.sh index 8f5d656f..e47d90c2 100755 --- a/test/shell.d/indicator-contract-test.sh +++ b/test/shell.d/indicator-contract-test.sh @@ -12,10 +12,17 @@ cleanup() { kill "$QS_PID" 2>/dev/null || true wait "$QS_PID" 2>/dev/null || true fi - [[ -n $TMPDIR && -d $TMPDIR ]] && rm -rf "$TMPDIR" + if [[ -n $TMPDIR && -d $TMPDIR ]]; then + rm -rf "$TMPDIR" + fi } trap cleanup EXIT +if [[ -z ${WAYLAND_DISPLAY:-} ]]; then + pass "no Wayland compositor; skipping QML contract test" + exit 0 +fi + if ! command -v quickshell >/dev/null 2>&1; then pass "quickshell not installed; skipping QML contract test" exit 0 diff --git a/test/shell.d/lock-fingerprint-indicator-test.sh b/test/shell.d/lock-fingerprint-indicator-test.sh index 55a6b978..89c3db28 100755 --- a/test/shell.d/lock-fingerprint-indicator-test.sh +++ b/test/shell.d/lock-fingerprint-indicator-test.sh @@ -12,7 +12,9 @@ cleanup() { kill "$QS_PID" 2>/dev/null || true wait "$QS_PID" 2>/dev/null || true fi - [[ -n $TMPDIR && -d $TMPDIR ]] && rm -rf "$TMPDIR" + if [[ -n $TMPDIR && -d $TMPDIR ]]; then + rm -rf "$TMPDIR" + fi } trap cleanup EXIT diff --git a/test/shell.d/lock-password-overflow-test.sh b/test/shell.d/lock-password-overflow-test.sh index a7cb83a1..916a1b23 100755 --- a/test/shell.d/lock-password-overflow-test.sh +++ b/test/shell.d/lock-password-overflow-test.sh @@ -12,7 +12,9 @@ cleanup() { kill "$QS_PID" 2>/dev/null || true wait "$QS_PID" 2>/dev/null || true fi - [[ -n $TMPDIR && -d $TMPDIR ]] && rm -rf "$TMPDIR" + if [[ -n $TMPDIR && -d $TMPDIR ]]; then + rm -rf "$TMPDIR" + fi } trap cleanup EXIT diff --git a/test/shell.d/manifest-entrypoints-test.sh b/test/shell.d/manifest-entrypoints-test.sh index f6b7cbde..b8b91ce1 100755 --- a/test/shell.d/manifest-entrypoints-test.sh +++ b/test/shell.d/manifest-entrypoints-test.sh @@ -12,7 +12,9 @@ cleanup() { kill "$QS_PID" 2>/dev/null || true wait "$QS_PID" 2>/dev/null || true fi - [[ -n $TMPDIR && -d $TMPDIR ]] && rm -rf "$TMPDIR" + if [[ -n $TMPDIR && -d $TMPDIR ]]; then + rm -rf "$TMPDIR" + fi } trap cleanup EXIT diff --git a/test/shell.d/plugin-registry-contract-test.sh b/test/shell.d/plugin-registry-contract-test.sh index ec3ddf1b..8c073381 100755 --- a/test/shell.d/plugin-registry-contract-test.sh +++ b/test/shell.d/plugin-registry-contract-test.sh @@ -12,10 +12,17 @@ cleanup() { kill "$QS_PID" 2>/dev/null || true wait "$QS_PID" 2>/dev/null || true fi - [[ -n $TMPDIR && -d $TMPDIR ]] && rm -rf "$TMPDIR" + if [[ -n $TMPDIR && -d $TMPDIR ]]; then + rm -rf "$TMPDIR" + fi } trap cleanup EXIT +if [[ -z ${WAYLAND_DISPLAY:-} ]]; then + pass "no Wayland compositor; skipping plugin registry contract test" + exit 0 +fi + if ! command -v quickshell >/dev/null 2>&1; then pass "quickshell not installed; skipping plugin registry contract test" exit 0 diff --git a/test/shell.d/pointer-move-gate-test.sh b/test/shell.d/pointer-move-gate-test.sh index 2ad4c84e..1a4192cf 100644 --- a/test/shell.d/pointer-move-gate-test.sh +++ b/test/shell.d/pointer-move-gate-test.sh @@ -51,6 +51,11 @@ assert( ) JS +if [[ -z ${WAYLAND_DISPLAY:-} ]]; then + pass "no Wayland compositor; skipping pointer movement gate runtime test" + exit 0 +fi + if ! command -v quickshell >/dev/null 2>&1; then pass "quickshell not installed; skipping pointer movement gate runtime test" exit 0 diff --git a/test/shell.d/screenshot-sanity-test.sh b/test/shell.d/screenshot-sanity-test.sh index 71e6bf7a..d2fd24b2 100755 --- a/test/shell.d/screenshot-sanity-test.sh +++ b/test/shell.d/screenshot-sanity-test.sh @@ -12,7 +12,9 @@ cleanup() { kill "$QS_PID" 2>/dev/null || true wait "$QS_PID" 2>/dev/null || true fi - [[ -n $TMPDIR && -d $TMPDIR ]] && rm -rf "$TMPDIR" + if [[ -n $TMPDIR && -d $TMPDIR ]]; then + rm -rf "$TMPDIR" + fi } trap cleanup EXIT diff --git a/test/shell.d/toggle-test.sh b/test/shell.d/toggle-test.sh index 945dc8af..7ab3a543 100644 --- a/test/shell.d/toggle-test.sh +++ b/test/shell.d/toggle-test.sh @@ -9,7 +9,9 @@ TMPDIR="" export PATH="$ROOT/bin:$PATH" cleanup() { - [[ -n $TMPDIR && -d $TMPDIR ]] && rm -rf "$TMPDIR" + if [[ -n $TMPDIR && -d $TMPDIR ]]; then + rm -rf "$TMPDIR" + fi } trap cleanup EXIT diff --git a/test/shell.d/tray-menu-test.sh b/test/shell.d/tray-menu-test.sh index 070e32aa..1b2fba92 100644 --- a/test/shell.d/tray-menu-test.sh +++ b/test/shell.d/tray-menu-test.sh @@ -22,6 +22,11 @@ cleanup() { } trap cleanup EXIT +if [[ -z ${WAYLAND_DISPLAY:-} ]]; then + pass "no Wayland compositor; skipping tray menu activation test" + exit 0 +fi + if ! command -v quickshell >/dev/null 2>&1; then pass "quickshell not installed; skipping tray menu activation test" exit 0