AtlatestRepositorysigil-wm

sigil-wm / tree / scriptstest-nested

1#!/usr/bin/env bash
2set -euo pipefail
3cd "$(dirname "$0")/.."
4if [[ ${1:-} != --inside ]]; then
5 exec guix time-machine -C channels.scm -- shell -m draw-manifest.scm -- bash scripts/test-nested --inside
6fi
7make -j2 all build/pixel-client build/readback
8parent_runtime=$(mktemp -d /tmp/sigil-wm-parent.XXXXXX)
9chmod 700 "$parent_runtime"
10mkdir -p build/receipts
11parent_pid=
12cleanup() {
13 [[ -z $parent_pid ]] || kill "$parent_pid" 2>/dev/null || true
14 [[ -z $parent_pid ]] || wait "$parent_pid" 2>/dev/null || true
15 rm -rf "$parent_runtime"
17trap cleanup EXIT
18XDG_RUNTIME_DIR=$parent_runtime WLR_BACKENDS=headless WLR_RENDERER=pixman WLR_HEADLESS_OUTPUTS=1 SIGIL_WM_REPL="$parent_runtime/repl" \
19 timeout 300 bash scripts/run-sigil -L src -L examples -L .deps eval -f examples/tiling.sgl > build/receipts/parent.log 2>&1 &
20parent_pid=$!
21for ((attempt=0; attempt<200; attempt++)); do
22 grep -q '^WAYLAND_SOCKET=' build/receipts/parent.log && break
23 sleep 0.05
24done
25grep -q '^WAYLAND_SOCKET=' build/receipts/parent.log
26export SIGIL_WM_TEST_PARENT_DISPLAY="$parent_runtime/$(sed -n 's/^WAYLAND_SOCKET=//p' build/receipts/parent.log | head -1)"
27export SIGIL_WM_TEST_PARENT_REPL="$parent_runtime/repl"
28export SIGIL_WM_TEST_BACKEND=wayland
29bash scripts/test-examples --inside
30bash scripts/msg "$SIGIL_WM_TEST_PARENT_REPL" '(stop-host! host)'
31wait "$parent_pid"
32parent_pid=
33echo 'NESTED=PASS'