From 5f5c2c452349fc37f39d6194112b4ac51b413140 Mon Sep 17 00:00:00 2001 From: Omarchybot <317366263+omarchybot@users.noreply.github.com> Date: Thu, 8 Oct 2026 09:12:18 +0200 Subject: [PATCH 1/2] Stop the test shell's whole process group so its watcher dies with it Shell tests stopped a background Quickshell with SIGTERM to its pid alone. Quickshell exits without reaping its Process children, so PluginRegistry's inotifywait plugin watcher was reparented to init and lived on, watching a deleted fixture home and holding the harness's inherited descriptors, the run-shell-tests lock among them. plugin-registry-contract and screenshot-sanity each left one per run. Start Quickshell under setsid and stop it with a group kill. The kill no longer waits on kill -0 against the shell's pid, so a shell that already died still has its children cleaned up. Fixes #7124 Co-Authored-By: Claude Opus 5.5 --- test/shell.d/bar-widget-contract-test.sh | 7 +++---- test/shell.d/base-test.sh | 9 +++++++++ test/shell.d/indicator-contract-test.sh | 7 +++---- test/shell.d/lock-autorepeat-test.sh | 7 +++---- test/shell.d/lock-fingerprint-indicator-test.sh | 7 +++---- test/shell.d/lock-fingerprint-service-test.sh | 7 +++---- test/shell.d/lock-password-overflow-test.sh | 7 +++---- test/shell.d/manifest-entrypoints-test.sh | 7 +++---- test/shell.d/plugin-auth-boundary-test.sh | 7 +++---- test/shell.d/plugin-registry-contract-test.sh | 7 +++---- test/shell.d/runtime-smoke-test.sh | 7 +++---- test/shell.d/screenshot-sanity-test.sh | 7 +++---- test/shell.d/tray-menu-test.sh | 7 +++---- 13 files changed, 45 insertions(+), 48 deletions(-) diff --git a/test/shell.d/bar-widget-contract-test.sh b/test/shell.d/bar-widget-contract-test.sh index 1a022ed5f3df..04fa01d76048 100755 --- a/test/shell.d/bar-widget-contract-test.sh +++ b/test/shell.d/bar-widget-contract-test.sh @@ -8,9 +8,8 @@ TMPDIR="" QS_PID="" cleanup() { - if [[ -n $QS_PID ]] && kill -0 "$QS_PID" 2>/dev/null; then - kill "$QS_PID" 2>/dev/null || true - wait "$QS_PID" 2>/dev/null || true + if [[ -n $QS_PID ]]; then + stop_process_group "$QS_PID" fi if [[ -n $TMPDIR && -d $TMPDIR ]]; then rm -rf "$TMPDIR" @@ -72,7 +71,7 @@ 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" \ - quickshell -p "$config_dir" --no-color >"$log" 2>&1 & + setsid quickshell -p "$config_dir" --no-color >"$log" 2>&1 & QS_PID=$! for _ in {1..80}; do diff --git a/test/shell.d/base-test.sh b/test/shell.d/base-test.sh index 476b8f8316d6..7e91e33014a9 100644 --- a/test/shell.d/base-test.sh +++ b/test/shell.d/base-test.sh @@ -36,6 +36,15 @@ shell_ipc_socket() { printf '%s/omarchy-shell-%s.sock\n' "${XDG_RUNTIME_DIR:-/run/user/$UID}" "${id:0:16}" } +# Quickshell exits on SIGTERM without reaping its children, so a test starts it +# under setsid and stops the whole group, or its inotifywait outlives the test. +stop_process_group() { + local pid="$1" + + kill -- "-$pid" 2>/dev/null || true + wait "$pid" 2>/dev/null || true +} + require_command() { local command="$1" diff --git a/test/shell.d/indicator-contract-test.sh b/test/shell.d/indicator-contract-test.sh index 94f884d0b4ec..62b3397a1b68 100755 --- a/test/shell.d/indicator-contract-test.sh +++ b/test/shell.d/indicator-contract-test.sh @@ -8,9 +8,8 @@ TMPDIR="" QS_PID="" cleanup() { - if [[ -n $QS_PID ]] && kill -0 "$QS_PID" 2>/dev/null; then - kill "$QS_PID" 2>/dev/null || true - wait "$QS_PID" 2>/dev/null || true + if [[ -n $QS_PID ]]; then + stop_process_group "$QS_PID" fi if [[ -n $TMPDIR && -d $TMPDIR ]]; then rm -rf "$TMPDIR" @@ -45,7 +44,7 @@ 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" \ - quickshell -p "$config_dir" --no-color >"$log" 2>&1 & + setsid quickshell -p "$config_dir" --no-color >"$log" 2>&1 & QS_PID=$! for _ in {1..50}; do diff --git a/test/shell.d/lock-autorepeat-test.sh b/test/shell.d/lock-autorepeat-test.sh index f1570a18902a..7d3cc9c9315d 100644 --- a/test/shell.d/lock-autorepeat-test.sh +++ b/test/shell.d/lock-autorepeat-test.sh @@ -8,9 +8,8 @@ TMPDIR="" QS_PID="" cleanup() { - if [[ -n $QS_PID ]] && kill -0 "$QS_PID" 2>/dev/null; then - kill "$QS_PID" 2>/dev/null || true - wait "$QS_PID" 2>/dev/null || true + if [[ -n $QS_PID ]]; then + stop_process_group "$QS_PID" fi if [[ -n $TMPDIR && -d $TMPDIR ]]; then rm -rf "$TMPDIR" @@ -45,7 +44,7 @@ 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" \ - quickshell -p "$config_dir" --no-color >"$log" 2>&1 & + setsid quickshell -p "$config_dir" --no-color >"$log" 2>&1 & QS_PID=$! for _ in {1..80}; do diff --git a/test/shell.d/lock-fingerprint-indicator-test.sh b/test/shell.d/lock-fingerprint-indicator-test.sh index 48513944af9b..1348a8d6c465 100755 --- a/test/shell.d/lock-fingerprint-indicator-test.sh +++ b/test/shell.d/lock-fingerprint-indicator-test.sh @@ -8,9 +8,8 @@ TMPDIR="" QS_PID="" cleanup() { - if [[ -n $QS_PID ]] && kill -0 "$QS_PID" 2>/dev/null; then - kill "$QS_PID" 2>/dev/null || true - wait "$QS_PID" 2>/dev/null || true + if [[ -n $QS_PID ]]; then + stop_process_group "$QS_PID" fi if [[ -n $TMPDIR && -d $TMPDIR ]]; then rm -rf "$TMPDIR" @@ -45,7 +44,7 @@ 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" \ - quickshell -p "$config_dir" --no-color >"$log" 2>&1 & + setsid quickshell -p "$config_dir" --no-color >"$log" 2>&1 & QS_PID=$! for _ in {1..80}; do diff --git a/test/shell.d/lock-fingerprint-service-test.sh b/test/shell.d/lock-fingerprint-service-test.sh index 0283c7f0d3fb..c6f47e579107 100644 --- a/test/shell.d/lock-fingerprint-service-test.sh +++ b/test/shell.d/lock-fingerprint-service-test.sh @@ -8,9 +8,8 @@ TMPDIR="" QS_PID="" cleanup() { - if [[ -n $QS_PID ]] && kill -0 "$QS_PID" 2>/dev/null; then - kill "$QS_PID" 2>/dev/null || true - wait "$QS_PID" 2>/dev/null || true + if [[ -n $QS_PID ]]; then + stop_process_group "$QS_PID" fi if [[ -n $TMPDIR && -d $TMPDIR ]]; then rm -rf "$TMPDIR" @@ -45,7 +44,7 @@ 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" \ - quickshell -p "$config_dir" --no-color >"$log" 2>&1 & + setsid quickshell -p "$config_dir" --no-color >"$log" 2>&1 & QS_PID=$! for _ in {1..80}; do diff --git a/test/shell.d/lock-password-overflow-test.sh b/test/shell.d/lock-password-overflow-test.sh index debf484420d9..3b17b416672c 100755 --- a/test/shell.d/lock-password-overflow-test.sh +++ b/test/shell.d/lock-password-overflow-test.sh @@ -8,9 +8,8 @@ TMPDIR="" QS_PID="" cleanup() { - if [[ -n $QS_PID ]] && kill -0 "$QS_PID" 2>/dev/null; then - kill "$QS_PID" 2>/dev/null || true - wait "$QS_PID" 2>/dev/null || true + if [[ -n $QS_PID ]]; then + stop_process_group "$QS_PID" fi if [[ -n $TMPDIR && -d $TMPDIR ]]; then rm -rf "$TMPDIR" @@ -45,7 +44,7 @@ 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" \ - quickshell -p "$config_dir" --no-color >"$log" 2>&1 & + setsid quickshell -p "$config_dir" --no-color >"$log" 2>&1 & QS_PID=$! for _ in {1..80}; do diff --git a/test/shell.d/manifest-entrypoints-test.sh b/test/shell.d/manifest-entrypoints-test.sh index ed53ee1bdc72..0a8cb265732c 100755 --- a/test/shell.d/manifest-entrypoints-test.sh +++ b/test/shell.d/manifest-entrypoints-test.sh @@ -8,9 +8,8 @@ TMPDIR="" QS_PID="" cleanup() { - if [[ -n $QS_PID ]] && kill -0 "$QS_PID" 2>/dev/null; then - kill "$QS_PID" 2>/dev/null || true - wait "$QS_PID" 2>/dev/null || true + if [[ -n $QS_PID ]]; then + stop_process_group "$QS_PID" fi if [[ -n $TMPDIR && -d $TMPDIR ]]; then rm -rf "$TMPDIR" @@ -85,7 +84,7 @@ 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" \ - quickshell -p "$config_dir" --no-color >"$log" 2>&1 & + setsid quickshell -p "$config_dir" --no-color >"$log" 2>&1 & QS_PID=$! for _ in {1..80}; do diff --git a/test/shell.d/plugin-auth-boundary-test.sh b/test/shell.d/plugin-auth-boundary-test.sh index 60b42e1965e2..1c1d976fd5be 100755 --- a/test/shell.d/plugin-auth-boundary-test.sh +++ b/test/shell.d/plugin-auth-boundary-test.sh @@ -8,9 +8,8 @@ TMPDIR="" QS_PID="" cleanup() { - if [[ -n $QS_PID ]] && kill -0 "$QS_PID" 2>/dev/null; then - kill "$QS_PID" 2>/dev/null || true - wait "$QS_PID" 2>/dev/null || true + if [[ -n $QS_PID ]]; then + stop_process_group "$QS_PID" fi if [[ -n $TMPDIR && -d $TMPDIR ]]; then rm -rf "$TMPDIR" @@ -175,7 +174,7 @@ 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 >"$log" 2>&1 & + setsid quickshell -p "$config_dir" --no-color >"$log" 2>&1 & QS_PID=$! for _ in {1..80}; do diff --git a/test/shell.d/plugin-registry-contract-test.sh b/test/shell.d/plugin-registry-contract-test.sh index b5a17eb35e19..3b1d1bbb91d1 100755 --- a/test/shell.d/plugin-registry-contract-test.sh +++ b/test/shell.d/plugin-registry-contract-test.sh @@ -8,9 +8,8 @@ TMPDIR="" QS_PID="" cleanup() { - if [[ -n $QS_PID ]] && kill -0 "$QS_PID" 2>/dev/null; then - kill "$QS_PID" 2>/dev/null || true - wait "$QS_PID" 2>/dev/null || true + if [[ -n $QS_PID ]]; then + stop_process_group "$QS_PID" fi if [[ -n $TMPDIR && -d $TMPDIR ]]; then rm -rf "$TMPDIR" @@ -45,7 +44,7 @@ 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" \ - quickshell -p "$config_dir" --no-color >"$log" 2>&1 & + setsid quickshell -p "$config_dir" --no-color >"$log" 2>&1 & QS_PID=$! for _ in {1..50}; do diff --git a/test/shell.d/runtime-smoke-test.sh b/test/shell.d/runtime-smoke-test.sh index db61f7405b43..dfd39b456205 100755 --- a/test/shell.d/runtime-smoke-test.sh +++ b/test/shell.d/runtime-smoke-test.sh @@ -8,9 +8,8 @@ TMPDIR="" QS_PID="" cleanup() { - if [[ -n $QS_PID ]] && kill -0 "$QS_PID" 2>/dev/null; then - kill "$QS_PID" 2>/dev/null || true - wait "$QS_PID" 2>/dev/null || true + if [[ -n $QS_PID ]]; then + stop_process_group "$QS_PID" fi [[ -n ${test_root:-} ]] && rm -f "$(shell_ipc_socket "$test_root")" [[ -n $TMPDIR && -d $TMPDIR ]] && rm -rf "$TMPDIR" @@ -337,7 +336,7 @@ 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 & + setsid quickshell -p "$test_root/shell" --no-color >"$log" 2>&1 & QS_PID=$! for _ in {1..80}; do diff --git a/test/shell.d/screenshot-sanity-test.sh b/test/shell.d/screenshot-sanity-test.sh index beb6009d917e..9947751dced8 100755 --- a/test/shell.d/screenshot-sanity-test.sh +++ b/test/shell.d/screenshot-sanity-test.sh @@ -8,9 +8,8 @@ TMPDIR="" QS_PID="" cleanup() { - if [[ -n $QS_PID ]] && kill -0 "$QS_PID" 2>/dev/null; then - kill "$QS_PID" 2>/dev/null || true - wait "$QS_PID" 2>/dev/null || true + if [[ -n $QS_PID ]]; then + stop_process_group "$QS_PID" fi [[ -n ${test_root:-} ]] && rm -f "$(shell_ipc_socket "$test_root")" if [[ -n $TMPDIR && -d $TMPDIR ]]; then @@ -93,7 +92,7 @@ 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 & + setsid quickshell -p "$test_root/shell" --no-color >"$log" 2>&1 & QS_PID=$! for _ in {1..80}; do diff --git a/test/shell.d/tray-menu-test.sh b/test/shell.d/tray-menu-test.sh index 1fc21a50c39e..c98d1ba310cc 100644 --- a/test/shell.d/tray-menu-test.sh +++ b/test/shell.d/tray-menu-test.sh @@ -13,9 +13,8 @@ cleanup() { kill "$MOCK_PID" 2>/dev/null || true wait "$MOCK_PID" 2>/dev/null || true fi - if [[ -n $QS_PID ]] && kill -0 "$QS_PID" 2>/dev/null; then - kill "$QS_PID" 2>/dev/null || true - wait "$QS_PID" 2>/dev/null || true + if [[ -n $QS_PID ]]; then + stop_process_group "$QS_PID" fi [[ -n $TMPDIR && -d $TMPDIR ]] && rm -rf "$TMPDIR" return 0 @@ -56,7 +55,7 @@ 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 & + setsid quickshell -p "$config_dir" --no-color >"$qs_log" 2>&1 & QS_PID=$! OMARCHY_TRAY_MENU_EVENT_RESULT="$event_result" \ From 3503851a291006581eeb89acdf347e914b3f5e08 Mon Sep 17 00:00:00 2001 From: Omarchybot <317366263+omarchybot@users.noreply.github.com> Date: Sun, 22 Nov 2026 19:17:01 +0100 Subject: [PATCH 2/2] Wait for the plugin watcher before testing crash cleanup The registry fixture can write its result before the asynchronous watcher startup chain finishes. Wait up to three seconds for the real child before killing Quickshell, so scheduler delays do not turn the cleanup regression into a startup race. Co-Authored-By: Opus 5.5 High Co-Authored-By: GPT-6 --- test/shell.d/plugin-registry-contract-test.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/shell.d/plugin-registry-contract-test.sh b/test/shell.d/plugin-registry-contract-test.sh index 6f4db5fc2988..a67116c91f33 100755 --- a/test/shell.d/plugin-registry-contract-test.sh +++ b/test/shell.d/plugin-registry-contract-test.sh @@ -8,7 +8,12 @@ require_quickshell "plugin registry contract test" run_qml_fixture plugin-registry "plugin registry contract checks pass" services Commons -watcher=$(pgrep -P "$QML_FIXTURE_PID" -x inotifywait) || fail "fixture starts a plugin watcher" +watcher="" +for _ in {1..30}; do + watcher=$(pgrep -P "$QML_FIXTURE_PID" -x inotifywait) && break + sleep 0.1 +done +[[ -n $watcher ]] || fail "fixture starts a plugin watcher" # A stopped child cannot handle TERM, so cleanup must also reach its KILL fallback. kill -STOP "$watcher" kill -KILL "$QML_FIXTURE_PID"