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 / host / regression.sh
| 1 | #!/bin/sh |
| 2 | # Compare the original native parent with the extended native compiler. No foreign compiler. |
| 3 | set -eu |
| 4 | cd "$(dirname "$0")/../.." |
| 5 | mkdir -p build/seed/host |
| 6 | stage=$(mktemp -d build/seed/host/regression.XXXXXX) |
| 7 | trap 'rm -rf "$stage"' EXIT HUP INT TERM |
| 8 | # Fixed baseline selected at ec07d25d5506d33567adbd4d9b518177b7933bad. |
| 9 | # Adding/removing a case or changing its expected status requires explicit review; |
| 10 | # content filters must never silently remove the original comparison obligation. |
| 11 | manifest=seed/host/original-fixtures.tsv |
| 12 | bad() { printf 'FAIL original fixtures: %s\n' "$*" >&2; exit 1; } |
| 13 | git ls-files --error-unmatch -- "$manifest" > /dev/null || bad "untracked manifest" |
| 14 | awk -F '\t' ' |
| 15 | NF != 2 || $1 !~ /^[A-Za-z0-9_./-]+$/ || $2 !~ /^(0|5|7|9)$/ { exit 1 } |
| 16 | seen[$1]++ { exit 1 } |
| 17 | END { if (NR != 62) exit 1 } |
| 18 | ' "$manifest" || bad "invalid, duplicate or incomplete baseline (expected 62 cases)" |
| 19 | count=0 |
| 20 | while IFS="$(printf '\t')" read -r source expected; do |
| 21 | [ -f "$source" ] || bad "missing baseline: $source" |
| 22 | git ls-files --error-unmatch -- "$source" > /dev/null || bad "untracked baseline: $source" |
| 23 | old=0 |
| 24 | new=0 |
| 25 | seed/rung4/om4.bin < "$source" > "$stage/old" 2> "$stage/old.err" || old=$? |
| 26 | seed/out/omc < "$source" > "$stage/new" 2> "$stage/new.err" || new=$? |
| 27 | test "$old" = "$expected" || bad "$source: parent status $old, expected $expected" |
| 28 | test "$old" = "$new" || { echo "Changed compiler status: $source" >&2; exit 1; } |
| 29 | cmp "$stage/old" "$stage/new" |
| 30 | sed 's/^om4:/compiler:/' "$stage/old.err" > "$stage/old.normal" |
| 31 | sed 's/^omc:/compiler:/' "$stage/new.err" > "$stage/new.normal" |
| 32 | cmp "$stage/old.normal" "$stage/new.normal" |
| 33 | count=$((count + 1)) |
| 34 | done < "$manifest" |
| 35 | test "$count" -eq 62 || bad "incomplete read: $count of 62 cases" |
| 36 | printf 'PASS %s original fixtures retain identical machine code, refusal status and diagnostics\n' "$count" |