#!/usr/bin/env bash # SPDX-License-Identifier: MIT # The gate (charter: x-python -> x-rust): every rung, in order, stopping at the first failure. # # scripts/ladder.sh [--quick] # # 1. cargo test (the reference's unit tests, transcribed, with the save-anywhere tests) # 2. Acid5200 natively: 46 of 48, the two misses the reference has (gtia_vdelay, pokey_twotone) # 3. lockstep against the reference, per frame (every bus cycle, the picture), reference traces # cached in external/refcache: cases.tsv (both BIOS rows, every cartridge class, trak-ball # and keypad scripts), cases-acid.tsv (the 48 standalone tests and the suite ROM), # cases-smoke.tsv (the reference's smoke list), cases-midframe.tsv (mid-frame save states: # the reference test's synthetic case at each of its save points, four titles with every # save point in turn) # 4. the first three tables with --save-at-half (save at a frame boundary, load into a fresh # console, go on: identical) # 5. the same with --save-mid-half cycle-12345 (the save inside the half-way frame) # 6. audio (the AudioTap's samples per frame): cases.tsv plain and --save-at-half, and # cases-midframe.tsv # --quick: cases.tsv and cases-midframe.tsv only in 3-6. # # Needs: the reference clone at external/a5200-python (84225d9: cf82d44's board, its cores # repinned), the .venv-pypy of an a5200-python checkout beside this repository, # NO_INTRO_DIR and MAME_ROMPATH (run under a login shell), the Acid5200 ROMs (ACID5200_DIR or # the reference checkout's tests/test_roms). At most 3 processes, niced; every run timed out. set -euo pipefail cd "$(dirname "$0")/.." tables=(scripts/cases.tsv scripts/cases-acid.tsv scripts/cases-smoke.tsv) if [[ "${1:-}" == "--quick" ]]; then tables=(scripts/cases.tsv) fi cases=() for t in "${tables[@]}"; do cases+=(--cases "$t"); done lockstep() { timeout 14400 python3 scripts/lockstep.py --reference-cache external/refcache --jobs 3 "$@"; } reference_python="${A5200_REFERENCE_PYTHON:-$(cd .. && pwd)/a5200-python/.venv-pypy/bin/python}" echo "== 1. cargo test" timeout 1800 nice -n 19 cargo test --release -q 2>&1 | grep -E "test result|FAILED|panicked" || true timeout 1800 nice -n 19 cargo test --release -q >/dev/null 2>&1 echo "== 2. Acid5200 natively" timeout 1800 nice -n 19 cargo build --release -q acid=$(timeout 1800 nice -n 19 target/release/a5200-acid || true) echo "$acid" | grep -E "fail|timeout|jam|pass$" || true fails=$(echo "$acid" | grep -E ": (fail|timeout|jam|skipped)" | cut -d: -f1 | tr '\n' ' ') if [[ "$fails" != "gtia_vdelay pokey_twotone " ]]; then echo "Acid5200: unexpected misses: $fails"; exit 1 fi echo "== 3. lockstep" root=$PWD (cd / && PYPY_GC_NURSERY=1M timeout 300 nice -n 19 "$reference_python" "$root/scripts/busy_case.py") lockstep "${cases[@]}" --cases scripts/cases-midframe.tsv echo "== 4. lockstep, save at half" lockstep "${cases[@]}" --save-at-half echo "== 5. lockstep, save inside the half-way frame" lockstep "${cases[@]}" --save-mid-half cycle-12345 echo "== 6. lockstep with audio" lockstep --cases scripts/cases.tsv --extra=--audio lockstep --cases scripts/cases.tsv --extra=--audio --save-at-half lockstep --cases scripts/cases-midframe.tsv --extra=--audio echo "== the ladder passes"