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 / om / blake3 / test-output.sh
| 1 | #!/bin/sh |
| 2 | # Host output-contract regression. Pass a freshly compiled blake3.om binary. |
| 3 | # Does not compile, access the GPU, or change the live server. |
| 4 | set -eu |
| 5 | [ "$#" -eq 1 ] || { echo 'usage: test-output.sh /path/to/blake3' >&2; exit 2; } |
| 6 | B=$1 |
| 7 | [ -x "$B" ] || { echo 'FAIL: binary is not executable' >&2; exit 1; } |
| 8 | [ -c /dev/full ] || { echo 'NOT_RUN: /dev/full unavailable' >&2; exit 77; } |
| 9 | T=$(mktemp -d) |
| 10 | trap 'rm -rf "$T"' EXIT HUP INT TERM |
| 11 | bad() { printf 'FAIL: %s\n' "$*" >&2; exit 1; } |
| 12 | "$B" </dev/null >"$T/out" || bad 'empty-input control failed' |
| 13 | printf '%s\n' af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262 >"$T/want" |
| 14 | cmp "$T/want" "$T/out" || bad 'empty-input digest or newline differs' |
| 15 | rc=0 |
| 16 | "$B" </dev/null >/dev/full || rc=$? |
| 17 | [ "$rc" -eq 74 ] || bad "/dev/full returned $rc, wanted 74" |
| 18 | rc=0 |
| 19 | "$B" </dev/null 1>&- || rc=$? |
| 20 | [ "$rc" -eq 74 ] || bad "closed stdout returned $rc, wanted 74" |
| 21 | printf '%s\n' 'PASS: empty digest, /dev/full and closed stdout' |