#!/bin/bash # Measure the cost of a row-linear literal span on the 68000 (FINDINGS 30). # ~45 s. Run from the repo root. Needs tmp/frame256.bin (check.sh makes it). # # NOT part of check.sh, for the same reason blit.s is not: the output is a wall # timing, so gating on it would make the green light host-sensitive. What IS # gated here is correctness -- all 23 configs must draw a pixel-exact frame, # which is what stops a config timing fast by quietly writing nothing. set -e cd "$(dirname "$0")/../.." [ -f tmp/frame256.bin ] || { echo "need tmp/frame256.bin -- run tools/bench/check.sh"; exit 2; } python3 tools/bench/prep_spans.py tools/vasm/vasmm68k_mot -Fbin -o tmp/blit.bin tools/bench/blit.s > /dev/null mkdir -p tmp/snap_span rm -f tmp/snap_span/x68000/*.png ( cd tmp && SDL_VIDEODRIVER=dummy stdbuf -oL timeout -k 5 1800 mame x68000 -bios ipl10 \ -ramsize 2M -video soft -window -sound none -nothrottle -plugins \ -autoboot_script ../tools/bench/span.lua \ -snapshot_directory ./snap_span -snapview native -seconds_to_run 200 \ > span.log 2>&1 ) grep -a "^\[SPAN\]" tmp/span.log # One snapshot per config, and the expected count comes from the generated # metadata rather than a literal: adding a config must not silently weaken the # assertion that every one of them drew the picture. want=$(grep -c '{var=' tmp/spans_meta.lua) n=0 for f in tmp/snap_span/x68000/*.png; do python3 tools/bench/verify_frame256.py "$f" > /dev/null || { echo "FAIL: $f is not pixel-exact"; python3 tools/bench/verify_frame256.py "$f"; exit 1; } n=$((n+1)) done [ "$n" -eq "$want" ] || { echo "FAIL: $n snapshots, expected $want"; exit 1; } echo "OK $n/$want span configs drew a pixel-exact frame"