From d2b090f8fc1115a923e9eac6d66f20b053796681 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 7 Aug 2026 17:13:39 +0200 Subject: [PATCH] Isolate XDG dirs in shell tests that launch quickshell with a fake HOME MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Faking HOME alone was never enough: the shell QML and the agent usage updater read XDG_STATE_HOME and XDG_CACHE_HOME directly, so a test quickshell inherited the session's real paths. The bar widget contract test instantiated the agents widget, whose refresh ran the real collectors against the empty fake HOME and wrote hollow "Waiting for auth" records into the developer's real usage data files — hiding the agents widget from their bar — while littering the real cache with per-tmpdir scan files. Point XDG_CONFIG_HOME, XDG_CACHE_HOME, and XDG_STATE_HOME under the fake home in every test that boots quickshell with one. Co-Authored-By: Claude Fable 5 --- test/shell.d/bar-widget-contract-test.sh | 3 +++ test/shell.d/indicator-contract-test.sh | 3 +++ test/shell.d/lock-fingerprint-indicator-test.sh | 3 +++ test/shell.d/lock-password-overflow-test.sh | 3 +++ test/shell.d/manifest-entrypoints-test.sh | 3 +++ test/shell.d/plugin-registry-contract-test.sh | 3 +++ test/shell.d/runtime-smoke-test.sh | 3 +++ test/shell.d/screenshot-sanity-test.sh | 3 +++ test/shell.d/tray-menu-test.sh | 3 +++ 9 files changed, 27 insertions(+) diff --git a/test/shell.d/bar-widget-contract-test.sh b/test/shell.d/bar-widget-contract-test.sh index da40d6d2..5d985680 100755 --- a/test/shell.d/bar-widget-contract-test.sh +++ b/test/shell.d/bar-widget-contract-test.sh @@ -69,6 +69,9 @@ OMARCHY_PATH="$ROOT" \ OMARCHY_QML_TEST_RESULT="$result" \ OMARCHY_QML_BAR_WIDGETS="$bar_widgets" \ HOME="$TMPDIR/home" \ +XDG_CONFIG_HOME="$TMPDIR/home/.config" \ +XDG_CACHE_HOME="$TMPDIR/home/.cache" \ +XDG_STATE_HOME="$TMPDIR/home/.local/state" \ QML2_IMPORT_PATH="$ROOT/shell${QML2_IMPORT_PATH:+:$QML2_IMPORT_PATH}" \ QML_IMPORT_PATH="$ROOT/shell${QML_IMPORT_PATH:+:$QML_IMPORT_PATH}" \ PATH="$ROOT/bin:$PATH" \ diff --git a/test/shell.d/indicator-contract-test.sh b/test/shell.d/indicator-contract-test.sh index 674b24c4..8f5d656f 100755 --- a/test/shell.d/indicator-contract-test.sh +++ b/test/shell.d/indicator-contract-test.sh @@ -35,6 +35,9 @@ ln -s "$ROOT/shell/Commons" "$config_dir/Commons" OMARCHY_PATH="$ROOT" \ OMARCHY_QML_TEST_RESULT="$result" \ HOME="$TMPDIR/home" \ +XDG_CONFIG_HOME="$TMPDIR/home/.config" \ +XDG_CACHE_HOME="$TMPDIR/home/.cache" \ +XDG_STATE_HOME="$TMPDIR/home/.local/state" \ QML2_IMPORT_PATH="$ROOT/shell${QML2_IMPORT_PATH:+:$QML2_IMPORT_PATH}" \ QML_IMPORT_PATH="$ROOT/shell${QML_IMPORT_PATH:+:$QML_IMPORT_PATH}" \ PATH="$ROOT/bin:$PATH" \ diff --git a/test/shell.d/lock-fingerprint-indicator-test.sh b/test/shell.d/lock-fingerprint-indicator-test.sh index 70ad7d54..55a6b978 100755 --- a/test/shell.d/lock-fingerprint-indicator-test.sh +++ b/test/shell.d/lock-fingerprint-indicator-test.sh @@ -40,6 +40,9 @@ ln -s "$ROOT/shell/Commons" "$config_dir/Commons" OMARCHY_PATH="$ROOT" \ OMARCHY_QML_TEST_RESULT="$result" \ HOME="$TMPDIR/home" \ +XDG_CONFIG_HOME="$TMPDIR/home/.config" \ +XDG_CACHE_HOME="$TMPDIR/home/.cache" \ +XDG_STATE_HOME="$TMPDIR/home/.local/state" \ QML2_IMPORT_PATH="$ROOT/shell${QML2_IMPORT_PATH:+:$QML2_IMPORT_PATH}" \ QML_IMPORT_PATH="$ROOT/shell${QML_IMPORT_PATH:+:$QML_IMPORT_PATH}" \ PATH="$ROOT/bin:$PATH" \ diff --git a/test/shell.d/lock-password-overflow-test.sh b/test/shell.d/lock-password-overflow-test.sh index 77a6a3bd..a7cb83a1 100755 --- a/test/shell.d/lock-password-overflow-test.sh +++ b/test/shell.d/lock-password-overflow-test.sh @@ -40,6 +40,9 @@ ln -s "$ROOT/shell/Commons" "$config_dir/Commons" OMARCHY_PATH="$ROOT" \ OMARCHY_QML_TEST_RESULT="$result" \ HOME="$TMPDIR/home" \ +XDG_CONFIG_HOME="$TMPDIR/home/.config" \ +XDG_CACHE_HOME="$TMPDIR/home/.cache" \ +XDG_STATE_HOME="$TMPDIR/home/.local/state" \ QML2_IMPORT_PATH="$ROOT/shell${QML2_IMPORT_PATH:+:$QML2_IMPORT_PATH}" \ QML_IMPORT_PATH="$ROOT/shell${QML_IMPORT_PATH:+:$QML_IMPORT_PATH}" \ PATH="$ROOT/bin:$PATH" \ diff --git a/test/shell.d/manifest-entrypoints-test.sh b/test/shell.d/manifest-entrypoints-test.sh index 58c898fa..f6b7cbde 100755 --- a/test/shell.d/manifest-entrypoints-test.sh +++ b/test/shell.d/manifest-entrypoints-test.sh @@ -80,6 +80,9 @@ OMARCHY_PATH="$ROOT" \ OMARCHY_QML_TEST_RESULT="$result" \ OMARCHY_QML_MANIFESTS="$manifest_entries" \ HOME="$TMPDIR/home" \ +XDG_CONFIG_HOME="$TMPDIR/home/.config" \ +XDG_CACHE_HOME="$TMPDIR/home/.cache" \ +XDG_STATE_HOME="$TMPDIR/home/.local/state" \ QML2_IMPORT_PATH="$ROOT/shell${QML2_IMPORT_PATH:+:$QML2_IMPORT_PATH}" \ QML_IMPORT_PATH="$ROOT/shell${QML_IMPORT_PATH:+:$QML_IMPORT_PATH}" \ PATH="$ROOT/bin:$PATH" \ diff --git a/test/shell.d/plugin-registry-contract-test.sh b/test/shell.d/plugin-registry-contract-test.sh index 5d45ba1b..ec3ddf1b 100755 --- a/test/shell.d/plugin-registry-contract-test.sh +++ b/test/shell.d/plugin-registry-contract-test.sh @@ -35,6 +35,9 @@ ln -s "$ROOT/shell/Commons" "$config_dir/Commons" OMARCHY_PATH="$ROOT" \ OMARCHY_QML_TEST_RESULT="$result" \ HOME="$TMPDIR/home" \ +XDG_CONFIG_HOME="$TMPDIR/home/.config" \ +XDG_CACHE_HOME="$TMPDIR/home/.cache" \ +XDG_STATE_HOME="$TMPDIR/home/.local/state" \ QML2_IMPORT_PATH="$ROOT/shell${QML2_IMPORT_PATH:+:$QML2_IMPORT_PATH}" \ QML_IMPORT_PATH="$ROOT/shell${QML_IMPORT_PATH:+:$QML_IMPORT_PATH}" \ PATH="$ROOT/bin:$PATH" \ diff --git a/test/shell.d/runtime-smoke-test.sh b/test/shell.d/runtime-smoke-test.sh index 9b85de7e..d1a7dc60 100755 --- a/test/shell.d/runtime-smoke-test.sh +++ b/test/shell.d/runtime-smoke-test.sh @@ -103,6 +103,9 @@ chmod +x "$stub_bin/curl" OMARCHY_PATH="$test_root" \ HOME="$test_home" \ +XDG_CONFIG_HOME="$test_home/.config" \ +XDG_CACHE_HOME="$test_home/.cache" \ +XDG_STATE_HOME="$test_home/.local/state" \ PATH="$stub_bin:$ROOT/bin:$PATH" \ quickshell -p "$test_root/shell" --no-color >"$log" 2>&1 & QS_PID=$! diff --git a/test/shell.d/screenshot-sanity-test.sh b/test/shell.d/screenshot-sanity-test.sh index 4337d556..71e6bf7a 100755 --- a/test/shell.d/screenshot-sanity-test.sh +++ b/test/shell.d/screenshot-sanity-test.sh @@ -89,6 +89,9 @@ chmod +x "$stub_bin/curl" OMARCHY_PATH="$test_root" \ HOME="$test_home" \ +XDG_CONFIG_HOME="$test_home/.config" \ +XDG_CACHE_HOME="$test_home/.cache" \ +XDG_STATE_HOME="$test_home/.local/state" \ PATH="$stub_bin:$ROOT/bin:$PATH" \ quickshell -p "$test_root/shell" --no-color >"$log" 2>&1 & QS_PID=$! diff --git a/test/shell.d/tray-menu-test.sh b/test/shell.d/tray-menu-test.sh index a7405eda..070e32aa 100644 --- a/test/shell.d/tray-menu-test.sh +++ b/test/shell.d/tray-menu-test.sh @@ -51,6 +51,9 @@ cp "$SHELL_TEST_DIR/fixtures/tray-menu-activation/shell.qml" "$config_dir/shell. OMARCHY_PATH="$ROOT" \ OMARCHY_QML_TEST_RESULT="$result" \ HOME="$TMPDIR/home" \ +XDG_CONFIG_HOME="$TMPDIR/home/.config" \ +XDG_CACHE_HOME="$TMPDIR/home/.cache" \ +XDG_STATE_HOME="$TMPDIR/home/.local/state" \ quickshell -p "$config_dir" --no-color >"$qs_log" 2>&1 & QS_PID=$!