joeylib2/scripts/verify-atarist-display.sh

56 lines
2.3 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
#
# verify-atarist-display.sh - the ST family's present, checked on the page
# the shifter shows. UBER's golden hashes are of the stage; a present that
# leaves stale rows on screen passes them. UBERPROB (UBER with UBER_PROBE,
# make/examples.mk) runs its display row (op_probeDisplayCheck): a tall band
# presented, then a small rect inside it, then a settle present and an idle
# one, comparing the shown page with the stage's planes after each
# (jlpProbeDisplayMismatch in src/atarist/hal.c). Every count must be 0.
#
# Usage: scripts/verify-atarist-display.sh [MACHINE...] (default: st ste)
# st and megast run the ST build, ste and megaste the STe build.
# Exit: 0 PASS, 1 FAIL, 2 SKIP (Hatari or EmuTOS not installed)
# Requires: Hatari + EmuTOS (install.sh install emulator:atarist); it builds
# the probe (make PLATFORM-uberprob).
set -uo pipefail
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
source "$repo/scripts/lib/joeyEnv.sh"
joeyNeed HATARI hatari
joeyNeed EMUTOS_IMG emutos
label=verify-atarist-display
machines=("$@")
[ ${#machines[@]} -gt 0 ] || machines=(st ste)
failed=0
for machine in "${machines[@]}"; do
case $machine in
st|megast) build=atarist ;;
ste|megaste) build=ste ;;
*) echo "$label: unknown machine '$machine' (st, megast, ste, megaste)" >&2; exit 2 ;;
esac
makefile=$repo/make/$build.mk
if ! make -s -f "$makefile" "$build-uberprob"; then
echo "$label: FAIL - building the $build UBERPROB failed" >&2
exit 1
fi
dir=$repo/build/$build/probe
rm -f "$dir/joeylog.txt"
BENCH_PRG=UBERPROB.PRG BENCH_BIN_DIR="$dir" TIMEOUT="${TIMEOUT:-120}" "$repo/scripts/bench-atarist.sh" "$machine" > /dev/null 2>&1
line=$(grep "UBER-PROBE: displayMismatch" "$dir/joeylog.txt" 2>/dev/null)
if [[ "$line" =~ afterB=0\ afterSettle=0\ afterIdle=0 ]]; then
echo "$label: $build build on $machine OK - ${line#UBER-PROBE: }"
else
echo "$label: $build build on $machine FAIL - ${line:-no displayMismatch line in its log}" >&2
failed=1
fi
done
if [ "$failed" = 0 ]; then
echo "$label: PASS"
fi
exit "$failed"