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 / tests / physics0 / isolation.sh

53 lines · 2316 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# PD-0 G5 isolation check (spec section 11 step 7, invariant I10).
18# The learner-side objects (everything a learner process may link: the channel,
19# wire records, randomness, relation algebra) must contain no reference to any
20# generator or world symbol, and must open no file. Usage:
21# sh tests/physics0/isolation.sh <obj>... (learner-side .o files)
22# Prints PHYSICS0_ISOLATION: PASS|FAIL.
23fail=0
24for o in "$@"; do
25 [ -f "$o" ] || { echo "missing $o"; fail=1; continue; }
26 case "$o" in
27 *.om)
28 code=$(grep -v '^[[:space:]]*note\([[:space:]]\|$\)' "$o")
29 for bad in pd0_gen_ pd0_world_ p0w_ fopen openat fdopen; do
30 if printf '%s\n' "$code" | grep -q "\b${bad}\|${bad}"; then
31 echo "FAIL: $o references $bad"; fail=1
32 fi
33 done
34 ;;
35 *)
36 syms=$(nm "$o" | awk '{print $NF}')
37 for bad in pd0_gen_ pd0_world_ fopen open openat fdopen; do
38 if echo "$syms" | grep -q "^_\{0,1\}${bad}"; then
39 echo "FAIL: $o references $bad"; fail=1
40 fi
41 done
42 ;;
43 esac
44done
45# and the generator objects/sources really do carry the generators (so the check bites)
46if [ -n "$PD0_GEN_OBJ" ]; then
47 nm "$PD0_GEN_OBJ" | grep -q " T pd0_gen_step" || { echo "FAIL: $PD0_GEN_OBJ has no pd0_gen_step"; fail=1; }
48fi
49if [ -n "$PD0_GEN_OM" ]; then
50 grep -q "^fn pd0_gen_" "$PD0_GEN_OM" || { echo "FAIL: $PD0_GEN_OM has no fn pd0_gen_*"; fail=1; }
51fi
52if [ $fail = 0 ]; then echo "PHYSICS0_ISOLATION: PASS ($# learner-side units clean)"; else echo "PHYSICS0_ISOLATION: FAIL"; fi
53exit $fail