interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / seed / host / check.sh

218 lines · 12009 bytes Raw Blame History
1#!/bin/sh
2# Entire host-extension qualification uses the seed chain and Omega programs.
3set -eu
4cd "$(dirname "$0")/../.."
5if [ ! -x build/omegese/omegese ] || [ ! -x build/omega_emit/omega_emit ] || [ ! -x build/checker2/checker2 ]; then
6 printf 'NOT_RUN gate-ir: required C oracles not built\n' >&2
7 printf ' make build/omegese/omegese build/omega_emit/omega_emit build/checker2/checker2\n' >&2
8 exit 3
9fi
10sh seed/omega-from-seed.sh
11# Required release checks are part of the host gate, not a caller-maintained list.
12# Preserve each log and stop on either a failing command or missing final evidence.
13printf 'SOURCE %s\n' "$(git rev-parse HEAD)"
14source_state=$(git status --porcelain)
15if [ -n "$source_state" ]; then
16 printf 'FAIL source checkout is dirty\n%s\n' "$source_state" >&2
17 exit 1
18fi
19printf 'SOURCE_CLEAN\n'
20sha256sum -c seed/out/omc.sha256
21printf 'COMPILER %s\n' "$(sha256sum seed/out/omc)"
22required=$(mktemp -d build/seed/required.XXXXXX)
23(
24 unset POOLS_ONLY POOLS_SKIP_EQUIV POOLS_EQUIV_MAX POOLS_FUZZ_SEEDS CTRL OMC
25 sh seed/omc/gate-pools.sh
26) > "$required/pools.log" 2>&1 || { cat "$required/pools.log"; exit 1; }
27cat "$required/pools.log"
28grep -qx 'PASS gate-pools' "$required/pools.log"
29[ "$(tail -1 "$required/pools.log")" = 'RC=0' ]
30sh seed/omc/tests/struct-bool/check.sh
31sh seed/ng/front/cases/nom-wrap.sh check
32seed/out/omc < seed/ng/front/gate-front.om > "$required/gate-front"
33chmod +x "$required/gate-front"
34set --
35while IFS= read -r cases; do
36 [ -n "$cases" ] || continue
37 [ -f "$cases" ] || { printf 'FAIL missing front case list: %s\n' "$cases" >&2; exit 1; }
38 set -- "$@" "$cases"
39done < seed/ng/front/check-lists.txt
40[ "$#" -gt 0 ]
41"$required/gate-front" seed/out/omc "$(cut -d' ' -f1 seed/out/omc.sha256)" \
42 units:seed/ng/ng.units+in:seed/ng/front/front-check.in \
43 seed/ng/front/declared.txt seed/ng/front/mutants.txt "$required/front" "$@" \
44 > "$required/front.log" 2>&1 || { cat "$required/front.log"; exit 1; }
45cat "$required/front.log"
46grep -q '^FRONTGATE PASS cases=[1-9][0-9]* .* fail=0 ' "$required/front.log"
47sh seed/omc/gate-ir.sh
48sh seed/omc/gate7.sh
49sh seed/omc/gate8.sh
50sh seed/omc/gate-fma.sh
51sh seed/omc/gate9.sh
52sh seed/omc/gate10.sh
53sh seed/omc/gate11.sh
54sh seed/omc/gate12.sh
55sh seed/omc/gate13.sh
56sh seed/omc/gate14.sh
57sh seed/omc/gate15.sh
58sh seed/explain/gate.sh
59sh seed/omc/gate16.sh
60sh seed/omc/gate17.sh
61sh seed/omc/gate18.sh
62sh seed/omc/gate-recursion.sh
63# names of up to 63 bytes; status 3 (NOT_RUN) only for its x86 runs when qemu-x86_64 is absent, printed by the gate
64sh seed/omc/gate-longnames.sh || { r=$?; [ $r = 3 ] || exit $r; }
65# no table capacities in omc (OMEGESE 9.6): units far past the old ones, with omc f4fa7951 as control
66sh seed/omc/gate-nocaps.sh
67# the alarm in place of the capacities: arena, time and memory of the stack's largest units; status 3
68# (NOT_RUN) only when a sibling checkout (../omega-mcp, ../cortex, ../interplane-forge) is absent
69sh seed/omc/gate-usage.sh || { r=$?; [ $r = 3 ] || exit $r; }
70# Executable contracts use the existing fail-closed Omega conductor.
71B=build/seed/contracts
72mkdir -p "$B"
73seed/out/omc < seed/qualification/om2/gate.om > "$B/gate"
74chmod +x "$B/gate"
75pin=$(sha256sum seed/out/omc | cut -d' ' -f1)
76run=$(mktemp -d "$B/run.XXXXXX")
77"$B/gate" seed/out/omc "$pin" seed/omc/contracts/contracts.cases "$run/cases"
78# OM-2 for loops tested at the latch: exact pass counts and the pass on which trap 4 fires (seed/omc/cflow).
79"$B/gate" seed/out/omc "$pin" seed/omc/cflow/cflow.cases "$run/cflow"
80# OM-2 dit and scrub (OMEGESE 9.13.1): s5 cases, and every s5 omc.om mutant detected (ctl-* PASS, m-* FAIL).
81"$B/gate" seed/out/omc "$pin" seed/omc/om2/s5/s5.cases "$run/s5" > "$run/s5.log" || { cat "$run/s5.log"; exit 1; }
82grep -qx 'OM2GATE PASS cases=26 pass=26 fail=0 invalid=0 not_run=0' "$run/s5.log"
83if "$B/gate" seed/out/omc "$pin" seed/omc/om2/s5/s5-mutants.cases "$run/s5mut" > "$run/s5mut.log"; then
84 echo 'FAIL dit/scrub mutant survived' >&2
85 exit 1
86else
87 status=$?
88 [ "$status" = 1 ] || { cat "$run/s5mut.log"; exit 1; }
89fi
90grep -qx 'OM2GATE FAIL cases=20 pass=9 fail=11 invalid=0 not_run=0' "$run/s5mut.log"
91[ "$(grep -c '^VERDICT ctl-[a-z-]* PASS ' "$run/s5mut.log")" = 9 ]
92[ "$(grep -c '^VERDICT m-[a-z0-9]* FAIL ' "$run/s5mut.log")" = 11 ]
93echo 'PASS dit/scrub (26 cases) and 11 omc.om mutants detected'
94# Every OM-2 case and mutant file (s1..s5, bnd, fnhost, hex), with two negative controls (ROADMAP-1.0 RM1).
95sh seed/qualification/om2/every.sh
96# Error-site coverage (ROADMAP-1.0 RM8): reached omc error sites may not fall below seed/omc/sitecov.floor.
97sh seed/omc/sitecov.sh check
98if "$B/gate" seed/out/omc "$pin" seed/omc/contracts/mutant.cases "$run/mutant" > "$run/mutant.log"; then
99 echo 'FAIL contract-enforcement mutant survived' >&2
100 exit 1
101else
102 status=$?
103 [ "$status" = 1 ] || { cat "$run/mutant.log"; exit 1; }
104fi
105grep -qx 'VERDICT mutant-requires FAIL run exit=0 expected=109 stdout=match stderr=match' "$run/mutant.log"
106grep -qx 'VERDICT mutant-proof FAIL run exit=0 expected=109 stdout=match stderr=match' "$run/mutant.log"
107grep -qx 'OM2GATE FAIL cases=2 pass=0 fail=2 invalid=0 not_run=0' "$run/mutant.log"
108echo 'PASS contract-enforcement mutant detected by exact runtime-status mismatch'
109# #1042: exact-cap refusal and missing-cap mutants must both be detected.
110if "$B/gate" seed/out/omc "$pin" seed/host/devcall-mutants.cases "$run/devcall-mutants" > "$run/devcall-mutants.log"; then
111 echo 'FAIL devcall parameter-cap mutant survived' >&2
112 exit 1
113else
114 status=$?
115 [ "$status" = 1 ] || { cat "$run/devcall-mutants.log"; exit 1; }
116fi
117grep -q '^VERDICT devcall-cap-offbyone FAIL run exit=103 expected=0 ' "$run/devcall-mutants.log"
118grep -q '^VERDICT devcall-cap-removed FAIL run exit=80 expected=0 ' "$run/devcall-mutants.log"
119grep -qx 'OM2GATE FAIL cases=2 pass=0 fail=2 invalid=0 not_run=0' "$run/devcall-mutants.log"
120echo 'PASS devcall parameter cap: off-by-one and removed-check mutants killed'
121# Packed-list hostile ingress (#671): generated packets reach execprog from stdin.
122"$B/gate" seed/out/omc "$pin" seed/qualification/security673/packets.cases "$run/packets"
123if "$B/gate" seed/out/omc "$pin" seed/qualification/security673/packets-mutant.cases "$run/packets-mutant" > "$run/packets-mutant.log"; then
124 echo 'FAIL packed-list bound mutant survived' >&2
125 exit 1
126else
127 status=$?
128 [ "$status" = 1 ] || { cat "$run/packets-mutant.log"; exit 1; }
129fi
130grep -qx 'VERDICT mutant-size FAIL run exit=0 expected=103 stdout=match stderr=match' "$run/packets-mutant.log"
131grep -qx 'VERDICT mutant-count FAIL run exit=0 expected=103 stdout=match stderr=match' "$run/packets-mutant.log"
132grep -qx 'VERDICT mutant-exact FAIL run exit=0 expected=103 stdout=match stderr=match' "$run/packets-mutant.log"
133grep -qx 'OM2GATE FAIL cases=3 pass=0 fail=3 invalid=0 not_run=0' "$run/packets-mutant.log"
134echo 'PASS packed-list ingress: hostile packets refused; size, count and exact-length mutants detected'
135# OM-2 hex literals (#745): every place, decimal twins byte-identical, refusals on the decimal codes.
136"$B/gate" seed/out/omc "$pin" seed/omc/om2/hex/hex.cases "$run/hex" > "$run/hex.log" || { cat "$run/hex.log"; exit 1; }
137grep -qx 'OM2GATE PASS cases=51 pass=51 fail=0 invalid=0 not_run=0' "$run/hex.log"
138if "$B/gate" seed/out/omc "$pin" seed/omc/om2/hex/mutants.cases "$run/hexmut" > "$run/hexmut.log"; then
139 echo 'FAIL hex-literal mutant survived' >&2
140 exit 1
141else
142 status=$?
143 [ "$status" = 1 ] || { cat "$run/hexmut.log"; exit 1; }
144fi
145grep -qx 'OM2GATE FAIL cases=8 pass=3 fail=5 invalid=0 not_run=0' "$run/hexmut.log"
146[ "$(grep -c '^VERDICT ctl-hex-[a-z]*-pairs-dec-run PASS ' "$run/hexmut.log")" = 3 ]
147[ "$(grep -c '^VERDICT hex-[a-z]*-[a-z0-9-]* FAIL ' "$run/hexmut.log")" = 5 ]
148echo 'PASS hex literals (51 cases) and 3 tok_hex mutants killed'
149# OM-2 expression boundaries (#745, spec section 2): missing/extra operand and grouping, both profiles.
150"$B/gate" seed/out/omc "$pin" seed/omc/om2/bnd/bnd.cases "$run/bnd" > "$run/bnd.log" || { cat "$run/bnd.log"; exit 1; }
151grep -qx 'OM2GATE PASS cases=47 pass=47 fail=0 invalid=0 not_run=0' "$run/bnd.log"
152if "$B/gate" seed/out/omc "$pin" seed/omc/om2/bnd/mutants.cases "$run/bndmut" > "$run/bndmut.log"; then
153 echo 'FAIL operand-boundary mutant survived' >&2
154 exit 1
155else
156 status=$?
157 [ "$status" = 1 ] || { cat "$run/bndmut.log"; exit 1; }
158fi
159grep -qx 'OM2GATE FAIL cases=10 pass=2 fail=8 invalid=0 not_run=0' "$run/bndmut.log"
160[ "$(grep -c '^VERDICT ctl-bnd-[a-z]*-g0-run PASS ' "$run/bndmut.log")" = 2 ]
161[ "$(grep -c '^VERDICT bnd-[a-z]*-[a-z0-9-]* FAIL ' "$run/bndmut.log")" = 8 ]
162echo 'PASS expression boundaries (47 cases) and 2 operand mutants killed'
163# OM-2 function-mode host words: admitted subset, context tables and x86 syscall/fence mutants.
164"$B/gate" seed/out/omc "$pin" seed/omc/om2/fnhost/fnhost.cases "$run/fnhost" > "$run/fnhost.log" || { cat "$run/fnhost.log"; exit 1; }
165grep -qx 'OM2GATE PASS cases=21 pass=21 fail=0 invalid=0 not_run=0' "$run/fnhost.log"
166if "$B/gate" seed/out/omc "$pin" seed/omc/om2/fnhost/mutants.cases "$run/fnhostmut" > "$run/fnhostmut.log"; then
167 echo 'FAIL function-mode host-word mutant survived' >&2
168 exit 1
169else
170 status=$?
171 [ "$status" = 1 ] || { cat "$run/fnhostmut.log"; exit 1; }
172fi
173grep -qx 'OM2GATE FAIL cases=24 pass=12 fail=12 invalid=0 not_run=0' "$run/fnhostmut.log"
174[ "$(grep -c '^VERDICT ctl-fn-[a-z0-9]* PASS ' "$run/fnhostmut.log")" = 12 ]
175[ "$(grep -c '^VERDICT fn-[a-z0-9]* FAIL ' "$run/fnhostmut.log")" = 12 ]
176echo 'PASS function-mode host words (21 cases) and 12 omc.om mutants killed'
177# execenv 233: exact child environment (AArch64 and x86linux), printenv ORACLE, execprog negative
178# control, function-mode and contract refusals, and 4 omc.om mutants killed (seed/host/execenv/).
179"$B/gate" seed/out/omc "$pin" seed/host/execenv/execenv.cases "$run/execenv"
180# prlimit 235: rlimit read/set/effect against /proc/self/limits (AArch64 and x86linux), RLIMIT_AS kept
181# across execprog, refusals, and 7 omc.om mutants killed (seed/host/prlimit/).
182"$B/gate" seed/out/omc "$pin" seed/host/prlimit/prlimit.cases "$run/prlimit"
183mkdir -p build/seed/sched-caller
184seed/out/omc < seed/host/affinity/caller-conductor.om > build/seed/sched-caller/conductor
185chmod +x build/seed/sched-caller/conductor
186"$B/gate" seed/out/omc "$pin" seed/host/affinity/sched.cases "$run/sched"
187# Contract behavior parity in pure seeded OM-2 (replaces the retired C runner.c / src/compiler/ check).
188{ cat seed/omc/contracts/parity.om; cat seed/omc/contracts/parity-check.om; } | seed/out/omc > "$run/parity-check"
189chmod +x "$run/parity-check"
190"$run/parity-check"
191echo 'PASS contract parity: exact values and traps 9/10'
192mkdir -p build/seed/host
193seed/out/omc < seed/host/gate.om > build/seed/host/gate
194chmod +x build/seed/host/gate
195build/seed/host/gate
196sh seed/host/negative.sh
197sh seed/host/regression.sh
198sh seed/host/cpufence.sh
199sh seed/host/irq.sh
200seed/out/omc < seed/host/aien-ioctl.om > "$run/aien-ioctl"
201chmod +x "$run/aien-ioctl"
202"$run/aien-ioctl" "$(pwd)/seed/out/omc" "$(command -v qemu-x86_64)" "$run/aien-ioctl-cases"
203if readelf -l -d seed/out/omc | grep -Eq 'INTERP|NEEDED'; then
204 echo 'FAIL unexpected compiler runtime dependency' >&2
205 exit 1
206fi
207# OMEGA-CRYPTO-REUSE-1 (Refs #639). set -eu: a failing suite exits this script.
208# A no-op tamper in om/tls/test/reuse/run.sh (replacement equal to the site) is not
209# caught, so that suite, and therefore this script, exits nonzero.
210sh om/tls/test/gcmsiv/run.sh seed/out/omc
211sh om/tls/test/reuse/run.sh seed/out/omc
212sh seed/omc/gate-objects.sh seed/out/omc
213sh seed/omc/gate-objhost.sh seed/out/omc
214sh seed/text/tests/gate.sh
215# Diagnostic-v2 oracle and explicit uncovered-site inventory.
216python3 seed/omc/diagnostics-v2.py seed/out/omc
217python3 seed/modules/tests/check.py seed/out/omc "$(mktemp -d build/seed/modules.XXXXXX)"
218printf 'PASS native-host qualification; seeded build, C tools are comparison oracles only\n'