Files
kdm-re/tests/golden/run.sh
T

41 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# T9 golden-I/O replay harness driver. Standalone: pure-Python stdlib, no
# network, no game binary, no top-level CMake. Regenerates fixtures from the
# committed recorded dumps, runs the pass assertion, then runs a perturbed
# reference to prove the assertions can fail (not vacuous).
set -u
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$HERE"
PY="${PYTHON:-python3}"
echo "### 1. regenerate golden fixtures from existing recorded dumps"
"$PY" gen_fixtures.py || exit 2
echo
echo "### 2. golden assertion (expect exit 0, all PASS)"
"$PY" golden_harness.py
pass_rc=$?
echo "pass-mode exit=$pass_rc"
echo
echo "### 3. perturbed reference (expect exit 1, FAILURES) -- misleading-success guard"
fail_total=0
for field in scale m14 box_b_x box_b_z hip_mid; do
echo "--- perturb: $field ---"
"$PY" golden_harness.py --perturb "$field"
rc=$?
echo "perturb[$field] exit=$rc"
if [ "$rc" -eq 0 ]; then
echo "VACUITY VIOLATION: perturb $field did not fail"
fail_total=1
fi
done
echo
if [ "$pass_rc" -eq 0 ] && [ "$fail_total" -eq 0 ]; then
echo "GOLDEN HARNESS OK: clean run passed and every perturbation failed."
exit 0
fi
echo "GOLDEN HARNESS BROKEN."
exit 1