56 lines
2.1 KiB
Bash
Executable file
56 lines
2.1 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 PSP port: UBER's EBOOT.PBP under PPSSPPHeadless
|
|
# (scripts/lib/pspGate.sh), from a private memory stick, with every memory
|
|
# access checked as a PSP checks it -- an unaligned or wild access stops the
|
|
# run and fails it, naming the line -- until UBER's joeylog.txt says "press
|
|
# any key to exit". The log is copied to build/psp/bin/UBER/joeylog.txt.
|
|
#
|
|
# The stage is the generic chunky one, so the hashes must equal the DOS
|
|
# port's:
|
|
# scripts/bench-psp.sh && build/tools/diffUberHashes tests/goldens/uber/dos.txt build/psp/bin/UBER/joeylog.txt
|
|
# The ops/sec are PPSSPP's emulated clock, which runs unthrottled: compare
|
|
# them only run against run.
|
|
#
|
|
# scripts/bench-psp.sh # default 300 s timeout
|
|
# TIMEOUT=600 scripts/bench-psp.sh # override
|
|
set -euo pipefail
|
|
|
|
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
|
source "$repo/scripts/lib/joeyEnv.sh"
|
|
source "$repo/scripts/lib/pspGate.sh"
|
|
pspNeed
|
|
|
|
program=$(joeyExampleProgram uber psp)
|
|
[ -f "$program" ] || { echo "bench-psp: build UBER first (make psp)" >&2; exit 2; }
|
|
dir=$(dirname "$program")
|
|
timeoutSeconds=${TIMEOUT:-300}
|
|
|
|
work=$(mktemp -d -t joeylib-psp-bench.XXXXXX)
|
|
cleanup() {
|
|
pspStop
|
|
rm -rf "$work"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
rm -f "$dir/joeylog.txt"
|
|
folder=$(pspStage "$work" "$dir")
|
|
pspRun "$work" "$folder" "$timeoutSeconds"
|
|
while joeyAlive "$PSP_PID"; do
|
|
if grep -q "press any key to exit" "$folder/joeylog.txt" 2>/dev/null; then
|
|
break
|
|
fi
|
|
sleep 1
|
|
done
|
|
pspStop
|
|
pspStrictCheck "$work" "$dir" || { echo "bench-psp: FAIL - a bad memory access" >&2; exit 1; }
|
|
[ -f "$folder/joeylog.txt" ] && cp "$folder/joeylog.txt" "$dir/joeylog.txt"
|
|
if grep -q "press any key to exit" "$dir/joeylog.txt" 2>/dev/null; then
|
|
echo "bench-psp: UBER finished; log in ${dir#"$repo"/}/joeylog.txt"
|
|
exit 0
|
|
fi
|
|
echo "bench-psp: FAIL - UBER ended (or timed out after ${timeoutSeconds} s) without finishing" >&2
|
|
exit 1
|