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/seed/omc/gate-objhost.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 / seed / omc / gate-objhost.sh` 54 lines ยท 3198 bytes Raw Blame History 1 #!/bin/sh 2 # gate-objhost.sh [OMC] -- host effects in native objects (DRA-542; spec/omegese-modules.md, OMEGESE "Native object output"). 3 # Python is an independent test oracle (seed/omc/tests/objhost/check.py), not a build dependency. 4 # 1. OMC (default seed/out/omc) passes check.py: the object host subset compiles to function-mode code, the 5 # rest still refuses, stack records cover host pushes, a linked two-module program does real I/O and 6 # matches a single-unit build, and the module driver refuses a chain over 8 MiB only through a push. 7 # 2. Controls, each built by OMC from a one-line change of seed/omc/omc.om and required to FAIL check.py 8 # with its named contract: 9 # record the object stack record drops the transient pushes (osmax), the under-report this gate exists for; 10 # device the device words are let into objects; 11 # count spsub stops counting, so pushes are never charged. 12 # 3. CTRL (environment, optional): an older compiler that refuses host words in objects must FAIL check.py. 13 set -eu 14 R=$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd) 15 cd "$R" 16 S=${1:-seed/out/omc} 17 case "$S" in /*) ;; *) S="$R/$S";; esac 18 test -x "$S" 19 T=$(mktemp -d) 20 trap 'rm -rf "$T"' EXIT HUP INT TERM 21 python3 seed/omc/tests/objhost/check.py "$S" "$T/main" 22 echo "PASS objhost check $(sha256sum "$S" | cut -d' ' -f1)" 23 for mode in record device count; do 24 python3 - "$mode" "$T/$mode.om" <<'PY' 25 from pathlib import Path 26 import sys 27 s = Path("seed/omc/omc.om").read_text() 28 old, new = { 29 "record": ("a_p 86 sub get curfn 0 1 add get stkbytes 0 get osmax 0", "a_p 86 sub get curfn 0 1 get stkbytes 0"), 30 "device": ("\nif and ne get objmode 0 0 and ge c 166 le c 177\nnote d2site 174", "\nif and ne get objmode 0 0 and ge c 166 le c 99\nnote d2site 174"), 31 "count": ("put osp 0 add get osp 0 bytes\n", "put osp 0 get osp 0\n"), 32 }[sys.argv[1]] 33 assert s.count(old) == 1, sys.argv[1] 34 Path(sys.argv[2]).write_text(s.replace(old, new)) 35 PY 36 "$S" < "$T/$mode.om" > "$T/$mode" 37 chmod +x "$T/$mode" 38 rc=0 39 python3 seed/omc/tests/objhost/check.py "$T/$mode" "$T/out-$mode" > "$T/$mode.log" 2>&1 || rc=$? 40 # record: the fopen record drops below 4112; device: mapdrop compiles; count: every save area pops 41 # past a zero count, so osbad refuses the first object function that calls a host word (finish, error 9). 42 want=$(case $mode in record) echo object-host-stack-record;; device) echo 'mapdrop';; count) echo 'error 9';; esac) 43 test "$rc" = 1 || { tail -5 "$T/$mode.log"; echo "FAIL objhost mutant $mode status=$rc"; exit 1; } 44 grep -q -e "$want" "$T/$mode.log" || { tail -5 "$T/$mode.log"; echo "FAIL objhost mutant $mode: wrong failure"; exit 1; } 45 echo "PASS objhost compiler mutant $mode caught" 46 done 47 if [ -n "${CTRL:-}" ]; then 48 rc=0 49 python3 seed/omc/tests/objhost/check.py "$CTRL" "$T/ctrl" > "$T/ctrl.log" 2>&1 || rc=$? 50 test "$rc" = 1 || { echo "FAIL objhost control $CTRL status=$rc"; exit 1; } 51 grep -q 'object-code-equals-function-mode\|AssertionError' "$T/ctrl.log" || { tail -5 "$T/ctrl.log"; exit 1; } 52 echo "PASS objhost control refused by older compiler $(sha256sum "$CTRL" | cut -d' ' -f1)" 53 fi 54 echo "OBJHOSTGATE PASS mutants=3"