# SPDX-License-Identifier: MIT # Where the reference is: sourced by every rung script. # # POKEY_PYTHON the pokey-python checkout (default: ../pokey-python beside this # repository, or external/pokey-python from scripts/fetch_pokeypython.sh) # POKEY_PYTHON_PIN the commit whose src/, tests/, scripts/ and validation/ it must have # (6ed1ffa...): the rungs refuse to judge against anything else unless # ALLOW_OTHER_PIN=1. A checkout at a later commit that changes only # documents (34a541c) passes the check. # REFERENCE_PYTHON its interpreter (default: its own .venv-pypy, else PyPy or python3) # ACIDSAP_DIR the built AcidSAP standalone tests (default: the reference's fetched # reference/acid800/out/Release/AcidSAP/standalone); read by tests/acidsap.rs # JOBS parallel processes (default 3: the machine is shared) ROOT=${ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)} if [ -z "${POKEY_PYTHON:-}" ]; then if [ -d "$ROOT/external/pokey-python/.git" ]; then POKEY_PYTHON="$ROOT/external/pokey-python" else POKEY_PYTHON="$ROOT/../pokey-python" fi fi POKEY_PYTHON_PIN=${POKEY_PYTHON_PIN:-6ed1ffa73220a967cb2add7e978eabfe11502af0} if [ -z "${REFERENCE_PYTHON:-}" ]; then for candidate in "$POKEY_PYTHON/.venv-pypy/bin/python" "$(command -v pypy3 || true)" "$(command -v python3)"; do [ -n "$candidate" ] && [ -x "$candidate" ] && { REFERENCE_PYTHON=$candidate; break; } done fi ACIDSAP_DIR=${ACIDSAP_DIR:-"$POKEY_PYTHON/reference/acid800/out/Release/AcidSAP/standalone"} JOBS=${JOBS:-3} export ROOT POKEY_PYTHON REFERENCE_PYTHON ACIDSAP_DIR JOBS export PYPY_GC_NURSERY=${PYPY_GC_NURSERY:-1M} # The reference must have the pin's sources, with a clean tree, for a verdict to mean anything. require_reference() { if [ ! -f "$POKEY_PYTHON/src/pokey_python/chip.py" ] || [ ! -x "$REFERENCE_PYTHON" ]; then echo "no reference at $POKEY_PYTHON (or no interpreter): set POKEY_PYTHON or run scripts/fetch_pokeypython.sh" >&2 exit 2 fi local pin pin=$(git -C "$POKEY_PYTHON" rev-parse --verify -q "$POKEY_PYTHON_PIN^{commit}" 2>/dev/null || true) if [ -z "$pin" ] \ || ! git -C "$POKEY_PYTHON" diff --quiet "$pin" -- src tests scripts validation 2>/dev/null \ || [ -n "$(git -C "$POKEY_PYTHON" status --porcelain -- src tests scripts validation 2>/dev/null)" ]; then if [ "${ALLOW_OTHER_PIN:-0}" != 1 ]; then echo "pokey-python at $POKEY_PYTHON does not have the sources of $POKEY_PYTHON_PIN (or they are modified)" >&2 exit 2 fi echo "warning: judging against pokey-python $(git -C "$POKEY_PYTHON" rev-parse --short HEAD), not the pin" >&2 fi }