#!/usr/bin/env bash # SPDX-License-Identifier: MIT # Rung 4 (the reference's): seven commercial games replayed against MAME 0.285's # traces (src/bin/mame_replay.rs, the reference's tests/mame_replay.py): no # register divergence, no unexplained clock difference, and every game's whole # summary equal to the reference's (conformance/expected/mame/, from # scripts/reference_mame.py). The traces are the reference's ($MAME_TRACES, # made by its scripts/mame_trace.py --io; never committed). set -euo pipefail source "$(dirname "$0")/env.sh" nice -n 19 cargo build --release -q --manifest-path "$ROOT/Cargo.toml" failed=0 games=0 for expected in "$ROOT"/conformance/expected/mame/*.txt; do game=$(basename "$expected" .txt) games=$((games + 1)) if [ ! -f "$MAME_TRACES/$game/error.log" ]; then echo "$game: no trace in \$MAME_TRACES (the reference's scripts/mame_trace.py --io makes it)" failed=1 continue fi if nice -n 19 "$ROOT/target/release/mame_replay" "$MAME_TRACES/$game" | diff - "$expected"; then echo "$game: $(grep '^instructions' "$expected" | cut -d';' -f1), summary identical" else echo "$game: FAILED (the summary differs from the reference's, above)" failed=1 fi done if [ "$failed" != 0 ]; then echo "rung 4: FAILED" exit 1 fi echo "rung 4: passed, $games of $games games, every summary the reference's"