Files
vt1200/apps/termtris/verify.sh
T
opencode.energia.arti.ee a12fb47d5f chore(termtris): handoff script and notes for the next machine
apps/termtris/verify.sh runs the whole acceptance: ROM md5 guard, 2ine
check, MAME build (--skip-mame to reuse one), the six tests, the
acceptance summary and the evidence list, all logged under build/.

HANDOFF.md states what is done, what is still open (the docs' figures and
screenshots predate the VR319 default because the installed MAME binary is
the 30 Oct build), the expected outputs, and the failure modes already
diagnosed. Refresh the acceptance numbers from the verify run:
348/19, 338/13, 292/11.
2026-11-12 05:14:33 +00:00

108 lines
2.4 KiB
Bash
Executable File

#!/bin/sh
# verify.sh -- one-command acceptance for the VT1200 termtris port.
#
# apps/termtris/verify.sh # build MAME, then run every test
# apps/termtris/verify.sh --skip-mame # use the emulator already installed
#
# Exits non-zero on the first failed check. Each test's full output is kept in
# apps/termtris/build/verify_<name>.log.
set -eu
DIR=$(cd "$(dirname "$0")" && pwd)
ROOT=$(cd "$DIR/../.." && pwd)
M=${MAME:-/home/arti/code/k-space/mame0289/vt1200}
ROM_MD5=b46a3e442ccb86134d2356bd70d22fd2
skip_mame=0
for arg in "$@"; do
case $arg in
--skip-mame) skip_mame=1 ;;
-h|--help)
sed -n '2,8p' "$0" | sed 's/^# \{0,1\}//'
exit 0
;;
*)
echo "verify.sh: unknown argument: $arg" >&2
exit 2
;;
esac
done
mkdir -p "$DIR/build"
echo "== ROM checksum"
got=$(md5sum "$ROOT/vt1200_v22.bin" | cut -d' ' -f1)
if [ "$got" != "$ROM_MD5" ]; then
echo "FAIL: vt1200_v22.bin md5 is $got, expected $ROM_MD5" >&2
exit 1
fi
echo "ok: $got"
echo "== 2ine toolchain"
LX="${NINE:-/home/arti/os2-work/2ine/build}/lx_loader"
if [ ! -x "$LX" ]; then
echo "FAIL: no 2ine lx_loader at $LX (set NINE=/path/to/2ine/build)" >&2
exit 1
fi
echo "ok: $LX"
echo "== emulator"
if [ "$skip_mame" -eq 0 ]; then
JOBS=${JOBS:-8} "$ROOT/harness/mame/build.sh"
fi
if [ ! -x "$M" ]; then
echo "FAIL: no vt1200 binary at $M (set MAME=... or drop --skip-mame)" >&2
exit 1
fi
echo "ok: $M"
export MAME="$M"
fail=0
run() {
name=$1
shift
printf '== %-9s ' "$name"
if "$@" >"$DIR/build/verify_$name.log" 2>&1; then
echo "PASS"
else
echo "FAIL (apps/termtris/build/verify_$name.log)"
tail -20 "$DIR/build/verify_$name.log" | sed 's/^/ /'
fail=1
fi
}
run smoke "$DIR/tests/smoke.sh"
run fmt "$DIR/tests/fmt.sh"
run render "$DIR/tests/render.sh"
run input "$DIR/tests/input.sh"
run play "$DIR/tests/play.sh"
run play_keys "$DIR/tests/play_keys.sh"
echo
echo "== play acceptance"
if [ -f "$DIR/build/play_move.log" ]; then
for mode in move panels quit; do
grep -a -h 'DIAG: loops' "$DIR/build/play_$mode.log" 2>/dev/null |
head -1 | sed "s/^/ $mode /"
done
fi
echo
echo "== evidence"
ls -1 "$DIR"/evidence/*.png 2>/dev/null | sed 's/^/ /'
echo
echo "== ROM checksum (after the suite)"
got=$(md5sum "$ROOT/vt1200_v22.bin" | cut -d' ' -f1)
[ "$got" = "$ROM_MD5" ] || { echo "FAIL: ROM changed during the run" >&2; exit 1; }
echo "ok: $got"
if [ "$fail" -ne 0 ]; then
echo
echo "verify: FAILED" >&2
exit 1
fi
echo
echo "verify: PASS"