#!/usr/bin/env bash # SPDX-License-Identifier: MIT # Rungs 2 and 3 (the reference's): gilyon's spctest (three programs, 1,368 tests) and # PeterLemon's seven CPU tests, raw and as snapshots (162 sub-tests each form), natively # in the harness (src/bin/programs.rs: the reference's run_spctest and run_cpu_test): # every run passes, and every line (tests, cycles, instructions, the $F4 codes) equals # the reference's (conformance/expected/programs.txt, from scripts/reference_programs.py). set -euo pipefail source "$(dirname "$0")/env.sh" nice -n 19 cargo build --release -q --manifest-path "$ROOT/Cargo.toml" mkdir -p "$ROOT/external" out="$ROOT/external/rung2-programs.txt" status=0 nice -n 19 "$ROOT/target/release/programs" "$SPCTEST" "$CPUTEST" > "$out" || status=$? cut -c1-150 "$out" if [ "$status" != 0 ]; then echo "rungs 2-3: FAILED (a program did not pass)" exit 1 fi if diff "$out" "$ROOT/conformance/expected/programs.txt"; then echo "rung 2: passed, spctest's 1,368 tests in order, the reference's cycles and instructions" echo "rung 3: passed, PeterLemon's 162 sub-tests in both forms, every line the reference's" else echo "rungs 2-3: FAILED (the lines differ from the reference's, above)" exit 1 fi