The first run of the suite on a laptop found five contracts asserting the desktop instead of the code. settings-system pinned DP-2 at 4500x3000 in XRGB2101010; it now asks Hyprland what is actually primary. ssh-keys hardcoded id_ed25519; it now uses whichever key exists. switcher's live half stepped a session with one window, which step() deliberately refuses. displays raced the service's revert readback -- the compositor looks restored while verification still holds busy, so an immediate apply was refused with its error already cleared; the harness now exposes settled and the contract waits for it. declared-dependencies gets an OPTIONAL list for docker: the aliases serve machines that run Docker deliberately, Panama's runtime is rootless podman, and a missing docker fails by naming the command, which is loud enough. Claude-Session: https://claude.ai/code/session_01Epx9ZC1gwm81K3jm9x9CKh
75 lines
2.9 KiB
Bash
Executable File
75 lines
2.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
harness="$repo_dir/config/dot/quickshell/settings-system-harness.qml"
|
|
|
|
fail() {
|
|
printf 'settings system contract: %s\n' "$1" >&2
|
|
exit 1
|
|
}
|
|
|
|
qs_for_harness() {
|
|
qs -p "$harness" "$@"
|
|
}
|
|
|
|
cleanup() {
|
|
qs_for_harness kill >/dev/null 2>&1 || true
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
original_auto_hdr="$(hyprctl -j getoption render:cm_auto_hdr | jq -r .int)"
|
|
original_vrr="$(hyprctl -j getoption misc:vrr | jq -r .int)"
|
|
original_direct="$(hyprctl -j getoption render:direct_scanout | jq -r .int)"
|
|
|
|
qs_for_harness --daemonize >/dev/null
|
|
for _ in $(seq 1 40); do
|
|
if qs_for_harness ipc show 2>/dev/null | rg -q '^target settings-system-test$'; then
|
|
break
|
|
fi
|
|
sleep 0.1
|
|
done
|
|
qs_for_harness ipc show 2>/dev/null | rg -q '^target settings-system-test$' || fail 'test IPC target did not start'
|
|
|
|
qs_for_harness ipc call settings-system-test refresh >/dev/null
|
|
status='{}'
|
|
for _ in $(seq 1 40); do
|
|
status="$(qs_for_harness ipc call settings-system-test status | jq -c .)"
|
|
if jq -e '.monitorName != "" and .width > 0 and .height > 0 and .busy == false' <<<"$status" >/dev/null; then
|
|
break
|
|
fi
|
|
sleep 0.1
|
|
done
|
|
# Against the live compositor, not a named machine: this once asserted DP-2 at
|
|
# 4500x3000 in XRGB2101010, which pinned the desktop it was written on and
|
|
# could never pass on a laptop's eDP-1. The property is that SystemSettings
|
|
# mirrors whatever monitor is actually primary, normalized -- so ask Hyprland
|
|
# what that is.
|
|
live_monitor="$(hyprctl -j monitors | jq -c '.[0]')"
|
|
jq -e --argjson live "$live_monitor" '
|
|
.monitorName == $live.name
|
|
and .width == $live.width
|
|
and .height == $live.height
|
|
and ((.scale - $live.scale) | fabs) < 0.001
|
|
and (.format | length) > 0' <<<"$status" >/dev/null \
|
|
|| fail "live monitor data was not normalized: $status (compositor: $live_monitor)"
|
|
|
|
[[ "$(qs_for_harness ipc call settings-system-test panelAllowed '__definitely_not_a_panel__' | jq -r .)" == "false" ]] \
|
|
|| fail 'unsupported GNOME panel was accepted'
|
|
[[ "$(qs_for_harness ipc call settings-system-test panelAllowed sound | jq -r .)" == "true" ]] \
|
|
|| fail 'supported GNOME sound panel was rejected'
|
|
|
|
# Apply the exact current values: this exercises the real allow-listed command
|
|
# without changing the daily-driver compositor state.
|
|
qs_for_harness ipc call settings-system-test apply "$([[ "$original_auto_hdr" == 1 ]] && printf true || printf false)" "$original_vrr" "$original_direct" >/dev/null
|
|
sleep 0.3
|
|
|
|
[[ "$(hyprctl -j getoption render:cm_auto_hdr | jq -r .int)" == "$original_auto_hdr" ]] || fail 'Auto HDR changed unexpectedly'
|
|
[[ "$(hyprctl -j getoption misc:vrr | jq -r .int)" == "$original_vrr" ]] || fail 'VRR changed unexpectedly'
|
|
[[ "$(hyprctl -j getoption render:direct_scanout | jq -r .int)" == "$original_direct" ]] || fail 'direct scanout changed unexpectedly'
|
|
|
|
trap - EXIT
|
|
cleanup
|
|
printf 'settings system contract: PASS\n'
|