aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / tests / turing-network / check.sh
| 1 | #!/bin/sh |
| 2 | # TUR-R0 gate: build and run the oracle, then require each mutant to fail with its intended exit code. |
| 3 | # Usage: OMC=/path/to/seed/out/omc sh tests/turing-network/check.sh |
| 4 | set -u |
| 5 | here=$(cd "$(dirname "$0")" && pwd) |
| 6 | src="$here/tur_r0_oracle.om" |
| 7 | : "${OMC:?set OMC to a seed-born omc}" |
| 8 | b=$(mktemp -d); trap 'rm -rf "$b"' EXIT |
| 9 | fails=0 |
| 10 | |
| 11 | run() { # name source-file expected-rc expected-stdout |
| 12 | if ! "$OMC" < "$2" > "$b/$1" 2> "$b/$1.err"; then echo "FAIL $1: compile: $(cat "$b/$1.err")"; fails=$((fails + 1)); return; fi |
| 13 | chmod 700 "$b/$1"; out=$("$b/$1"); rc=$? |
| 14 | if [ "$rc" = "$3" ] && [ "$out" = "$4" ]; then echo "PASS $1 (exit $rc)"; else echo "FAIL $1: exit $rc stdout '$out', wanted exit $3 stdout '$4'"; fails=$((fails + 1)); fi |
| 15 | } |
| 16 | |
| 17 | mutant() { # name expected-rc sed-expression |
| 18 | sed "$3" "$src" > "$b/$1.om" |
| 19 | if cmp -s "$src" "$b/$1.om"; then echo "FAIL $1: mutation did not apply"; fails=$((fails + 1)); return; fi |
| 20 | run "$1" "$b/$1.om" "$2" "" |
| 21 | } |
| 22 | |
| 23 | echo "omc $(sha256sum "$OMC" | cut -c1-64)" |
| 24 | echo "src $(sha256sum "$src" | cut -c1-64)" |
| 25 | run oracle "$src" 0 "TUR_R0_ORACLE_PASS" |
| 26 | # expected provider balance changed 27 -> 28 (README negative control) |
| 27 | mutant assert-provider 14 's/^if ne get bal 1 27$/if ne get bal 1 28/' |
| 28 | # overdraft guard removed: reserving 101 out of 100 must now be caught |
| 29 | mutant no-overdraft-guard 1 '21,23d' |
| 30 | # single-reservation guard removed: a second reservation must now be caught |
| 31 | mutant no-phase-guard 6 '18,20d' |
| 32 | # job-id guard removed: settling against job 8 must now be caught |
| 33 | mutant no-jobid-guard 7 '35,37d' |
| 34 | # replay guard removed: a zero-amount second settlement must now be caught |
| 35 | mutant no-replay-guard 20 '32,34d' |
| 36 | # change-must-match guard removed: wrong refund must now be caught |
| 37 | mutant no-refund-guard 8 '46,48d' |
| 38 | |
| 39 | [ "$fails" = 0 ] && echo "TUR_R0 gate: PASS" || echo "TUR_R0 gate: FAIL ($fails)" |
| 40 | [ "$fails" = 0 ] |