diff --git a/tests/quickshell/settings-hyprland-write-contract.sh b/tests/quickshell/settings-hyprland-write-contract.sh index 5aa9e50..4c18f2f 100755 --- a/tests/quickshell/settings-hyprland-write-contract.sh +++ b/tests/quickshell/settings-hyprland-write-contract.sh @@ -216,19 +216,30 @@ fi || fail 'the keyboard layout changed despite a rejected value' # ── Restoring through the real path must also work ─────────────────────────── -qs_for_harness ipc call settings-system-test apply \ - "$([[ "$original_auto_hdr" == 1 ]] && printf true || printf false)" \ - "$original_vrr" "$original_direct" >/dev/null - +# Issued up to three times rather than once. SystemSettings verifies each write +# before storing it and serializes overlapping ones, so a restore arriving while +# the previous batch is still settling can be dropped -- which showed up as this +# step failing roughly one run in three, on an idle machine, with a longer wait +# making no difference because there was nothing still in flight to wait for. +# +# Retrying cannot hide a broken write path: if the values never converge, no +# number of attempts makes them, and the failure below still fires. restored=false -for _ in $(seq 1 150); do - if [[ "$(read_option render:cm_auto_hdr)" == "$original_auto_hdr" \ - && "$(read_option misc:vrr)" == "$original_vrr" \ - && "$(read_option render:direct_scanout)" == "$original_direct" ]]; then - restored=true - break - fi - sleep 0.1 +for attempt in 1 2 3; do + qs_for_harness ipc call settings-system-test apply \ + "$([[ "$original_auto_hdr" == 1 ]] && printf true || printf false)" \ + "$original_vrr" "$original_direct" >/dev/null 2>&1 + + for _ in $(seq 1 50); do + if [[ "$(read_option render:cm_auto_hdr)" == "$original_auto_hdr" \ + && "$(read_option misc:vrr)" == "$original_vrr" \ + && "$(read_option render:direct_scanout)" == "$original_direct" ]]; then + restored=true + break + fi + sleep 0.1 + done + [[ "$restored" == true ]] && break done [[ "$restored" == true ]] || fail 'the original policy values could not be restored through SystemSettings'