wai-rs gains the feature floor (the mandatory floor of SPEC 5: PNG, FLAC and zstd, decoded with no system codec library) and quickstart (the floor, and the receipt checks hello and verify run). The wai command line gains four verbs, one module each, named in one table (dx::VERBS): - hello: name, dispatch, rebuild and receipt on a picture made here, the receipt laid out as http-delivery 8 lays receipts beside an object; - create: a new project from one of the examples, whose files the binary holds; tests/cli_dx.rs holds them to wai/examples/ byte for byte; - dev: the relay, the room service and the room page on one loopback origin, as a production front serves them; --check checks each piece through it; - verify: the receipt indexes under a directory, checked offline. The project file a template writes, wai.json, is read in one place (dx/project.rs). wai/examples/ holds video-room, watch-together, messaging, encoder-ingest, package-and-deliver, verify-receipts, apple-app, android-app and remote-desktop, each with a README and a test that runs it through wai create and wai dev. wai/quickstart/ builds the room client and the archive that holds wai, the relay, the room service, the remote host and the packager. Co-Authored-By: Claude Opus 5.5 <[email protected]>
57 lines
2.9 KiB
Shell
Executable file
57 lines
2.9 KiB
Shell
Executable file
#!/usr/bin/env bash
|
|
# Run the examples' tests, each as a person runs the example: through `wai create` and `wai dev`.
|
|
#
|
|
# bash wai/quickstart/test/run-examples.sh portable|browser|apple|android [<example>...]
|
|
#
|
|
# portable no browser, no macOS: remote-desktop, package-and-deliver, verify-receipts,
|
|
# encoder-ingest (the last two build Rust projects against this checkout)
|
|
# browser in a headless browser: video-room, watch-together, messaging, remote-desktop,
|
|
# package-and-deliver
|
|
# apple apple-app (macOS, Xcode)
|
|
# android android-app (a JDK 17)
|
|
#
|
|
# The binaries come from WAI_DIST, an unpacked quickstart archive (its bin/ goes first on PATH,
|
|
# and `wai dev` finds the relay, the room service and the room client beside itself), or from
|
|
# PATH as it is. For `browser`: BROWSER_BIN (the host's browser; otherwise the automation
|
|
# package's own), and the automation package installed from package-lock.json outside the tree
|
|
# (npm ci --ignore-scripts) unless PLAYWRIGHT_HOST names one. Each test's own output is printed;
|
|
# the last line says which passed.
|
|
set -uo pipefail
|
|
HERE=$(cd "$(dirname "$0")" && pwd)
|
|
EX=$(cd "$HERE/../../examples" && pwd)
|
|
[ $# -ge 1 ] || { sed -n '2,20p' "$0"; exit 2; }
|
|
SET=$1; shift
|
|
if [ -n "${WAI_DIST:-}" ]; then export PATH="$WAI_DIST/bin:$PATH"; fi
|
|
command -v wai > /dev/null || { echo "no wai on PATH (give WAI_DIST)"; exit 2; }
|
|
case "$SET" in
|
|
portable) tests=(remote-desktop/test/remote-desktop.test.sh package-and-deliver/test/package-and-deliver.test.sh verify-receipts/test/verify-receipts.test.sh encoder-ingest/test/encoder-ingest.test.sh) ;;
|
|
browser) tests=(video-room/test/video-room.test.mjs watch-together/test/watch-together.test.mjs messaging/test/messaging.test.mjs remote-desktop/test/remote-desktop.test.mjs package-and-deliver/test/package-and-deliver.test.mjs) ;;
|
|
apple) tests=(apple-app/test/apple-app.test.sh) ;;
|
|
android) tests=(android-app/test/android-app.test.sh) ;;
|
|
*) echo "portable, browser, apple or android"; exit 2 ;;
|
|
esac
|
|
if [ $# -gt 0 ]; then
|
|
keep=()
|
|
for t in "${tests[@]}"; do for n in "$@"; do [ "${t%%/*}" = "$n" ] && keep+=("$t"); done; done
|
|
tests=("${keep[@]}")
|
|
fi
|
|
if [ "$SET" = browser ] && [ -z "${PLAYWRIGHT_HOST:-}" ]; then
|
|
PW=$(mktemp -d)
|
|
cp "$HERE/package.json" "$HERE/package-lock.json" "$PW/"
|
|
(cd "$PW" && npm ci --ignore-scripts --no-audit --no-fund > /dev/null) || { echo "npm ci failed"; exit 2; }
|
|
export PLAYWRIGHT_HOST="$PW/node_modules"
|
|
fi
|
|
passed=() failed=()
|
|
for t in "${tests[@]}"; do
|
|
echo "== $t"
|
|
start=$(date +%s)
|
|
case "$t" in
|
|
*.mjs) node "$EX/$t" ;;
|
|
*) bash "$EX/$t" ;;
|
|
esac
|
|
s=$?
|
|
echo "== $t: exit $s in $(( $(date +%s) - start )) s"
|
|
if [ $s = 0 ]; then passed+=("${t%%/*}"); else failed+=("${t%%/*}"); fi
|
|
done
|
|
echo "examples ($SET): ${#passed[@]} passed${passed[*]:+ (${passed[*]})}; ${#failed[@]} failed${failed[*]:+ (${failed[*]})}"
|
|
[ ${#failed[@]} = 0 ]
|