interplane.Get Omega
Read in your language

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

branch main Branches Tags History

aien-sovereign-core-mv / tests / turing-network / check.sh

40 lines · 1862 bytes Raw Blame History
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
4set -u
5here=$(cd "$(dirname "$0")" && pwd)
6src="$here/tur_r0_oracle.om"
7: "${OMC:?set OMC to a seed-born omc}"
8b=$(mktemp -d); trap 'rm -rf "$b"' EXIT
9fails=0
10
11run() { # 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
17mutant() { # 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
23echo "omc $(sha256sum "$OMC" | cut -c1-64)"
24echo "src $(sha256sum "$src" | cut -c1-64)"
25run oracle "$src" 0 "TUR_R0_ORACLE_PASS"
26# expected provider balance changed 27 -> 28 (README negative control)
27mutant 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
29mutant no-overdraft-guard 1 '21,23d'
30# single-reservation guard removed: a second reservation must now be caught
31mutant no-phase-guard 6 '18,20d'
32# job-id guard removed: settling against job 8 must now be caught
33mutant no-jobid-guard 7 '35,37d'
34# replay guard removed: a zero-amount second settlement must now be caught
35mutant no-replay-guard 20 '32,34d'
36# change-must-match guard removed: wrong refund must now be caught
37mutant no-refund-guard 8 '46,48d'
38
39[ "$fails" = 0 ] && echo "TUR_R0 gate: PASS" || echo "TUR_R0 gate: FAIL ($fails)"
40[ "$fails" = 0 ]