#!/usr/bin/env bash # Fixture coverage for runtime-declared Bevy screenshot dialect verification. set -euo pipefail root=$(cd "$(dirname "$0")/.." && pwd) tmp=$(mktemp -d) trap 'rm -rf "$tmp"' EXIT mkdir -p "$tmp/tools" "$tmp/target/debug" cp "$root/tools/bevy-headless.sh" "$tmp/tools/bevy-headless.sh" cat > "$tmp/target/debug/misaligned-bevy" <<'EOF' #!/usr/bin/env bash set -euo pipefail python3 - "$MISALIGNED_SHOT_PATH" <<'PY' import pathlib, sys path = pathlib.Path(sys.argv[1]) path.parent.mkdir(parents=True, exist_ok=True) path.write_bytes(b"\x89PNG\r\n\x1a\nfixture") PY case "$MISALIGNED_SHOT" in digital-fixture) echo "bevy shot ready: kind=digital-fixture dialect=DIGITAL" ;; real-fixture) echo "fog audit OK: fixture" echo "bevy shot ready: kind=real-fixture dialect=REAL" ;; real-without-fog) echo "bevy shot ready: kind=real-without-fog dialect=REAL" ;; missing-dialect) echo "screenshot saved without a dialect declaration" ;; esac EOF chmod +x "$tmp/target/debug/misaligned-bevy" run() { (cd "$tmp" && bash tools/bevy-headless.sh "$@" --no-build --timeout 5) } digital_log="$tmp/digital.log" run digital-fixture --output "$tmp/digital.png" > "$digital_log" grep -q 'bevy evidence: OK shot=digital-fixture dialect=digital' "$digital_log" || { echo "FAIL: DIGITAL evidence was not accepted without a material fog audit" >&2 exit 1 } real_log="$tmp/real.log" run real-fixture --output "$tmp/real.png" > "$real_log" grep -q 'bevy evidence: OK shot=real-fixture dialect=real' "$real_log" || { echo "FAIL: REAL evidence with a fog audit was not accepted" >&2 exit 1 } if run real-without-fog --output "$tmp/no-fog.png" > "$tmp/no-fog.log" 2>&1; then echo "FAIL: REAL evidence passed without its material fog audit" >&2 exit 1 fi grep -q 'did not report fog audit OK' "$tmp/no-fog.log" || { echo "FAIL: missing REAL fog audit failed without the exact reason" >&2 exit 1 } if run missing-dialect --output "$tmp/no-dialect.png" > "$tmp/no-dialect.log" 2>&1; then echo "FAIL: evidence passed without a runtime dialect declaration" >&2 exit 1 fi grep -q 'did not report one valid staged dialect' "$tmp/no-dialect.log" || { echo "FAIL: missing dialect failed without the exact reason" >&2 exit 1 } echo "bevy-headless fixtures: OK"