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
omega-mv / tests / crumbline / run_conformance.sh
| 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 | # Crumb v1 conformance: Omega's visible-crumb reader must decode every vector |
| 18 | # produced by the crumbs crate (aien-sovereign-core, crates/crumbs) exactly as |
| 19 | # crumbs itself parses it. Vectors: `crumbs vectors DIR` (one per registered |
| 20 | # family, seed 7) plus expected.txt. |
| 21 | # |
| 22 | # Also checks that malformed bytes are rejected and that the learner binary |
| 23 | # carries no sealed-side symbols. |
| 24 | set -u |
| 25 | LEARNER=${1:-build/crumbline-learner} |
| 26 | DIR=${2:-tests/crumbline/vectors} |
| 27 | pass=0 |
| 28 | fail=0 |
| 29 | while read -r name rest; do |
| 30 | got=$("$LEARNER" --decode "$DIR/$name") |
| 31 | if [ "$got" == "$rest" ]; then |
| 32 | pass=$((pass + 1)) |
| 33 | else |
| 34 | fail=$((fail + 1)) |
| 35 | echo "MISMATCH $name" |
| 36 | echo " want: $rest" |
| 37 | echo " got: $got" |
| 38 | fi |
| 39 | done < "$DIR/expected.txt" |
| 40 | |
| 41 | # Negative vectors: truncated, wrong magic, trailing byte, non-canonical decimal. |
| 42 | tmp=$(mktemp -d) |
| 43 | head -c 20 "$DIR/v001.crb" > "$tmp/trunc.crb" |
| 44 | printf 'XRB1' | cat - <(tail -c +5 "$DIR/v001.crb") > "$tmp/magic.crb" |
| 45 | cat "$DIR/v001.crb" <(printf '\0') > "$tmp/trail.crb" |
| 46 | printf 'CRB1\x01\x00\x01\x00\x01\x01\x00\x00\x01\x00\x00\x00\x01\x00\x00\x001\x02\x00\x00\x0003' > "$tmp/zero.crb" |
| 47 | for bad in trunc magic trail zero; do |
| 48 | if "$LEARNER" --decode "$tmp/$bad.crb" | grep -q '^decode-error'; then |
| 49 | pass=$((pass + 1)) |
| 50 | else |
| 51 | fail=$((fail + 1)) |
| 52 | echo "ACCEPTED MALFORMED $bad" |
| 53 | fi |
| 54 | done |
| 55 | rm -rf "$tmp" |
| 56 | |
| 57 | # The learner links no generator, sealed record or gate code. |
| 58 | if nm "$LEARNER" | grep -Eiq 'sealed|heldout|generator|nvrm|_gates'; then |
| 59 | fail=$((fail + 1)) |
| 60 | echo "LEARNER LINKS SEALED OR GATE SYMBOLS" |
| 61 | else |
| 62 | pass=$((pass + 1)) |
| 63 | fi |
| 64 | |
| 65 | echo "CRUMBLINE_CONFORMANCE pass=$pass fail=$fail" |
| 66 | [ "$fail" -eq 0 ] |