# SPDX-License-Identifier: MIT # Where the reference and its data are: sourced by every rung script. # # W65C816_PYTHON the 65816-python checkout (default: ../65816-python beside # this repository). Its reference/ holds the fetched corpus and # test ROMs (its scripts/fetch_references.py), its # tests/mame_traces/ the MAME traces (its scripts/mame_trace.py). # W65C816_PYTHON_PIN the commit it must be at: the rungs refuse to judge against # another revision unless ALLOW_OTHER_PIN=1. # REFERENCE_PYTHON its interpreter (default: its own .venv-pypy, with 6502-python # at the pin its pyproject.toml names). # SST_65816 the SingleStepTests 65816 files (default: its reference/src/65816/v1). # CPUTEST gilyon's cputest ROMs (default: its reference/roms/snes-tests-v1.4/cputest). # KROM krom's CPU tests (default: its reference/src/PeterLemon-SNES/CPUTest/CPU). # MAME_TRACES the rung 4 replays' traces (default: its tests/mame_traces). # REFERENCE_CACHE the reference's lockstep results, one directory per pin. ROOT=${ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)} W65C816_PYTHON=${W65C816_PYTHON:-"$ROOT/../65816-python"} W65C816_PYTHON_PIN=${W65C816_PYTHON_PIN:-71092a45e2f48136eb3d373b82454f398afc44f1} REFERENCE_PYTHON=${REFERENCE_PYTHON:-"$W65C816_PYTHON/.venv-pypy/bin/python"} SST_65816=${SST_65816:-"$W65C816_PYTHON/reference/src/65816/v1"} CPUTEST=${CPUTEST:-"$W65C816_PYTHON/reference/roms/snes-tests-v1.4/cputest"} KROM=${KROM:-"$W65C816_PYTHON/reference/src/PeterLemon-SNES/CPUTest/CPU"} MAME_TRACES=${MAME_TRACES:-"$W65C816_PYTHON/tests/mame_traces"} REFERENCE_CACHE=${REFERENCE_CACHE:-"$ROOT/external/reference-cache/${W65C816_PYTHON_PIN:0:7}"} export ROOT W65C816_PYTHON REFERENCE_PYTHON SST_65816 CPUTEST KROM MAME_TRACES REFERENCE_CACHE export PYPY_GC_NURSERY=${PYPY_GC_NURSERY:-1M} # The reference must be at its pin, with a clean tree, for a lockstep verdict to mean anything. require_reference() { if [ ! -x "$REFERENCE_PYTHON" ]; then echo "no reference interpreter at $REFERENCE_PYTHON: set W65C816_PYTHON or REFERENCE_PYTHON" >&2 exit 2 fi local head head=$(git -C "$W65C816_PYTHON" rev-parse HEAD 2>/dev/null || echo unknown) if [ "$head" != "$W65C816_PYTHON_PIN" ] || [ -n "$(git -C "$W65C816_PYTHON" status --porcelain -- src 2>/dev/null)" ]; then if [ "${ALLOW_OTHER_PIN:-0}" != 1 ]; then echo "65816-python is at $head (or its src/ is modified); the pin is $W65C816_PYTHON_PIN" >&2 exit 2 fi echo "warning: judging against 65816-python $head, not the pin" >&2 fi }