interplane.Get Omega
Read in your language

omega-bridge

Omega-first language interoperability: checked conversion backends and native language bindings

Brought by drakestapleton

branch main Branches Tags History

omega-bridge / evidence / device-window / DRA-441 / gates.sh

68 lines · 4152 bytes Raw Blame History
1#!/bin/sh
2# DRA-441 fresh-clone gates for omega-bridge head $1 (I3, 2026-11-16). CPU only, no GPU,
3# no spark-window. Hold the queen pool-2-3 lock while it runs; it pins itself to CPUs 2,3.
4# usage: sh gates.sh HEAD SRC_REPO WORKDIR
5# Every gate names the exit status it expects; the last line is GATES PASS or GATES FAIL
6# (exit 0 or 1). The mutants are negative controls and must make their gate fail (rc 1).
7set -u
8[ "${DRA441_GATES_PINNED:-}" = 1 ] || DRA441_GATES_PINNED=1 exec taskset -c 2,3 sh "$0" "$@"
9head=$1 src=$2 wd=$3
10omc=$HOME/workspace/I3-omc/omc
11want=34d611ca0415eab1728d3234911d90e74af17ba9ab0c581d559f48274d7ca6d3
12[ ! -e "$wd" ] || { echo "workdir exists: $wd"; exit 2; }
13mkdir -p "$wd"
14bad=0
15st() {
16 if [ "$2" = "$3" ]; then echo "GATE $1 rc=$2 expect=$3 ok"
17 else echo "GATE $1 rc=$2 expect=$3 WRONG"; bad=$((bad + 1)); fi
18}
19git clone -q --no-checkout "$src" "$wd/fc" && git -C "$wd/fc" checkout -q "$head"
20st clone $? 0
21cd "$wd/fc" || exit 2
22echo "head $(git rev-parse HEAD)"
23printf '%s %s\n' "$want" "$omc" | sha256sum --check --strict; st omc-pin $? 0
24mkdir -p build
25"$omc" < tools/run-device-window.om > build/run-device-window; st compile-om $? 0
26chmod +x build/run-device-window
27sha256sum build/run-device-window
28"$omc" < tests/device-window/race.om > build/race; st compile-race $? 0
29chmod +x build/race
30# mutant 1: evidence directory never created (makedir result forced to 0)
31awk '{print} /^r = makedir sb 0 get sn 0 511$/{print "r = 0"}' tools/run-device-window.om > build/mutant.om
32cmp -s tools/run-device-window.om build/mutant.om; st mutant-differs $? 1
33"$omc" < build/mutant.om > build/mutant; st compile-mutant $? 0
34chmod +x build/mutant
35# mutant 2: rows do not hold the closer's hold pipe
36grep -c '^c = dupfd int get g gClH 0 0$' tools/run-device-window.om | grep -qx 1; st hold-line-once $? 0
37grep -v '^c = dupfd int get g gClH 0 0$' tools/run-device-window.om > build/mutant-hold.om
38"$omc" < build/mutant-hold.om > build/mutant-hold; st compile-mutant-hold $? 0
39chmod +x build/mutant-hold
40# mutant 3: the closer takes a lost driver (no N, no X) as "nothing to close"
41grep -c '^if eq v 88$' tools/run-device-window.om | grep -qx 1; st lost-line-once $? 0
42sed 's/^if eq v 88$/if lt v 89/' tools/run-device-window.om > build/mutant-lost.om
43cmp -s tools/run-device-window.om build/mutant-lost.om; st mutant-lost-differs $? 1
44"$omc" < build/mutant-lost.om > build/mutant-lost; st compile-mutant-lost $? 0
45chmod +x build/mutant-lost
46sh -n tools/run-device-window.sh; st sh-syntax $? 0
47python3 tests/device-window/compare.py tools/run-device-window.sh build/run-device-window "$wd/cmp" > "$wd/compare.log" 2>&1; st compare $? 0
48tail -1 "$wd/compare.log"
49python3 tests/device-window/compare.py tools/run-device-window.sh build/mutant "$wd/cmpmut" > "$wd/compare-mutant.log" 2>&1; st compare-mutant $? 1
50tail -1 "$wd/compare-mutant.log"
51python3 tests/device-window/compare.py tools/run-device-window.sh build/mutant-hold "$wd/cmphold" > "$wd/compare-mutant-hold.log" 2>&1; st compare-mutant-hold $? 1
52grep '^DIFF ' "$wd/compare-mutant-hold.log"; tail -1 "$wd/compare-mutant-hold.log"
53python3 tests/device-window/compare.py tools/run-device-window.sh build/mutant-lost "$wd/cmplost" > "$wd/compare-mutant-lost.log" 2>&1; st compare-mutant-lost $? 1
54grep '^DIFF ' "$wd/compare-mutant-lost.log"; tail -1 "$wd/compare-mutant-lost.log"
55build/race build/run-device-window "$wd/race-om" 100 > "$wd/race-om.log" 2>&1; st race-om $? 0
56tail -2 "$wd/race-om.log"
57build/race tools/run-device-window.sh "$wd/race-sh" 100 > "$wd/race-sh.log" 2>&1; st race-sh $? 0
58tail -2 "$wd/race-sh.log"
59build/race build/mutant "$wd/race-mut" 20 > "$wd/race-mut.log" 2>&1; st race-mutant $? 1
60tail -2 "$wd/race-mut.log"
61OMEGA_SOURCE=$HOME/git/omega-mv.git sh tools/bootstrap.sh > "$wd/bootstrap.log" 2>&1; st bootstrap $? 0
62OMEGA_SEED=build/bootstrap/omc sh tools/test.sh > "$wd/test.log" 2>&1; st repo-test $? 0
63tail -1 "$wd/test.log"
64rm -rf "$wd/cmp" "$wd/cmpmut" "$wd/cmphold" "$wd/cmplost" "$wd/race-om" "$wd/race-sh" "$wd/race-mut"
65sha256sum "$wd"/*.log
66if [ "$bad" = 0 ]; then echo "GATES PASS"; exit 0; fi
67echo "GATES FAIL wrong=$bad"
68exit 1