#!/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 Win32 port: UBER.EXE under Wine (a private prefix # on a private Xvfb display, scripts/lib/wineGate.sh), until UBER's # joeylog.txt -- beside the program, build/win32/bin -- says "press any key # to exit". # # The stage is the generic chunky one, so the hashes must equal the DOS # port's: # scripts/bench-win32.sh && build/tools/diffUberHashes tests/goldens/uber/dos.txt build/win32/bin/joeylog.txt # The ops/sec are this machine's under Wine: compare them only run against run. # # scripts/bench-win32.sh # default 300 s timeout # TIMEOUT=600 scripts/bench-win32.sh # override set -euo pipefail repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) source "$repo/scripts/lib/joeyEnv.sh" source "$repo/scripts/lib/wineGate.sh" label=bench-win32 wineNeed program=$(joeyExampleProgram uber win32) [ -f "$program" ] || { echo "$label: build UBER first (make win32)" >&2; exit 2; } log=$(dirname "$program")/joeylog.txt timeoutSeconds=${TIMEOUT:-300} work=$(mktemp -d -t "joeylib-win32-bench.XXXXXX") cleanup() { wineStop rm -rf "$work" } trap cleanup EXIT rm -f "$log" wineStart "$work" wineRun "$program" for ((waited = 0; waited < timeoutSeconds; waited++)); do if grep -q "press any key to exit" "$log" 2>/dev/null; then echo "$label: UBER finished; log in ${log#"$repo"/}" exit 0 fi sleep 1 done echo "$label: FAIL - UBER did not finish within ${timeoutSeconds} s" >&2 exit 1