AtlatestRepositorysigil-wm
1
#!/usr/bin/env bash2
set -euo pipefail3
cd "$(dirname "$0")/.."4
if [[ ${1:-} != --inside ]]; then5
exec guix time-machine -C channels.scm -- shell -m draw-manifest.scm foot -- bash scripts/test-foot-blink --inside6
fi7
make -j2 all build/surface-frames build/frame-fault.so8
unset TMUX TMUX_PANE9
unset SIGIL_WM_FOOT_MODERN10
foot_version=$(foot --version)11
if [[ $foot_version =~ ([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then12
if (( BASH_REMATCH[1] > 1 || (BASH_REMATCH[1] == 1 && BASH_REMATCH[2] >= 28) )); then13
export SIGIL_WM_FOOT_MODERN=114
fi15
else16
printf 'unrecognized foot version: %s\n' "$foot_version" >&217
exit 218
fi19
out=$PWD/build/receipts/foot-blink20
mkdir -p "$out"21
parent_runtime=$(mktemp -d /tmp/sigil-foot-parent.XXXXXXXX)22
child_runtime=$(mktemp -d /tmp/sigil-foot-child.XXXXXXXX)23
chmod 700 "$parent_runtime" "$child_runtime"24
parent_pid=25
cleanup() {26
if [[ -n $parent_pid ]]; then kill "$parent_pid" 2>/dev/null || true; wait "$parent_pid" 2>/dev/null || true; fi27
rm -rf "$parent_runtime" "$child_runtime"28
}29
trap cleanup EXIT30
XDG_RUNTIME_DIR=$parent_runtime WLR_BACKENDS=headless WLR_RENDERER=pixman WLR_HEADLESS_OUTPUTS=1 \31
SIGIL_WM_REPL=$parent_runtime/repl timeout 60 bash scripts/run-sigil -L src -L examples eval -f examples/tiling.sgl > "$out/parent.log" 2>&1 &32
parent_pid=$!33
for ((attempt=0;attempt<400;attempt++)); do34
if grep -q '^WAYLAND_SOCKET=' "$out/parent.log"; then break; fi35
sleep 0.02536
done37
parent_display=$(sed -n 's/^WAYLAND_SOCKET=//p' "$out/parent.log" | head -1)38
[[ -n $parent_display ]] || { cat "$out/parent.log"; exit 2; }39
for terminal in direct tmux; do40
for clip in 0 1; do41
for failure in ${SIGIL_WM_FOOT_FAILURES:-clean}; do42
unset SIGIL_WM_FRAMES_TMUX43
if [[ $terminal == tmux ]]; then export SIGIL_WM_FRAMES_TMUX=1; fi44
unset SIGIL_WM_FRAME_FAILURE45
rm -f "$child_runtime/fail"46
if [[ $failure == busy ]]; then export SIGIL_WM_FRAME_FAILURE=$child_runtime/fail; fi47
rc=048
XDG_RUNTIME_DIR=$child_runtime WAYLAND_DISPLAY=$parent_runtime/$parent_display WLR_BACKENDS=wayland WLR_RENDERER=pixman \49
SIGIL_WM_FRAMES_FOOT=1 LD_PRELOAD=$PWD/build/frame-fault.so \50
timeout 20 build/surface-frames "$out/$terminal-$clip-$failure.samples" "$clip" > "$out/$terminal-$clip-$failure.log" 2>&1 || rc=$?51
cat "$out/$terminal-$clip-$failure.log"52
test "$rc" == 053
if grep -q '^ err:' "$out/$terminal-$clip-$failure.log"; then exit 2; fi54
if [[ $failure == busy ]]; then55
awk '56
/^FRAME_COMMIT_EBUSY / { pending=1; failures++ }57
/^FRAME_COMMIT_ACCEPTED / { pending=0 }58
/^FRAME_CALLBACK / && pending { print "FOOT_CALLBACK_BEFORE_ACCEPTED=FAIL"; failed=1 }59
END { if (failures != 1) failed=1; exit failed }60
' "$out/$terminal-$clip-$failure.log"61
fi62
done63
done64
done65
XDG_RUNTIME_DIR=$parent_runtime bash scripts/msg "$parent_runtime/repl" '(stop-host! host)' > "$out/quit.log"66
wait "$parent_pid"67
parent_pid=68
printf 'FOOT_NESTED_BLINK=PASS clipped-and-unclipped sampled-on-off-phases\n'