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/aien-protocols-mv/blob/main/specs/osh-platform/tools/mutate-stream-ref.sh # aien-protocols-mv Canonical specifications, wire protocols, and schemas for the AIEN sovereign ecosystem Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-protocols-mv / specs / osh-platform / tools / mutate-stream-ref.sh` 30 lines ยท 1279 bytes Raw Blame History 1 #!/bin/bash 2 # mutate-stream-ref.sh: show that every check in osh_sv_ref.c is exercised by the stream and task vectors. 3 # Builds one model per check with that check disabled (-DSV_MUTANT=K, the order of `enum mut`) and 4 # requires the corpus to report at least one mismatch. A mutant the vectors do not notice is a SURVIVOR 5 # and fails this script. 6 # 7 # Usage: mutate-stream-ref.sh [CC] 8 set -eu 9 export LC_ALL=C 10 here=$(cd "$(dirname "$0")" && pwd) 11 vec="$here/../vectors" 12 CC=${1:-cc} 13 tmp=$(mktemp -d) 14 trap 'rm -rf "$tmp"' EXIT 15 names=$(sed -n '/MUT_WRITE_RIGHT = 1/,/MUT_LAST/p' "$here/osh_sv_ref.c" | tr -d ' \n' | sed 's/MUT_WRITE_RIGHT=1/MUT_WRITE_RIGHT/; s/,MUT_LAST.*//' | tr ',' ' ') 16 test -n "$names" || { echo "cannot read the check list" >&2; exit 2; } 17 k=0 killed=0 survived=0 18 for name in $names; do 19 k=$((k + 1)) 20 "$CC" -std=c99 -O1 -w -DSV_MUTANT=$k -o "$tmp/m$k" "$here/osh_sv_ref.c" 21 if "$tmp/m$k" --corpus "$vec" >"$tmp/out$k" 2>&1; then 22 echo "SURVIVOR $k $name" 23 survived=$((survived + 1)) 24 else 25 echo "killed $k $name: $(grep -c -E 'MISMATCH|VECTOR_ERROR' "$tmp/out$k") line(s) differ" 26 killed=$((killed + 1)) 27 fi 28 done 29 echo "OSHSV1_MUTANTS total=$k killed=$killed survived=$survived" 30 test "$survived" -eq 0 && test "$k" -gt 0