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 / tools / sm121dis / corpus_selftest.sh

29 lines · 1670 bytes Raw Blame History
1#!/bin/sh
2# A missing or failing producer, or one that exits 0 after a kernel could not be dumped whole, must invalidate the
3# disassembler corpus.
4set -eu
5HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
6WORK=$(mktemp -d "${TMPDIR:-/tmp}/sm121dis-corpus-control.XXXXXX")
7trap 'rm -rf "$WORK"' EXIT HUP INT TERM
8mkdir "$WORK/bin" "$WORK/missing" "$WORK/failing" "$WORK/partial"
9rc=0
10sh "$HERE/corpus.sh" "$WORK/bin" "$WORK/missing" > "$WORK/missing.log" 2>&1 || rc=$?
11[ "$rc" -eq 127 ] && grep -q 'VERDICT FAIL: corpus producer failed:' "$WORK/missing.log" || {
12 echo 'FAIL: a missing producer did not invalidate the corpus'; exit 1;
13}
14printf '#!/bin/sh\necho deliberate-producer-failure\nexit 42\n' > "$WORK/bin/gpu_matmul_api_test"
15chmod +x "$WORK/bin/gpu_matmul_api_test"
16rc=0
17sh "$HERE/corpus.sh" "$WORK/bin" "$WORK/failing" > "$WORK/failing.log" 2>&1 || rc=$?
18[ "$rc" -eq 42 ] && grep -q 'deliberate-producer-failure' "$WORK/failing.log" &&
19 grep -q 'VERDICT FAIL: corpus producer failed:' "$WORK/failing.log" || {
20 echo 'FAIL: a failing producer did not invalidate the corpus'; exit 1;
21}
22# exit 0, but omega_kernel_dump reported a kernel it could not write whole (src/omega_blackwell_codegen.c)
23printf '#!/bin/sh\necho "omega_kernel_dump: write failed, removed /x/k.bin" >&2\nexit 0\n' > "$WORK/bin/gpu_matmul_api_test"
24rc=0
25sh "$HERE/corpus.sh" "$WORK/bin" "$WORK/partial" > "$WORK/partial.log" 2>&1 || rc=$?
26[ "$rc" -eq 1 ] && grep -q 'VERDICT FAIL: kernels not captured whole:' "$WORK/partial.log" || {
27 echo 'FAIL: a kernel not captured whole did not invalidate the corpus'; exit 1;
28}
29echo 'PASS: missing and failing corpus producers are refused'