#!/usr/bin/env bash # SPDX-License-Identifier: MIT # The single gate (family charter: scripts/ladder.sh in the Rust tiers): every rung in # order, stopping at the first that fails. # # scripts/ladder.sh fmt, clippy, tests, lockstep, save-at-half (about 5 # minutes with the reference's traces cached; the first run # fills external/refcache, about 45 minutes at 3 jobs) # FAULTS=1 scripts/ladder.sh and the seeded faults (about 50 minutes more) # # The lockstep needs the reference (external/venv with lynx-python af8b8ba, 75b9be7's board, see # docs/status.md "Setting up the reference"), the boot ROM ($MAME_ROMPATH/lynx.zip), the # No-Intro Lynx sets ($NO_INTRO_DIR) and the lynx-tests ROMs lynx-python built ($LTB, # default ../lynx-python/tests/test_roms/build). Run in a login shell for the variables. # fmt and clippy run from the rustup stable toolchain when it is present (CI's is newer). set -euo pipefail ROOT=$(cd "$(dirname "$0")/.." && pwd) JOBS=${JOBS:-3} STABLE=${STABLE:-"$HOME/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin"} if [ -x "$STABLE/cargo-clippy" ]; then PATH="$STABLE:$PATH" cargo fmt --check --manifest-path "$ROOT/Cargo.toml" PATH="$STABLE:$PATH" nice -n 19 cargo clippy -q --release --all-targets --manifest-path "$ROOT/Cargo.toml" -- -D warnings else cargo fmt --check --manifest-path "$ROOT/Cargo.toml" nice -n 19 cargo clippy -q --release --all-targets --manifest-path "$ROOT/Cargo.toml" -- -D warnings fi echo "fmt and clippy: clean" nice -n 19 cargo test --release -q --manifest-path "$ROOT/Cargo.toml" > /dev/null echo "cargo test: passed" echo "== lockstep" python3 "$ROOT/scripts/lockstep.py" --jobs "$JOBS" --reference-cache "$ROOT/external/refcache" | tail -3 echo "== lockstep, save at half" python3 "$ROOT/scripts/lockstep.py" --jobs "$JOBS" --reference-cache "$ROOT/external/refcache" --save-at-half | tail -3 if [ "${FAULTS:-0}" = 1 ]; then echo "== seeded faults" python3 "$ROOT/scripts/seeded_faults.py" --jobs "$JOBS" | tail -8 fi echo "ladder: passed"