#!/usr/bin/env bash # SPDX-License-Identifier: MIT # Rung 1: pokey-python's tests/, transcribed (tests/registers.rs, timers.rs, output.rs, # irq.rs, pots.rs, keyboard.rs, serial.rs, acidsap.rs). All 125 of the reference's pytest # cases but one (the PyPy attribute guard) are covered; a parametrized Python test is one # Rust test looping over its parameters. AcidSAP must actually run here: ACIDSAP_DIR must # hold the built tests (scripts/env.sh points it at the reference's fetched copy). # CARGO_TARGET_DIR / the copy's directory: scripts/seeded_faults.py runs this on a faulty copy. set -euo pipefail source "$(dirname "$0")/env.sh" CRATE=${CRATE:-$ROOT} [ -f "$ACIDSAP_DIR/pokey_default.sap" ] || { echo "rung 1: no AcidSAP at $ACIDSAP_DIR (set ACIDSAP_DIR)" >&2; exit 2; } cd "$CRATE" total=0; status=0 for t in registers timers output irq pots keyboard serial acidsap; do if out=$(timeout 900 nice -n 19 cargo test --release -q --test "$t" 2>&1); then n=$(echo "$out" | grep -oE '[0-9]+ passed' | tail -1 | grep -oE '[0-9]+') echo "tests/$t.rs: $n passed" total=$((total + n)) else echo "$out" | grep -E "^test .* FAILED|panicked" | head -5 echo "tests/$t.rs: FAILED" status=1 fi done if [ $status = 0 ]; then echo "rung 1: PASS ($total Rust tests: 124 of the reference's 125 pytest cases)" else echo "rung 1: FAIL" exit 1 fi