Wires a `checks` output into the flake, one file per check under checks/, all three asserting docs/CONTRACT.md rather than the implementation: - unit: pytest over tests/unit/ in the build sandbox, against the nix/package.nix build. Refuses an empty suite -- pytest exits 0 when every test was skipped or deselected, so checks/lib/check_report.py parses the JUnit report and fails on zero collected or zero executed. - vm-basic: nixosTest with captureCommand pointed at tests/fake_capture.py, which emits one fixed deterministic PNG. Because the image never changes, "two frames arrived and they are the same bytes" is an assertion about the framing rather than a coincidence. - vm-hyprland: the same machine with no captureCommand override, so grim captures the real compositor. Deliberately impatient -- bounded timeouts, no retry loops, and a full diagnostics dump (compositor log, hyprctl monitors, both journals) before any failure propagates. tests/assert_stream.py is a second, independent reader of the contract: it shares no code with hhstream.client, so a framing bug present in both the server's writer and the shipped client's reader still fails. The unit suite's negative tests use a `rejects` fixture instead of pytest.raises(Exception), which an unimplemented stub's NotImplementedError would otherwise satisfy. Three defects found in code this branch does not own, recorded in README.dev.md rather than worked around: - nix/module.nix has no config side, so neither unit exists and both VM checks fail at their first wait; - services.hyprland-headless-stream.package is declared with no default, against docs/CONTRACT.md; - src/hhstream/*.py is all stubs, so 66 of 70 unit tests fail. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017YXMoCNxzScTaKNr43GQNz
83 lines
2.8 KiB
Bash
Executable File
83 lines
2.8 KiB
Bash
Executable File
#!/bin/sh
|
|
# Dump everything worth knowing when `vm-hyprland` fails.
|
|
#
|
|
# The compositor's own log is the thing you actually want and the thing that is
|
|
# hardest to find: Hyprland writes it under
|
|
# $XDG_RUNTIME_DIR/hypr/<instance-signature>/hyprland.log, and the service runs
|
|
# on a private XDG_RUNTIME_DIR. So rather than guess the path, look for it.
|
|
#
|
|
# Never fails: a diagnostics dump that exits non-zero hides the real error.
|
|
|
|
PATH="@diagPath@:$PATH"
|
|
export PATH
|
|
|
|
if [ "$1" = "--self-test" ]; then
|
|
echo "hhs-hyprland-diagnostics: ok"
|
|
exit 0
|
|
fi
|
|
|
|
SERVICE_UNIT=hyprland-headless-stream.service
|
|
COMPOSITOR_UNIT=hyprland-headless.service
|
|
|
|
say() { printf '\n----- %s -----\n' "$*"; }
|
|
run() { say "$*"; "$@" 2>&1 || echo "[exit $?]"; }
|
|
|
|
say "units"
|
|
systemctl --no-pager --plain list-units --all 'hyprland*' 2>&1 || true
|
|
|
|
for unit in "$COMPOSITOR_UNIT" "$SERVICE_UNIT"; do
|
|
run systemctl --no-pager --full status "$unit"
|
|
run journalctl --no-pager --boot --lines=200 --unit "$unit"
|
|
done
|
|
|
|
run systemctl --no-pager --full list-dependencies "$SERVICE_UNIT"
|
|
|
|
say "socket and runtime directories"
|
|
ls -la /run/hyprland-headless-stream 2>&1 || echo "[no /run/hyprland-headless-stream]"
|
|
ls -la /run/user 2>&1 || echo "[no /run/user]"
|
|
for d in /run/user/*; do
|
|
[ -d "$d" ] && ls -la "$d" 2>&1
|
|
done
|
|
|
|
say "hyprland logs"
|
|
# hyprland.log lives beside the compositor's IPC sockets; -xdev keeps this out
|
|
# of /nix/store and /proc.
|
|
found=0
|
|
for root in /run /var/log /tmp /home; do
|
|
[ -d "$root" ] || continue
|
|
for log in $(find "$root" -xdev -maxdepth 6 -name 'hyprland*.log' 2>/dev/null); do
|
|
found=1
|
|
say "tail -n 200 $log"
|
|
tail -n 200 "$log" 2>&1
|
|
done
|
|
done
|
|
[ "$found" = 1 ] || echo "[no hyprland*.log anywhere under /run /var/log /tmp /home]"
|
|
|
|
say "hyprctl monitors"
|
|
# Needs both XDG_RUNTIME_DIR and the instance signature, which is the directory
|
|
# name under <runtime>/hypr. Try every instance we can find.
|
|
tried=0
|
|
for hyprdir in /run/user/*/hypr/* /run/*/hypr/*; do
|
|
[ -d "$hyprdir" ] || continue
|
|
sig=$(basename "$hyprdir")
|
|
runtime=$(dirname "$(dirname "$hyprdir")")
|
|
owner=$(stat -c %U "$hyprdir" 2>/dev/null || echo root)
|
|
tried=1
|
|
say "hyprctl monitors (instance $sig, XDG_RUNTIME_DIR=$runtime, as $owner)"
|
|
if command -v hyprctl > /dev/null 2>&1; then
|
|
XDG_RUNTIME_DIR="$runtime" HYPRLAND_INSTANCE_SIGNATURE="$sig" \
|
|
hyprctl monitors 2>&1 || echo "[exit $?]"
|
|
XDG_RUNTIME_DIR="$runtime" HYPRLAND_INSTANCE_SIGNATURE="$sig" \
|
|
hyprctl version 2>&1 || echo "[exit $?]"
|
|
else
|
|
echo "[hyprctl not on PATH; add the hyprlandPackage to environment.systemPackages]"
|
|
fi
|
|
done
|
|
[ "$tried" = 1 ] || echo "[no hypr instance directory found: the compositor never came up]"
|
|
|
|
say "processes"
|
|
ps aux 2>&1 | grep -E 'hypr|hhstream|grim' | grep -v grep || echo "[no hyprland/hhstream/grim process]"
|
|
|
|
say "end of diagnostics"
|
|
exit 0
|