Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/om/blake3/parity/run.sh # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / om / blake3 / parity / run.sh` 53 lines ยท 3131 bytes Raw Blame History 1 #!/bin/sh 2 # Parity of the Omega BLAKE3 (src/omega_blake3.c adapter + om/blake3/b3unit.om, generated into src/omega_om_units.c) 3 # against the C it replaced: src/omega_blake3.c at `633a1735` (sha256 `c89ef819`...0f21). The 35 official 4 # vectors (tests/resolve/blake3_vectors.txt) and 1000 inputs (boundaries, random to 3 MiB) must agree. 5 # Then the two mutants that make test-resolve used to apply to the C (B3M:merge, B3M:root) are 6 # applied to b3unit.om; each rebuilt library must fail the official vectors. 7 # OMEGA_OMC, OMEGA_BRIDGE as for om/units.sh (exit 3 NOT_RUN without them) 8 set -eu 9 ROOT=$(cd "$(dirname "$0")/../../.." && pwd) 10 T=$(mktemp -d); trap 'rm -rf "$T"' EXIT 11 ORACLE=`633a17353ba9a62761c9ccb83416d0dbd1689cfe` 12 V=$ROOT/tests/resolve/blake3_vectors.txt 13 git -C "$ROOT" show "$ORACLE:src/omega_blake3.c" > "$T/c.c" 14 [ "$(sha256sum < "$T/c.c" | cut -c1-64)" = `c89ef819cb5fd4a77a2efe89cfb8d319d1fd2d07e14f02e4ffe263db334d0f21` ] 15 sed 's/omega_blake3_hash/orc_blake3_hash/' "$T/c.c" > "$T/oracle.c" 16 CF="-std=gnu11 -Wall -Wextra -Werror -D_GNU_SOURCE -O2" 17 build() { # build 18 cc $CF -I"$1" -c "$1/omega_blake3.c" -o "$T/b3.o" 19 cc $CF -I"$1" -c "$1/omega_om_units.c" -o "$T/sha.o" 20 cc -O2 -I"$ROOT/src" -c "$T/oracle.c" -o "$T/oracle.o" 21 cc -O2 "$(dirname "$0")/par.c" "$T/b3.o" "$T/sha.o" "$T/oracle.o" -o "$2" -pthread 22 } 23 build "$ROOT/src" "$T/par" 24 out=$("$T/par" "$V" | tail -1); echo "$out" 25 [ "$out" = "vectors=35 vecfail=0 cases=1000 diff=0" ] || { echo "BLAKE3-PARITY FAIL"; exit 1; } 26 # The mutants are part of the verdict: without the pinned tools this is NOT_RUN (exit 3), never PASS. 27 [ -n "${OMEGA_OMC:-}" ] && [ -n "${OMEGA_BRIDGE:-}" ] || { echo "BLAKE3-PARITY NOT_RUN: the mutants need OMEGA_OMC and OMEGA_BRIDGE"; exit 3; } 28 mutant() { # mutant 29 rm -rf "$T/m"; mkdir -p "$T/m/om" "$T/m/gpu" "$T/m/seed" 30 cp -r "$ROOT/om/." "$T/m/om/"; cp -r "$ROOT/src" "$T/m/src" 31 cp -r "$ROOT/gpu/." "$T/m/gpu/" 32 cp -r "$ROOT/seed/authority" "$ROOT/seed/build" "$ROOT/seed/out" "$T/m/seed/" 33 python3 - "$T/m/om/blake3/b3unit.om" "$2" "$3" <<'PY' 34 import sys 35 p, old, new = sys.argv[1:] 36 s = open(p).read() 37 assert s.count(old + "\n") == 1, "mutant line not found once" 38 open(p, "w").write(s.replace(old + "\n", new + "\n")) 39 PY 40 sh "$T/m/om/units.sh" > /dev/null 41 build "$T/m/src" "$T/mpar" 42 # Killed means: the driver ran to the end and reported exactly the expected official-vector failures 43 # (exit 1, summary line present). A crash, abort or other exit is not a kill. 44 rc=0; "$T/mpar" "$V" > "$T/m.out" 2>&1 || rc=$? 45 got=$(grep -c 'VEC FAIL' "$T/m.out") 46 if [ "$rc" -ne 1 ] || ! grep -q "^vectors=35 vecfail=$4 " "$T/m.out" || [ "$got" -ne "$4" ]; then 47 echo "mutant $1 NOT killed as required (exit $rc, $got vector failures, want exit 1 and $4)"; tail -3 "$T/m.out"; exit 1 48 fi 49 echo "mutant $1 killed (exit 1, $got of 35 vectors differ)" 50 } 51 mutant b3-merge 'while eq and tot 1 0 bound 64' 'while and eq and tot 1 0 gt get st 440 1 bound 64' 16 52 mutant b3-root 'put w 74 or get w 74 8' 'put w 74 or get w 74 0' 35 53 echo "BLAKE3-PARITY PASS"