aien-train
AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.
Brought by drakestapleton
aien-train / tests / omegallm / serve-mutants.sh
| 1 | #!/bin/sh |
| 2 | # serve-mutants.sh: negative controls of the serve gate (DRA-119). Each serve mutant of build.sh |
| 3 | # (one serve.om constant set to 0) is built and run through serve-check.sh, which must exit nonzero |
| 4 | # with the check written for that mutant failing: |
| 5 | # smeth OMUTMETH a known path answers other methods -> FAIL refuse_405 |
| 6 | # spath OMUTPATH other paths answered as /health -> FAIL refuse_404 |
| 7 | # sbig OMUTBIG an over-bound body gets 400, not 413 -> FAIL refuse_413 |
| 8 | # sjson OMUTJSON malformed JSON is served, not refused -> FAIL refuse_bad_json |
| 9 | # sloop OMUTLOOP listens on 0.0.0.0, not 127.0.0.1 -> bind_loopback_only 0 |
| 10 | # sseed OMUTSEED request seed shifted by one -> FAIL parity_json_t800_seed7_n12 |
| 11 | # smid OMUTMID reports the fixed id `ollm` -> FAIL models |
| 12 | # Every run is inside a private network namespace (bwrap --unshare-net, loopback only), so the |
| 13 | # sloop mutant's 0.0.0.0 listener reaches no outside interface. |
| 14 | # Env: OMC (the aarch64 pin of build.sh), CK, MERGES, OUT (receipt directory), BUILD (scratch for |
| 15 | # the mutant binaries), CORES (default 8-9), PORT (default 18292; the gate's second server takes |
| 16 | # PORT + 1). Prints one line per mutant, |
| 17 | # `MUTANT name CAUGHT|MISSED|BUILD_FAIL ...`, then `MUTANTS caught=N of M`; exit 0 only when every |
| 18 | # mutant is caught. |
| 19 | set -u |
| 20 | : "${OMC:?}" "${CK:?}" "${MERGES:?}" "${OUT:?}" "${BUILD:?}" |
| 21 | CORES=${CORES:-8-9} |
| 22 | PORT=${PORT:-18292} |
| 23 | here=$(cd "$(dirname "$0")" && pwd) |
| 24 | mkdir -p "$OUT" "$BUILD" |
| 25 | caught=0 |
| 26 | total=0 |
| 27 | for m in smeth:refuse_405 spath:refuse_404 sbig:refuse_413 sjson:refuse_bad_json \ |
| 28 | sloop:bind_loopback_only sseed:parity_json_t800_seed7_n12 smid:models; do |
| 29 | name=${m%%:*} |
| 30 | want=${m#*:} |
| 31 | total=$((total + 1)) |
| 32 | if ! OMC=$OMC OUT=$BUILD CORE=${CORES%%[-,]*} sh "$here/build.sh" --mutant "$name" >"$OUT/build-$name.log" 2>&1; then |
| 33 | echo "MUTANT $name BUILD_FAIL $(tail -1 "$OUT/build-$name.log")" |
| 34 | continue |
| 35 | fi |
| 36 | bwrap --dev-bind / / --unshare-net --proc /proc -- env OLLM="$BUILD/ollm-mut-$name" CK="$CK" \ |
| 37 | MERGES="$MERGES" OUT="$OUT/$name" PORT="$PORT" TPORT="$((PORT + 1))" CORES="$CORES" sh "$here/serve-check.sh" >"$OUT/$name.log" 2>&1 |
| 38 | rc=$? |
| 39 | if [ $rc -ne 0 ] && grep -Eq "^(FAIL $want |$want 0 )" "$OUT/$name/referee.txt" 2>/dev/null; then |
| 40 | caught=$((caught + 1)) |
| 41 | echo "MUTANT $name CAUGHT exit=$rc by $want; failing: $(grep -E '^FAIL |^[a-z_]+ 0 ' "$OUT/$name/referee.txt" | cut -d' ' -f1-2 | tr '\n' ' ')" |
| 42 | else |
| 43 | echo "MUTANT $name MISSED exit=$rc want $want" |
| 44 | fi |
| 45 | done |
| 46 | echo "MUTANTS caught=$caught of $total" |
| 47 | [ $caught -eq $total ] |