Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/tools/test_gate_physics_pin.sh # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tools / test_gate_physics_pin.sh` 64 lines ยท 2412 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # tools/test_gate_physics_pin.sh -- host self-test (omega#523, omega#508). 3 # 4 # Every tests/gates/run.sh step that builds against physics must take the physics commit 5 # from physics.lock, and every gate that runs such a step must list physics.lock as an input. 6 # Why: the Makefile's check-physics-lock refuses any physics checkout other than the lock, so 7 # a literal commit in run.sh turns every chip gate red on the next lock bump (it did for 8 # `e95e3ed` -> `6d7cf0d4` in #508), and a gate that does not list physics.lock is never selected 9 # by a lock-only bump, so the bump is judged without the gates it changes. 10 # 11 # Exit 0 when both hold, 1 with one line per violation otherwise. No GPU, no network. 12 set -euo pipefail 13 ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)" 14 RUN="$ROOT/tests/gates/run.sh" 15 fail=0 16 17 # 1. No literal physics commit on a pin line. 18 if grep -nE '^[^#]*pin[[:space:]]+physics-src[^[:space:]]*[[:space:]]+physics[[:space:]]+[0-9a-f]{7,40}' "$RUN"; then 19 echo "FAIL literal physics commit in tests/gates/run.sh (take it from physics.lock: physics_pin)" 20 fail=1 21 fi 22 23 # 2. The run.sh case labels whose block calls physics_pin (or pins physics by hand). 24 labels="$(awk ' 25 /^ [^ #][^)]*\)/ && $0 !~ /^ *\(/ { lab=$0; sub(/^ /,"",lab); sub(/\).*/,"",lab) } 26 /physics_pin|pin[ \t]+physics-src/ && lab != "" { print lab; lab="" } 27 ' "$RUN")" 28 if [ -z "$labels" ]; then 29 echo "FAIL found no run.sh step that pins physics (parser out of date?)" 30 exit 1 31 fi 32 33 step_pins_physics() { 34 local step="$1" lab pat 35 while IFS= read -r lab; do 36 IFS='|' read -r -a pats <<<"$lab" 37 for pat in "${pats[@]}"; do 38 # shellcheck disable=SC2254 39 case "$step" in $pat) return 0 ;; esac 40 done 41 done <<<"$labels" 42 return 1 43 } 44 45 checked=0 46 for g in "$ROOT"/tests/gates/*.gate; do 47 step="$(sed -n 's/^[[:space:]]*args:[[:space:]]*\["\([^"]*\)".*/\1/p' "$g" | head -n 1)" 48 [ -n "$step" ] || continue 49 step_pins_physics "$step" || continue 50 checked=$((checked + 1)) 51 if ! grep -qx ' - physics.lock' "$g"; then 52 echo "FAIL $(basename "$g") runs step '$step', which builds against physics, but does not list physics.lock in inputs" 53 fail=1 54 fi 55 done 56 57 if [ "$checked" -eq 0 ]; then 58 echo "FAIL no gate runs a physics-pinning step (parser out of date?)" 59 exit 1 60 fi 61 if [ "$fail" -eq 0 ]; then 62 echo "OMEGA_GATE_PHYSICS_PIN_PASS gates_checked=$checked" 63 fi 64 exit "$fail"