AtlatestRepositorysigil-wm

sigil-wm / tree / scriptstest-input-reply-queue

1#!/usr/bin/env bash
2set -euo pipefail
3cd -P "$(dirname "$0")/.."
4make -j2 all build/input-queue-gate.so
5test_runtime=$(mktemp -d /tmp/wm-input-queue.XXXXXX)
6trap 'rm -rf "$test_runtime"' EXIT
7chmod 700 "$test_runtime"
8export XDG_RUNTIME_DIR=$test_runtime WLR_BACKENDS=headless WLR_RENDERER=pixman WLR_HEADLESS_OUTPUTS=1
9unset WAYLAND_DISPLAY DISPLAY
10export SIGIL_WM_LIBRARY=$PWD/build/input-queue-gate.so
11mkdir -p build/receipts/input-reply-queue
12for kind in 30 31 32; do
13 log=build/receipts/input-reply-queue/kind-$kind.log
14 WM_INPUT_MODE=overflow WM_INPUT_KIND=$kind timeout --foreground 15 "${SIGIL:-sigil}" -L src eval -f test/input-reply-queue.sgl > "$log" 2>&1 || { cat "$log"; exit 1; }
15 cat "$log"
16 grep -q "^INPUT_REPLY_QUEUE=PASS kind=$kind " "$log"
17 ! grep -q 'event handler failed' "$log"
18 [[ $(grep -c '^INPUT_REPLY case=queue-full action=wait depth=1024 ' "$log") == 1 ]]
19done
20for kind in 30 31 32; do
21 log=build/receipts/input-reply-queue/starting-$kind.log
22 WM_INPUT_MODE=starting WM_INPUT_KIND=$kind timeout --foreground 15 "${SIGIL:-sigil}" -L src eval -f test/input-reply-queue.sgl > "$log" 2>&1 || { cat "$log"; exit 1; }
23 cat "$log"
24 grep -q "^INPUT_STARTING=PASS kind=$kind " "$log"
25 ! grep -q 'event handler failed' "$log"
26 [[ $(grep -c '^INPUT_REPLY case=receiver-starting action=wait depth=0 ' "$log") == 1 ]]
27done
28for kind in 30 31 32; do
29 log=build/receipts/input-reply-queue/shutdown-$kind.log
30 WM_INPUT_MODE=shutdown WM_INPUT_KIND=$kind timeout --foreground 15 "${SIGIL:-sigil}" -L src eval -f test/input-reply-queue.sgl > "$log" 2>&1 || { cat "$log"; exit 1; }
31 cat "$log"
32 grep -q "^INPUT_SHUTDOWN=PASS kind=$kind" "$log"
33 ! grep -q 'event handler failed' "$log"
34 [[ $(grep -c '^INPUT_REPLY case=receiver-stopped action=drop depth=0 ' "$log") == 1 ]]
35done