#!/usr/bin/env bash # verify.sh - Space Taxi's gates, run one after another, with a summary. # # stsim every hook level's 4000-tick simulation trace is identical to # its golden (tools/stsim/gate.sh), and every cel a ride shows # is baked (tools/stsim/celGate.sh) # harness the front-end screens above the simulation -- the high-score # table, name entry and its save -- on JoeyLib's host BLANK # port (tools/staxiharness) # disk the bootable IIgs volume boots on a ROM 3 machine, launches # the game and draws (JoeyLib's verify-iigs-game-disk.sh) # disk01 the same on ROM 01: the volume keeps the ROM 01 tool patches # iigsaudio the IIgs sound interrupt is NTP's, the DOC's master volume is # up and the sound slots carry waveforms (JoeyLib's # verify-iigs-audio.sh) # x68kaudio every YM2151 noise write is a code from the port's table and # the ADPCM is fed at 7812 Hz to both speakers (JoeyLib's # verify-x68000-audio.sh); the attract demo plays the whole # noise curve and speaks # # Usage: scripts/verify.sh [gate...] every gate when none is named # Env: JOEYLIB the JoeyLib checkout (default ../joeylib) # The gates check what is built: run make first (make check does both). # # Exit codes: # 0 every gate passed # 1 a gate failed # 3 none failed, but one was skipped for a missing prerequisite (an # emulator, a target not built, the game data not imported) -- not 0, # so a run that tested nothing cannot look green # A gate exits 2 to say it was skipped. set -uo pipefail repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) JOEYLIB=$(cd "${JOEYLIB:-$repo/../joeylib}" && pwd) || { echo "verify: no JoeyLib checkout (set JOEYLIB)" >&2; exit 2; } export JOEYLIB bin=$repo/build harnessLevels=$bin/generated/dos/levels/title.dat # name command...: every gate, in run order. GATES=$(cat <&2; exit 2; }; make -s -C tools/staxiharness JOEYLIB=$JOEYLIB || exit 1 disk $JOEYLIB/scripts/verify-iigs-game-disk.sh $bin/iigs/bin/STAXI.2mg disk01 GAME_VERIFY_MACHINE=apple2gsr1 $JOEYLIB/scripts/verify-iigs-game-disk.sh $bin/iigs/bin/STAXI.2mg iigsaudio $JOEYLIB/scripts/verify-iigs-audio.sh $bin/iigs/bin/STAXI x68kaudio $JOEYLIB/scripts/verify-x68000-audio.sh $bin/x68000/bin/STAXI/STAXI.X EOF ) names=$(echo "$GATES" | awk '{ print $1 }' | tr '\n' ' ') for want in "$@"; do case " $names " in *" $want "*) ;; *) echo "verify: unknown gate '$want' (choose from: $names)" >&2; exit 2 ;; esac done selected=${*:-$names} gateNames=() gateVerdicts=() gateSeconds=() passed=0 failed=0 skipped=0 while read -r name cmd; do case " $selected " in *" $name "*) ;; *) continue ;; esac echo echo "=== verify: $name ($cmd) ===" start=$SECONDS ( cd "$repo" && bash -c "$cmd" ) < /dev/null case $? in 0) verdict=PASS; passed=$((passed + 1)) ;; 2) verdict="SKIP (prerequisite missing)"; skipped=$((skipped + 1)) ;; *) verdict=FAIL; failed=$((failed + 1)) ;; esac gateNames+=("$name") gateVerdicts+=("$verdict") gateSeconds+=("$((SECONDS - start))") done <<< "$GATES" echo echo "================ verify summary ================" for i in "${!gateNames[@]}"; do printf " %-10s %-28s %4ds\n" "${gateNames[$i]}" "${gateVerdicts[$i]}" "${gateSeconds[$i]}" done echo " ----" printf " %d passed, %d failed, %d skipped\n" "$passed" "$failed" "$skipped" if [ "$failed" -gt 0 ]; then echo "verify: FAIL" >&2 exit 1 fi if [ "$skipped" -gt 0 ]; then echo "verify: INCOMPLETE - some gates skipped (see above)" >&2 exit 3 fi echo "verify: PASS (all $passed gates)" exit 0