WAI toolchain decision 11: joule-moq-relay builds wai-relay, joule-moq-room wai-room, and joule-moq-ingest wai-ingest. wai dev finds them by those names (WAI_RELAY_BIN, WAI_ROOM_BIN), and the quickstart archive, the release workflow, the examples' workflow, the browser tests, the interop scripts, the example host script, the Scoop manifest and the crates' READMEs and example configurations name them so. Wire and record identifiers that carry a crate's name (joule-moq-relay/session-summary/2, joule-moq-ingest/session/1, the relay's MOQT implementation string) and the log variables (JOULE_MOQ_*_LOG) are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
41 lines
2.4 KiB
Shell
Executable file
41 lines
2.4 KiB
Shell
Executable file
#!/usr/bin/env bash
|
|
# The remote-desktop example, with no browser and no screen: `wai create` makes the project,
|
|
# `wai dev` runs the room in remote desktop mode, and host.sh shares a drawn pattern into it for
|
|
# a few seconds, recording the session. The room service must hold the host's screen, and the
|
|
# repository's independent verifier must accept the recorded session.
|
|
#
|
|
# bash wai/examples/remote-desktop/test/remote-desktop.test.sh
|
|
# Needs wai, wai-relay, wai-room and wai-remote-host on PATH (or WAI_RELAY_BIN,
|
|
# WAI_ROOM_BIN, WAI_WEB as `wai dev` takes them), and python3.
|
|
# No -e: each check records its own result, and the run goes on to the next.
|
|
set -uo pipefail
|
|
REPO=$(cd "$(dirname "$0")/../../../.." && pwd)
|
|
T=$(mktemp -d)
|
|
fails=0
|
|
check() { if [ "$2" = 0 ]; then echo "ok $1${3:+ ($3)}"; else echo "FAIL $1${3:+ ($3)}"; fails=$((fails + 1)); fi; }
|
|
wai create "$T/desk" --template remote-desktop > /dev/null || { echo "FAIL wai create"; exit 1; }
|
|
cd "$T/desk"
|
|
set -m
|
|
wai dev --port 0 --for 300 > dev.log 2>&1 &
|
|
DEV=$!
|
|
set +m
|
|
trap 'kill -INT -- -$DEV 2>/dev/null || true; sleep 2; kill -KILL -- -$DEV 2>/dev/null || true' EXIT
|
|
for _ in $(seq 1 300); do grep -q 'ready on' dev.log && break; sleep 0.2; done
|
|
ORIGIN=$(sed -n 's/^wai dev: ready on \(http:[^ ]*\).*/\1/p' dev.log)
|
|
[ -n "$ORIGIN" ] || { cat dev.log; echo "FAIL wai dev did not start"; exit 1; }
|
|
WAI_DEV_ORIGIN=$ORIGIN sh host.sh --pattern --seconds 8 --record session.json > host.log 2>&1 &
|
|
HOST=$!
|
|
screen=1
|
|
for _ in $(seq 1 60); do
|
|
if curl -fsS "$ORIGIN/room-api/room" | python3 -c 'import json,sys; v=json.load(sys.stdin); sys.exit(0 if (v.get("remote") or {}).get("screen") else 1)' 2>/dev/null; then screen=0; break; fi
|
|
sleep 0.25
|
|
done
|
|
check "the room service holds the host's screen statement" $screen
|
|
hs=0; wait $HOST || hs=$?
|
|
check "the host shared its screen for its seconds and left" $hs "$(tail -1 host.log)"
|
|
vs=0
|
|
python3 -I "$REPO/wai/live-conformance/remote_desktop_verify.py" --room session.json > verdict.json || vs=$?
|
|
python3 -c 'import json,sys; v=json.load(open(sys.argv[1])); print(" verifier:", json.dumps({k: v[k] for k in list(v)[:6]})[:300]); sys.exit(0 if v.get("outcome") == "accept" and v.get("screens") else 1)' verdict.json || vs=1
|
|
check "the independent verifier accepts the session the host recorded" $vs
|
|
echo "remote-desktop: $([ $fails = 0 ] && echo all checks held || echo "$fails check(s) failed")"
|
|
exit $fails
|