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/tests/runtime/rx_operator_host.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 / tests / runtime / rx_operator_host.sh` 577 lines · 33005 bytes Raw Blame History 1 #!/bin/bash 2 # SPDX-License-Identifier: Apache-2.0 3 # Copyright 2026 Drake Stapleton (AIEN / aien-dev) 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # R16 G6 operator control by execution (docs/r16-operator-control.md §7). 18 # 19 # rx_operator_host.sh 20 # 21 # Starts the PRODUCTION R13 program (built without AIEN_TEST_BUILD) and drives 22 # it only from outside: the rx_operator client over the owner-only socket, and 23 # signals. Every check reads a reply, a file the world wrote in its state 24 # directory, the program's exit status or the program's crumb-log audit line. 25 # A case that cannot run here prints SKIPPED with its reason and the gate line 26 # is NOT_RUN, never a pass. Silicon: the program is never killed (no SIGKILL 27 # phase; on a failed check the world is resumed and the program is waited for). 28 # 29 # Host only, deterministic holds: the first program start of the control phase 30 # runs under gdb in non-stop mode (only the thread at a breakpoint pauses; the 31 # operator socket keeps serving). Three temporary breakpoints hold one point 32 # each until the test has sent its request, then the test resumes the thread: 33 # 1 rx_resident_accept the seat acceptor holding a computed seat result 34 # (an activation in flight): the stop must cancel it 35 # 2 rx_world_verify_crumbs the positive episode's work is done, its world is 36 # not yet torn down: a stop here must keep it up 37 # 3 rx_operator_open (2nd) the next world's open, after the positive world's 38 # entry point closed: what close removed is visible 39 # Without gdb those checks are SKIPPED (gate NOT_RUN). Silicon runs without 40 # gdb: its in-flight count is reported, not checked. 41 # 42 # Environment: RX_OP_PHASES (default "startup control restart kill") runs a 43 # subset (mutants); RX_OP_FAILFAST=1 stops at the first failed check (host); 44 # RX_OP_OUT (default build/r16-operator) receives the receipt and the logs of 45 # a failed run. 46 set -u 47 SEAT=${1:?host or silicon}; BIN=${2:?binary}; CLI=${3:?client} 48 case "$SEAT" in host|silicon) ;; *) echo "seat must be host or silicon" >&2; exit 2 ;; esac 49 HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd) 50 BIN=$(cd "$(dirname "$BIN")" && pwd)/$(basename "$BIN") 51 CLI=$(cd "$(dirname "$CLI")" && pwd)/$(basename "$CLI") 52 PHASES=${RX_OP_PHASES:-"startup control restart kill"} 53 FAILFAST=${RX_OP_FAILFAST:-0} 54 OUT=${RX_OP_OUT:-$HERE/build/r16-operator} 55 W=$(mktemp -d "${TMPDIR:-/tmp}/rx-op.XXXXXX"); chmod 700 "$W" 56 if [ "$SEAT" = silicon ]; then WORLD_WAIT=900; EXIT_WAIT=3600; else WORLD_WAIT=120; EXIT_WAIT=300; fi 57 CHECKS=0; FAILS=0; SKIPS=0; SKIP_WHY=(); PID=""; GPID="" 58 SUDO=0; if sudo -n true 2>/dev/null; then SUDO=1; fi 59 HOLD=0; if [ "$SEAT" = host ] && command -v gdb >/dev/null 2>&1; then HOLD=1; fi 60 61 cleanup() { 62 if [ -n "$PID" ] && kill -0 "$PID" 2>/dev/null; then 63 if [ "$SEAT" = host ]; then kill -9 "$PID" 2>/dev/null; wait "$PID" 2>/dev/null 64 else "$CLI" --control "$S/control" resume >/dev/null 2>&1; wait "$PID" 2>/dev/null; fi 65 fi 66 if [ -n "$GPID" ]; then echo quit 2>/dev/null >&7; sleep 0.2; kill -9 "$GPID" 2>/dev/null; wait "$GPID" 2>/dev/null; fi 67 [ "$SUDO" = 1 ] && sudo -n rm -rf "$W" 2>/dev/null || rm -rf "$W" 68 } 69 trap cleanup EXIT 70 71 receipt() { 72 local commit dirty sum why="" r 73 mkdir -p "$OUT" 74 commit=$(git -C "$HERE" rev-parse HEAD 2>/dev/null || echo unknown) 75 if [ -n "$(git -C "$HERE" status --porcelain 2>/dev/null)" ]; then dirty=true; else dirty=false; fi 76 sum=$(sha256sum "$BIN" | cut -d' ' -f1) 77 for r in "${SKIP_WHY[@]+"${SKIP_WHY[@]}"}"; do why="$why${why:+, }\"$r\""; done 78 cat > "$OUT/operator_${SEAT}_receipt.json" </dev/null 110 echo "R16 operator: program logs kept in $keep" 111 fi 112 echo "R16 operator: $CHECKS checks, $FAILS failures, $SKIPS skipped ($SEAT, phases: $PHASES)" 113 echo "R16 operator gate: R16_G6_OPERATOR=$gate" 114 [ "$FAILS" = 0 ] 115 exit $? 116 } 117 118 check() { # check