#!/usr/bin/env bash # The fork's gate: every change must leave this APU identical to gb-apu-rust, which is # identical to gb-apu-python at b8cab61. Run on every kept commit. # # 1. cargo test --features serde: rung 1 (tests/apu.rs), rung 3 (the 94 board streams) and the # streams again through a save state half way # 2. rung 2, the register-stream lockstep against gb-apu-python's traces (external/lockstep, # copied from gb-apu-rust's: seed 1 64x2500 and seed 2 32x6000 per row) # The board gate (gameboy-rust-fast's scripts/ladder.sh) runs with this crate too. set -uo pipefail ROOT=$(cd "$(dirname "$0")/.." && pwd) cd "$ROOT" fail() { echo "LADDER FAILED: $*"; exit 1; } out=$(cargo test --release -q --features serde 2>&1) echo "$out" | grep -qE "FAILED|panicked" && fail "cargo test: $(echo "$out" | grep -E 'FAILED|panicked' | head -3)" echo "cargo test: $(echo "$out" | grep -oE '[0-9]+ passed' | awk '{n+=$1} END{print n}') pass" REUSE=1 scripts/rung2.sh 64 1 2500 | tail -1 | grep -q PASS || fail "rung 2 seed 1" echo "rung 2 seed 1 (192 scripts): identical" REUSE=1 scripts/rung2.sh 32 2 6000 | tail -1 | grep -q PASS || fail "rung 2 seed 2" echo "rung 2 seed 2 (96 scripts): identical" echo "LADDER PASSES"