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/r16_inventory/run.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 / r16_inventory / run.sh` 128 lines ยท 5961 bytes Raw Blame History 1 #!/bin/sh 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-G2 inventory tool self-test. Usage: run.sh 18 # Copies the fixture repos to a scratch directory, makes each a git repo, and 19 # checks: clean fixture PASSES; each planted defect FAILS for the right reason; 20 # JSON output is byte-stable. No network; seconds. 21 set -u 22 TOOL=${1:?usage: run.sh } 23 case $TOOL in /*) ;; *) TOOL=$(pwd)/$TOOL ;; esac 24 HERE=$(cd "$(dirname "$0")" && pwd) 25 FAILS=0 26 SCR=$(mktemp -d "${TMPDIR:-/tmp}/r16inv.XXXXXX") || exit 2 27 trap 'rm -rf "$SCR"' EXIT INT TERM 28 29 setup() { 30 rm -rf "$SCR/w" && mkdir -p "$SCR/w" && cp -R "$HERE/fixture/." "$SCR/w/" || exit 2 31 for r in omega aien-sovereign-core aegis-runtime aienos physics; do 32 g() { git -C "$SCR/w/$r" -c user.name=r16 -c user.email=r16@invalid -c commit.gpgsign=false "$@"; } 33 g init -q && g add -A && g commit -qm fixture || exit 2 34 done 35 } 36 commit_all() { 37 for r in omega aien-sovereign-core aegis-runtime aienos physics; do 38 [ -d "$SCR/w/$r/.git" ] || continue 39 git -C "$SCR/w/$r" add -A 40 git -C "$SCR/w/$r" -c user.name=r16 -c user.email=r16@invalid -c commit.gpgsign=false commit -qm planted >/dev/null 2>&1 41 done 42 } 43 run() { 44 R16_REPO_OMEGA=$SCR/w/omega R16_REPO_SOVEREIGN_CORE=$SCR/w/aien-sovereign-core \ 45 R16_REPO_AEGIS_RUNTIME=$SCR/w/aegis-runtime R16_REPO_AIENOS=$SCR/w/aienos \ 46 R16_REPO_PHYSICS=$SCR/w/physics "$TOOL" --map "$SCR/w/map.md" --json "$SCR/out.json" 2>"$SCR/err.txt" 47 } 48 # expect [stderr-pattern] 49 expect() { 50 name=$1 want=$2 pat=${3:-} 51 run; got=$? 52 if [ "$got" -ne "$want" ]; then 53 echo "FAIL $name: exit $got, want $want"; sed 's/^/ /' "$SCR/err.txt"; FAILS=$((FAILS + 1)); return 54 fi 55 if [ -n "$pat" ] && ! grep -q -- "$pat" "$SCR/err.txt"; then 56 echo "FAIL $name: stderr lacks '$pat'"; sed 's/^/ /' "$SCR/err.txt"; FAILS=$((FAILS + 1)); return 57 fi 58 echo "ok $name (exit $got)" 59 } 60 61 # 1. clean fixture: every site classified, class-A omega site under a legacy_oracle name 62 setup 63 expect clean-fixture-passes 0 "sites=11 unclassified=0 question=0 bad_class=0 a_reachable=0 stale=0 map_errors=0 skipped=0 -> PASS" 64 cp "$SCR/out.json" "$SCR/a.json"; run; if cmp -s "$SCR/a.json" "$SCR/out.json"; then echo "ok json-byte-stable"; else echo "FAIL json-byte-stable"; FAILS=$((FAILS + 1)); fi 65 66 # 2. planted run_until_complete loop (spec R16-G2 case) 67 setup 68 printf 'int busy(void);\nvoid rx_run_until_complete(void);\nvoid drive(void) {\n while (busy()) {\n rx_run_until_complete();\n }\n}\n' >> "$SCR/w/omega/src/world.c"; commit_all 69 expect planted-run-until-complete-fails 1 "UNCLASSIFIED omega src/world.c:.*named:run_until_complete" 70 71 # 3. planted unlabelled while (1) 72 setup 73 printf 'void spin(void) {\n while (1) {\n }\n}\n' >> "$SCR/w/physics/nvrm.c"; commit_all 74 expect planted-while-1-fails 1 "UNCLASSIFIED physics nvrm.c:.*while:unbounded" 75 76 # 4. planted Rust heartbeat loop (bounded, wait word in body) 77 setup 78 printf 'fn tick() {}\nfn heartbeat_loop() {\n for _ in 0..10 {\n tick();\n }\n}\n' >> "$SCR/w/aegis-runtime/src/agent.rs"; commit_all 79 expect planted-rust-tick-loop-fails 1 "UNCLASSIFIED aegis-runtime src/agent.rs:.*for:body:tick" 80 81 # 5. a '?' row fails 82 setup 83 sed 's/| FX-10 \(.*\) | E | true |/| FX-10 \1 | ? | ? |/' "$HERE/fixture/map.md" > "$SCR/w/map.md" 84 expect question-row-fails 1 "QUESTION FX-10" 85 86 # 6. omega class A under a production name fails 87 setup 88 git -C "$SCR/w/omega" mv src/legacy_oracle_demo.c src/demo.c; commit_all 89 sed 's#src/legacy_oracle_demo.c#src/demo.c#' "$HERE/fixture/map.md" > "$SCR/w/map.md" 90 expect omega-class-a-reachable-fails 1 "A-REACHABLE FX-01" 91 92 # 7. a classified site that disappeared (non-A) is a stale row 93 setup 94 sed 's/while (\*m == 0) {/if (*m == 0) {/; s/^ }$//' "$HERE/fixture/physics/nvrm.c" > "$SCR/w/physics/nvrm.c"; commit_all 95 expect stale-row-fails 1 "STALE FX-11" 96 97 # 8. a missing repository is SKIPPED, and skipping is not a pass 98 setup 99 rm -rf "$SCR/w/physics" 100 expect missing-repo-skipped-fails 1 "SKIPPED physics" 101 102 # 9. manual row whose line is gone is stale 103 setup 104 sed 's/^int wait_marker(volatile int \*m) {$/int wait_marker2(volatile int *m) {/' "$HERE/fixture/physics/nvrm.c" > "$SCR/w/physics/nvrm.c"; commit_all 105 expect manual-row-gone-fails 1 "STALE FX-M1" 106 107 # 10. bad class letter fails 108 setup 109 sed 's/| FX-07 \(.*\) | F | false |/| FX-07 \1 | G | false |/' "$HERE/fixture/map.md" > "$SCR/w/map.md" 110 expect bad-class-fails 1 "BAD-CLASS FX-07" 111 112 # 11. class N with valid idiom passes 113 setup 114 sed 's/| FX-10 \(.*\) | E | true | fixture |/| FX-10 \1 | N | false | N: walk: halt loop walk |/' "$HERE/fixture/map.md" > "$SCR/w/map.md" 115 expect class-n-passes 0 "PASS" 116 117 # 12. class N without idiom in reason fails 118 setup 119 sed 's/| FX-10 \(.*\) | E | true | fixture |/| FX-10 \1 | N | false | some non idiom reason |/' "$HERE/fixture/map.md" > "$SCR/w/map.md" 120 expect class-n-no-idiom-fails 1 "N-NO-IDIOM FX-10" 121 122 # 13. class N on a loop with wait word in body fails 123 setup 124 sed 's/| FX-03 \(.*\) | E | true | fixture |/| FX-03 \1 | N | false | N: walk: wait loop |/' "$HERE/fixture/map.md" > "$SCR/w/map.md" 125 expect class-n-wait-word-fails 1 "N-WAIT-WORD FX-03" 126 127 if [ "$FAILS" -ne 0 ]; then echo "R16 inventory self-test: $FAILS FAILED"; exit 1; fi 128 echo "R16 inventory self-test: PASS"