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 / seed / omc / gate-fma.sh
| 1 | #!/bin/sh |
| 2 | # Candidate-only AArch64 FMADD and exact-literal negative controls. No production pin is changed. |
| 3 | # Requires the settled source's seed fixpoint in seed/out/omc. All transforms and compilers are seeded .om. |
| 4 | set -eu |
| 5 | cd "$(dirname "$0")/../.." |
| 6 | S=seed/out/omc |
| 7 | T=seed/omc/tests/float |
| 8 | B=build/seed/fma |
| 9 | mkdir -p "$B" |
| 10 | bad() { printf 'FAIL gate-fma %s\n' "$*" >&2; exit 1; } |
| 11 | "$S" < "$T/fma.om" > "$B/control" 2> "$B/control.err" || bad 'control compile' |
| 12 | chmod +x "$B/control" |
| 13 | "$B/control" || bad 'control behavior' |
| 14 | printf 'PASS fused control exit 0\n' |
| 15 | "$S" < "$T/mutate.om" > "$B/mutate" 2> "$B/mutate.err" || bad 'mutator compile' |
| 16 | chmod +x "$B/mutate" |
| 17 | set +e |
| 18 | "$B/mutate" 0 < "$T/fma.om" > "$B/absent.om" |
| 19 | rc=$? |
| 20 | set -e |
| 21 | [ "$rc" = 93 ] || bad "absent-site control exit $rc, wanted 93" |
| 22 | printf 'PASS mutator absent-site refusal 93\n' |
| 23 | for mode in 0 1 2 3; do |
| 24 | "$B/mutate" "$mode" < seed/omc/omc.om > "$B/m$mode.om" || bad "mutation $mode not exact-once" |
| 25 | "$S" < "$B/m$mode.om" > "$B/m$mode" 2> "$B/m$mode.err" || bad "mutant $mode compile" |
| 26 | chmod +x "$B/m$mode" |
| 27 | if [ "$mode" = 0 ] || [ "$mode" = 1 ]; then |
| 28 | "$B/m$mode" < "$T/fma.om" > "$B/probe$mode" 2> "$B/probe$mode.err" || bad "mutant $mode fixture compile" |
| 29 | chmod +x "$B/probe$mode" |
| 30 | set +e |
| 31 | "$B/probe$mode" |
| 32 | rc=$? |
| 33 | set -e |
| 34 | [ "$rc" != 0 ] || bad "mutant $mode survived" |
| 35 | printf 'PASS mutant %s detected: fused fixture exit %s\n' "$mode" "$rc" |
| 36 | else |
| 37 | "$B/m$mode" < "$T/lit_round.om" > "$B/probe$mode" 2> "$B/probe$mode.err" || bad "mutant $mode literal compile" |
| 38 | chmod +x "$B/probe$mode" |
| 39 | "$B/probe$mode" > "$B/lit$mode.raw" || bad "mutant $mode literal run" |
| 40 | od -An -v -tx8 -w8 "$B/lit$mode.raw" | tr -d ' ' > "$B/lit$mode.got" |
| 41 | cut -d' ' -f1 "$T/lit_round.want" > "$B/lit.want" |
| 42 | if cmp -s "$B/lit.want" "$B/lit$mode.got"; then bad "mutant $mode survived"; fi |
| 43 | printf 'PASS mutant %s detected: literal bits differ\n' "$mode" |
| 44 | fi |
| 45 | done |
| 46 | printf 'PASS gate-fma fused control, fail-closed mutator and 4 wrong-word/rounding mutants\n' |