38 lines
1.5 KiB
Bash
Executable file
38 lines
1.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Part of JoeyLib, Copyright (c) 2026 Scott Duensing, under the MIT License.
|
|
# See LICENSE.md for license information.
|
|
# SPDX-License-Identifier: MIT
|
|
#
|
|
# Headless UBER run for the web port: UBER's page in headless Chromium,
|
|
# served from build/web/bin/UBER over HTTP on this machine, driven by
|
|
# scripts/lib/webDriver.mjs until UBER's joeylog.txt (in the page's
|
|
# in-memory file system) says "press any key to exit". The log is written to
|
|
# build/web/bin/UBER/joeylog.txt.
|
|
#
|
|
# The stage is the generic chunky one, so the hashes must equal the DOS
|
|
# port's:
|
|
# scripts/bench-web.sh && tools/diff-uber-hashes tests/goldens/uber/dos.txt build/web/bin/UBER/joeylog.txt
|
|
# The ops/sec are this machine's browser's: compare them only run against run.
|
|
#
|
|
# scripts/bench-web.sh # default 300 s timeout
|
|
# TIMEOUT=600 scripts/bench-web.sh # override
|
|
set -euo pipefail
|
|
|
|
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
|
source "$repo/scripts/lib/joeyEnv.sh"
|
|
source "$repo/scripts/lib/webGate.sh"
|
|
webNeed
|
|
|
|
dir=$repo/build/web/bin/UBER
|
|
[ -f "$dir/UBER.html" ] || { echo "bench-web: build UBER first (make web)" >&2; exit 2; }
|
|
log=$dir/joeylog.txt
|
|
timeoutSeconds=${TIMEOUT:-300}
|
|
|
|
rm -f "$log"
|
|
webServe "$dir"
|
|
trap webStop EXIT
|
|
if ! webDrive "UBER.html?scale=1&aspect=square" --seconds "$timeoutSeconds" --until "press any key to exit" --log "$log"; then
|
|
echo "bench-web: FAIL - UBER did not finish within ${timeoutSeconds} s" >&2
|
|
exit 1
|
|
fi
|
|
echo "bench-web: UBER finished; log in ${log#"$repo"/}"
|