#!/bin/bash # SPDX-License-Identifier: MIT # The gate (docs/status.md): every rung in order; stops at the first that fails. # # scripts/ladder.sh rungs 0-4, rung 1 cut to 300 frames a case # FULL=1 scripts/ladder.sh rung 1 at full length (megadrive-rust's 87 cases, ~120,000 frames x3) # FAULTS=1 scripts/ladder.sh and rung 5, the seeded faults (heavy: an hour or more) # # sega32x-rust-fast: judged against sega32x-rust. Rung 3 compares with sega32x-python's # cached traces (copied with the fork; the reference is never run unless PY=1) and, rung # 3b, the benchmark's workloads with upstream's own board at the fork point (external/base). # # Found through the environment, never a machine path here: SEGA32X_BIOS_DIR (the user's # boot ROMs), NO_INTRO_DIR (the 32X and Mega Drive sets), TEST_ROMS, EXTRA_ROMS, # TITAN_DEMOS (megadrive-rust's cases), SEGA32X_PY (the reference's interpreter). # CPUS (default 24-27) is where the builds and runs go; JOBS (default 4) how many at once. set -eu # A rung's failure must stop the ladder through `| tail -1` (upstream's lacks this: a # failing rung there prints its count and the ladder goes on to "ladder passed"). set -o pipefail ROOT=$(cd "$(dirname "$0")/.." && pwd) cd "$ROOT" : "${SEGA32X_BIOS_DIR:?the user\'s 32X boot ROMs}" "${NO_INTRO_DIR:?the No-Intro sets}" export PYPY_GC_NURSERY=1M CPUS=${CPUS:-24-27} JOBS=${JOBS:-4} on() { nice taskset -c "$CPUS" "$@"; } echo "== rung 0: the dependencies at their revisions, the builds, cargo test (rung 2's unit vectors)" scripts/external.sh --check (cd external/megadrive-rust && on cargo build --release --offline --quiet -j "$JOBS" --bin md-trace) (cd external/megadrive-rust-fast && on cargo build --release --offline --quiet -j "$JOBS" --bin md-trace) (cd external/base && on cargo build --release --offline --quiet -j "$JOBS") on cargo build --release --offline --quiet -j "$JOBS" on cargo test --release --offline --quiet -j "$JOBS" 2>&1 | grep -E "test result|FAILED|panicked" || true on cargo test --release --offline --quiet -j "$JOBS" > /dev/null echo "== rung 1: ADEN = 0, megadrive-rust's cases through a passive 32X${FULL:+ (full length)}" on python3 scripts/passive.py --jobs "$JOBS" ${FULL:+--full} | tail -1 echo "== rung 3: the whole-machine lockstep against sega32x-python's cached traces" on python3 scripts/lockstep.py --jobs "$JOBS" ${PY:+--python-ok} | tail -1 echo "== rung 3b: the benchmark's workloads against sega32x-rust at the fork point" on python3 scripts/lockstep.py --jobs "$JOBS" --against-base --cases scripts/speed-cases.tsv | tail -1 echo "== rung 4: save states" on python3 scripts/state_rung.py --jobs "$JOBS" | tail -1 if [ -n "${FAULTS:-}" ]; then echo "== rung 5: seeded faults" on python3 scripts/seeded_faults.py --jobs "${FAULT_JOBS:-3}" | tail -1 fi echo "ladder passed"