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/blob/main/tests/bots/run.sh # aien aien-dev/aien 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 / tests / bots / run.sh` 345 lines ยท 16924 bytes Raw Blame History 1 #!/bin/bash 2 # Harness/oracle only. Production logic remains in src/bots/bots.om. 3 set -eu 4 set -o pipefail 5 HERE=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd) 6 hex() { printf '%064x' "$1"; } 7 K=$(hex 1); L=$(hex 2); R=$(hex 3); W=$(hex 4); H=$(hex 5); V=$(hex 6); Z=$(hex 0) 8 fail() { echo "FAIL $*"; exit 1; } 9 pass() { echo "PASS $*"; } 10 probe_result() { 11 # A separate receipt preserves the binary status even though the assertion child exits 1. 12 if [ -n "${PROBE_META:-}" ]; then 13 printf '%s\t%s\t%s\n' "$1" "$2" "$3" > "$PROBE_META" 14 fi 15 } 16 probe_state_fail() { 17 probe_result 0 0 KILLED_STATE 18 fail "$*" 19 } 20 classify_status() { 21 local expected=$1 actual=$2 22 if ((actual>=101 && actual<=114)); then echo TRAPPED 23 elif ((actual>128 && actual<=192)); then echo SIGNALLED 24 elif [ "$actual" = 0 ] && [ "$expected" != 0 ]; then echo KILLED_ADMIT 25 elif ((actual>=2 && actual<=19)) && [ "$(cat "$T/out")" = "REFUSE $actual" ]; then echo KILLED_CODE 26 else echo ERROR 27 fi 28 } 29 invoke() { 30 local expected=$1; shift 31 set +e 32 "$@" > "$T/out" 2> "$T/err" 33 local rc=$? 34 set -e 35 probe_result "$expected" "$rc" SURVIVED 36 if [ "$rc" != "$expected" ]; then 37 probe_result "$expected" "$rc" "$(classify_status "$expected" "$rc")" 38 cat "$T/out" "$T/err" 39 fail "expected=$expected observed=$rc command=$*" 40 fi 41 if [ "$expected" -ge 2 ] && [ "$expected" -le 19 ]; then 42 if [ "$(cat "$T/out")" != "REFUSE $expected" ]; then 43 probe_result "$expected" "$rc" KILLED_OUTPUT 44 fail "refusal output $*" 45 fi 46 fi 47 pass "rc=$rc $*" 48 } 49 patch() { # fixture modification, not runtime implementation 50 printf '%s' "$3" | xxd -r -p | dd of="$1" bs=1 seek="$2" conv=notrunc status=none 51 } 52 seal() { 53 local h 54 h=$(dd if="$1" bs=1 count=992 status=none | sha256sum | cut -c1-64) 55 patch "$1" 992 "$h" 56 } 57 record() { 58 dd if="$1" of="$2" bs=1024 skip="$3" count=1 status=none 59 } 60 sequence() { patch "$1" 8 "$(printf '%016x' "$2")"; seal "$1"; } 61 fixture_probe() { 62 local g=$1; B=$2; F=$3 63 T=$(mktemp -d "$4/probe-$g-XXXXXX") 64 local j=$T/j 65 case "$g" in 66 hex) invoke 2 "$B" rotate "$j" "${K}0" "$W";; 67 nonzero) invoke 4 "$B" rotate "$j" "$Z" "$W";; 68 refs) invoke 2 "$B" register "$j" "$K" "$L" "$R" Allen bad - -;; 69 name) invoke 2 "$B" register "$j" "$K" "$L" "$R" '' - - -;; 70 current) cp "$F/stale" "$j"; invoke 15 "$B" ack "$j" "$ID" "$MID" "$W";; 71 registered) cp "$F/base" "$j"; invoke 10 "$B" register "$j" "$K" "$L" "$R" Allen "$K,$L" "$R" "$H";; 72 botcap) cp "$F/botcap" "$j"; invoke 5 "$B" register "$j" "$(hex 999)" "$L" "$R" Extra - - -;; 73 leaseunique) cp "$F/lease" "$j"; invoke 13 "$B" rotate "$j" "$ID" "$W";; 74 dedup) cp "$F/acked" "$j"; cp "$j" "$T/before"; invoke 0 "$B" deliver "$j" "$ID" "$K" hello "$H"; [ "$(cat "$T/out")" = "DUPLICATE $MID" ] || probe_state_fail duplicate-output; cmp "$j" "$T/before" || probe_state_fail duplicate-append; pass duplicate-no-append;; 75 msgcap) cp "$F/msgcap" "$j"; invoke 5 "$B" deliver "$j" "$ID" "$K" overflow "$H";; 76 pending) cp "$F/acked" "$j"; invoke 16 "$B" claim "$j" "$ID" "$MID" "$V";; 77 claimed) cp "$F/acked" "$j"; invoke 17 "$B" ack "$j" "$ID" "$MID" "$V";; 78 claimant) cp "$F/claimed" "$j"; invoke 18 "$B" ack "$j" "$ID" "$MID" "$V";; 79 expiry) cp "$F/claimed" "$j"; invoke 19 "$B" expire "$j" "$ID" "$MID" "$W";; 80 active) cp "$F/retired" "$j"; invoke 12 "$B" deliver "$j" "$ID" "$K" hello "$H";; 81 type) cp "$F/type" "$j"; invoke 6 "$B" show "$j";; 82 magic) cp "$F/magic" "$j"; invoke 6 "$B" show "$j";; 83 botvalue) cp "$F/botvalue" "$j"; invoke 6 "$B" show "$j";; 84 reserved) cp "$F/reserved" "$j"; invoke 6 "$B" show "$j";; 85 bindings) cp "$F/bindings" "$j"; invoke 6 "$B" show "$j";; 86 identity) cp "$F/identity" "$j"; invoke 6 "$B" show "$j";; 87 display) cp "$F/display" "$j"; invoke 6 "$B" show "$j";; 88 nonempty) cp "$F/nonempty" "$j"; invoke 6 "$B" show "$j";; 89 leasevalue) cp "$F/leasevalue" "$j"; invoke 6 "$B" show "$j";; 90 envelope) cp "$F/envelope" "$j"; invoke 6 "$B" show "$j";; 91 content) cp "$F/content" "$j"; invoke 6 "$B" show "$j";; 92 transition) cp "$F/transition" "$j"; invoke 6 "$B" show "$j";; 93 padding) cp "$F/padding" "$j"; invoke 6 "$B" show "$j";; 94 sequence) cp "$F/sequence" "$j"; invoke 7 "$B" show "$j";; 95 checksum) cp "$F/checksum" "$j"; invoke 8 "$B" show "$j";; 96 lock) cp "$F/base" "$j"; exec 8>"$j.lock"; flock -x 8; invoke 9 "$B" show "$j"; flock -u 8; exec 8>&-;; 97 alignment) dd if="$F/base" of="$j" bs=1 count=1000 status=none; invoke 6 "$B" show "$j";; 98 eventcap) cp "$F/eventcap" "$j"; invoke 5 "$B" nack "$j" "$ID" "$MID" "$W";; 99 *) fail "unknown probe $g";; 100 esac 101 } 102 barrier_probe() { 103 B=$1 104 T=$(mktemp -d "$2/barrier-XXXXXX") 105 local j=$T/j trace=$T/commit.strace line fd kind events='' 106 declare -A kinds=() 107 if ! command -v strace >/dev/null; then 108 echo 'NOT_RUN commit barriers: strace unavailable' 109 probe_result 0 NA ERROR 110 fail 'strace required' 111 fi 112 invoke 0 strace -qq -s 4096 -o "$trace" -e trace=openat,close,fsync,renameat2 \ 113 "$B" register "$j" "$K" "$L" "$R" Allen - - - 114 while IFS= read -r line; do 115 if [[ "$line" == openat* && "$line" =~ =[[:space:]]([0-9]+)$ ]]; then 116 fd=${BASH_REMATCH[1]} 117 if [[ "$line" == *"\"$j.cand\""* ]]; then kinds[$fd]=candidate 118 elif [[ "$line" == *O_DIRECTORY* ]]; then kinds[$fd]=directory 119 else kinds[$fd]=other 120 fi 121 elif [[ "$line" =~ ^fsync\(([0-9]+)\)[[:space:]]*=[[:space:]]0$ ]]; then 122 fd=${BASH_REMATCH[1]}; kind=${kinds[$fd]:-unknown} 123 events="${events}${kind} " 124 elif [[ "$line" == renameat2* && "$line" == *"\"$j.cand\""* && "$line" == *"\"$j\""* && "$line" =~ =[[:space:]]0$ ]]; then 125 events="${events}rename " 126 elif [[ "$line" =~ ^close\(([0-9]+)\) ]]; then 127 unset "kinds[${BASH_REMATCH[1]}]" 128 fi 129 done < "$trace" 130 printf '%s\n' "$events" > "$T/barriers.txt" 131 if [ "$events" != 'candidate rename directory ' ]; then 132 probe_result 0 0 KILLED_BARRIER 133 fail "commit barriers expected=candidate,rename,directory observed=$events trace=$trace" 134 fi 135 pass "commit-barrier-order trace=$trace (not power-loss qualification)" 136 } 137 if [ "${1:-}" = --barrier ]; then 138 barrier_probe "$2" "$3" 139 exit 0 140 fi 141 if [ "${1:-}" = --probe ]; then 142 ID=$5; MID=$6 143 fixture_probe "$2" "$3" "$4" "$7" 144 exit 0 145 fi 146 : "${BOTS_RUN_ROOT:?set an external BOTS_RUN_ROOT}" 147 : "${OMEGA_OMC:?set pinned OMEGA_OMC}" 148 : "${OMEGA_MV:?set OMEGA_MV checkout}" 149 case "$BOTS_RUN_ROOT" in "$HERE"|"$HERE"/*) fail 'run root must be external';; esac 150 mkdir -p "$BOTS_RUN_ROOT" 151 [ ! -e "$BOTS_RUN_ROOT/transcript" ] || fail 'use a fresh run root' 152 exec > >(tee "$BOTS_RUN_ROOT/transcript") 2>&1 153 if ! command -v strace >/dev/null; then 154 printf 'barriers=NOT_RUN\nreason=strace unavailable\n' > "$BOTS_RUN_ROOT/results.txt" 155 fail 'NOT_RUN: strace required for commit-barrier acceptance' 156 fi 157 T=$BOTS_RUN_ROOT/work 158 F=$BOTS_RUN_ROOT/fixtures 159 mkdir -p "$T" "$F" "$BOTS_RUN_ROOT/mutants" 160 B=$BOTS_RUN_ROOT/bots 161 sh "$HERE/scripts/bots/build.sh" "$B" > "$BOTS_RUN_ROOT/build.txt" 162 sha256sum "$OMEGA_OMC" "$HERE/src/bots/bots.om" "$HERE/scripts/bots/build.sh" "$0" > "$BOTS_RUN_ROOT/sources.sha256" 163 j=$T/j 164 invoke 0 "$B" show "$j" 165 [ ! -s "$T/out" ] || fail empty-show 166 invoke 0 "$B" register "$j" "$K" "$L" "$R" Allen "$K,$L" "$R" "$H" 167 ID=${ID:-$(cut -d' ' -f2 "$T/out")} 168 ORACLE=$({ printf 'AIEN-BOT-V1\0'; printf '%s' "$K$L$R" | xxd -r -p; } | sha256sum | cut -c1-64) 169 [ "$ID" = "$ORACLE" ] || fail identity-oracle 170 pass independent-identity-sha256 171 cp "$j" "$F/base" 172 invoke 0 "$B" rotate "$j" "$ID" "$W"; cp "$j" "$F/lease" 173 invoke 0 "$B" deliver "$j" "$ID" "$K" hello "$H" 174 MID=$(cut -d' ' -f2 "$T/out") 175 PD=$(printf hello | sha256sum | cut -c1-64) 176 ORACLE=$({ printf 'AIEN-BOT-MESSAGE-V1\0'; printf '%s' "$ID$K$PD$H" | xxd -r -p; } | sha256sum | cut -c1-64) 177 [ "$MID" = "$ORACLE" ] || fail message-oracle 178 pass independent-message-sha256 179 cp "$j" "$F/pending" 180 invoke 0 "$B" claim "$j" "$ID" "$MID" "$W"; cp "$j" "$F/claimed" 181 invoke 0 "$B" nack "$j" "$ID" "$MID" "$W" 182 invoke 0 "$B" claim "$j" "$ID" "$MID" "$W" 183 # Keep minimal fixtures to make the exact historical sequence unambiguous. 184 cp "$F/claimed" "$j" 185 invoke 0 "$B" rotate "$j" "$ID" "$V"; cp "$j" "$F/stale" 186 invoke 0 "$B" expire "$j" "$ID" "$MID" "$W"; cp "$j" "$F/expired" 187 invoke 0 "$B" claim "$j" "$ID" "$MID" "$V"; cp "$j" "$F/claim2" 188 invoke 0 "$B" ack "$j" "$ID" "$MID" "$V"; cp "$j" "$F/acked" 189 invoke 0 "$B" retire "$j" "$ID"; cp "$j" "$F/retired" 190 invoke 0 "$B" show "$j"; cp "$T/out" "$BOTS_RUN_ROOT/final-state.txt" 191 invoke 0 "$B" show "$j"; cmp "$T/out" "$BOTS_RUN_ROOT/final-state.txt"; pass deterministic-replay 192 # Typed, rechecksummed adversarial fixtures. The checksum is integrity, not authentication. 193 for name in magic reserved bindings identity display nonempty padding sequence checksum; do cp "$F/base" "$F/$name"; done 194 patch "$F/magic" 0 00; seal "$F/magic" 195 patch "$F/reserved" 5 01; seal "$F/reserved" 196 patch "$F/identity" 16 "$K"; seal "$F/identity" 197 patch "$F/display" 144 01; seal "$F/display" 198 printf '%0128d' 0 | xxd -r -p | dd of="$F/nonempty" bs=1 seek=144 conv=notrunc status=none; seal "$F/nonempty" 199 patch "$F/padding" 700 01; seal "$F/padding" 200 sequence "$F/sequence" 2 201 patch "$F/checksum" 1023 ff 202 patch "$F/bindings" 48 "$Z" 203 NEWID=$({ printf 'AIEN-BOT-V1\0'; printf '%s' "$Z$L$R" | xxd -r -p; } | sha256sum | cut -c1-64) 204 patch "$F/bindings" 16 "$NEWID"; seal "$F/bindings" 205 record "$F/retired" "$T/rec" 8 206 patch "$T/rec" 4 09; sequence "$T/rec" 2; cat "$F/base" "$T/rec" > "$F/type" 207 patch "$T/rec" 4 08; patch "$T/rec" 16 "$Z"; seal "$T/rec"; cat "$F/base" "$T/rec" > "$F/botvalue" 208 record "$F/lease" "$T/rec" 1; patch "$T/rec" 48 "$Z"; seal "$T/rec"; cat "$F/base" "$T/rec" > "$F/leasevalue" 209 record "$F/pending" "$T/rec" 2; patch "$T/rec" 48 "$Z" 210 NEWMID=$({ printf 'AIEN-BOT-MESSAGE-V1\0'; printf '%s' "$ID$Z$PD$H" | xxd -r -p; } | sha256sum | cut -c1-64) 211 patch "$T/rec" 144 "$NEWMID"; seal "$T/rec"; cat "$F/lease" "$T/rec" > "$F/envelope" 212 record "$F/pending" "$T/rec" 2; patch "$T/rec" 144 "$K"; seal "$T/rec"; cat "$F/lease" "$T/rec" > "$F/content" 213 record "$F/claimed" "$T/rec" 3; patch "$T/rec" 80 "$Z"; seal "$T/rec"; cat "$F/pending" "$T/rec" > "$F/transition" 214 # Capacity fixtures derive valid records with the independent SHA-256 oracle. 215 : > "$F/botcap" 216 for ((i=1;i<=64;i++)); do 217 cp "$F/base" "$T/rec"; PK=$(hex "$i"); patch "$T/rec" 48 "$PK" 218 BI=$({ printf 'AIEN-BOT-V1\0'; printf '%s' "$PK$L$R" | xxd -r -p; } | sha256sum | cut -c1-64) 219 patch "$T/rec" 16 "$BI"; sequence "$T/rec" "$i"; cat "$T/rec" >> "$F/botcap" 220 done 221 cp "$F/lease" "$F/msgcap" 222 for ((i=1;i<=256;i++)); do 223 record "$F/pending" "$T/rec" 2; HH=$(hex "$i"); patch "$T/rec" 112 "$HH" 224 MI=$({ printf 'AIEN-BOT-MESSAGE-V1\0'; printf '%s' "$ID$K$PD$HH" | xxd -r -p; } | sha256sum | cut -c1-64) 225 patch "$T/rec" 144 "$MI"; sequence "$T/rec" "$((i+2))"; cat "$T/rec" >> "$F/msgcap" 226 done 227 cp "$F/pending" "$F/eventcap" 228 for ((i=4;i<=1024;i++)); do 229 record "$F/claimed" "$T/rec" 3 230 if ((i%2)); then patch "$T/rec" 4 06; fi 231 sequence "$T/rec" "$i"; cat "$T/rec" >> "$F/eventcap" 232 done 233 # Every catalogued state/integrity guard has a baseline refusal and a compiling removal mutant. 234 GUARDS=$(sed -n 's/^note BOT-GUARD //p' "$HERE/src/bots/bots.om") 235 for g in $GUARDS; do fixture_probe "$g" "$B" "$F" "$BOTS_RUN_ROOT"; done 236 T=$BOTS_RUN_ROOT/work 237 # Other exact refusal surfaces: usage, I/O, missing bot and missing message. 238 invoke 2 "$B" bogus "$T/unknown" 239 invoke 2 "$B" register "$T/unknown" "$K" "$L" "$R" $'bad\nname' - - - 240 invoke 3 "$B" show "$T/absent/j" 241 cp "$F/lease" "$T/missing" 242 invoke 11 "$B" rotate "$T/missing" "$K" "$W" 243 invoke 14 "$B" claim "$T/missing" "$ID" "$K" "$W" 244 # Final components must not follow symlinks; lock/journal/candidate each independently refused. 245 for target in lock journal candidate; do 246 SJ=$T/symlink-$target 247 case "$target" in lock) ln -s "$F/base" "$SJ.lock";; journal) ln -s "$F/base" "$SJ";; candidate) cp "$F/base" "$SJ"; ln -s "$F/base" "$SJ.cand";; esac 248 if [ "$target" = candidate ]; then invoke 3 "$B" rotate "$SJ" "$ID" "$W"; else invoke 3 "$B" show "$SJ"; fi 249 done 250 # Each typed transition is killed after candidate open, prefix write, event write, 251 # candidate fsync, rename and directory fsync. Before rename old state; after rename new. 252 for op in register rotate deliver claim ack nack expire retire; do 253 case "$op" in 254 register) pre=; args=(register "$K" "$L" "$R" Allen "$K,$L" "$R" "$H");; 255 rotate) pre=base; args=(rotate "$ID" "$W");; 256 deliver) pre=lease; args=(deliver "$ID" "$K" hello "$H");; 257 claim) pre=pending; args=(claim "$ID" "$MID" "$W");; 258 ack) pre=claimed; args=(ack "$ID" "$MID" "$W");; 259 nack) pre=claimed; args=(nack "$ID" "$MID" "$W");; 260 expire) pre=stale; args=(expire "$ID" "$MID" "$W");; 261 retire) pre=base; args=(retire "$ID");; 262 esac 263 d=$BOTS_RUN_ROOT/crash/$op; mkdir -p "$d" 264 [ -z "$pre" ] || cp "$F/$pre" "$d/expected" 265 invoke 0 "$B" "${args[0]}" "$d/expected" "${args[@]:1}" 266 invoke 0 "$B" show "$d/expected"; cp "$T/out" "$d/new-show" 267 for boundary in 1 2 3 4 5 6; do 268 cj=$d/j-$boundary 269 [ -z "$pre" ] || cp "$F/$pre" "$cj" 270 invoke 137 env BOTS_KILL=$boundary "$B" "${args[0]}" "$cj" "${args[@]:1}" 271 if [ "$boundary" -lt 5 ]; then 272 if [ -n "$pre" ]; then cmp "$F/$pre" "$cj"; else [ ! -e "$cj" ] || fail crash-created; fi 273 invoke 0 "$B" show "$cj"; cp "$T/out" "$d/old-show-$boundary" 274 if [ -n "$pre" ]; then invoke 0 "$B" show "$F/$pre"; cmp "$T/out" "$d/old-show-$boundary"; else [ ! -s "$d/old-show-$boundary" ] || fail crash-old; fi 275 invoke 0 "$B" "${args[0]}" "$cj" "${args[@]:1}" 276 fi 277 cmp "$d/expected" "$cj" || fail "crash journal $op/$boundary" 278 invoke 0 "$B" show "$cj"; cmp "$T/out" "$d/new-show" || fail "crash replay $op/$boundary" 279 pass "crash-equality $op/$boundary" 280 done 281 done 282 # An arbitrary torn, uncommitted candidate is ignored, then safely overwritten. 283 cp "$F/pending" "$T/torn"; dd if="$F/claimed" of="$T/torn.cand" bs=1 count=3500 status=none 284 invoke 0 "$B" show "$T/torn"; cp "$T/out" "$T/torn-show" 285 invoke 0 "$B" show "$F/pending"; cmp "$T/out" "$T/torn-show"; pass torn-candidate-ignored 286 invoke 0 "$B" claim "$T/torn" "$ID" "$MID" "$W"; cmp "$T/torn" "$F/claimed"; pass torn-candidate-replaced 287 barrier_probe "$B" "$BOTS_RUN_ROOT" 288 printf 'guard\tbuild_exit\tprobe_exit\texpected_binary_exit\tbinary_exit\tverdict\n' > "$BOTS_RUN_ROOT/mutants.tsv" 289 declare -A counts=() 290 for g in $GUARDS fsync-candidate fsync-directory barrier-order; do 291 md=$BOTS_RUN_ROOT/mutants/$g; mkdir -p "$md" 292 case "$g" in 293 dedup) 294 sed '/^note BOT-GUARD dedup$/{n;s/.*/put BV 3 0/;}' "$HERE/src/bots/bots.om" > "$md/bots.om";; 295 fsync-candidate) 296 sed 's/^bcheck eq fsync fd 0 3$/bcheck true 3/' "$HERE/src/bots/bots.om" > "$md/bots.om";; 297 fsync-directory) 298 sed 's/^bcheck eq fsync df 0 3$/bcheck true 3/' "$HERE/src/bots/bots.om" > "$md/bots.om";; 299 barrier-order) 300 # Keep both barriers, but move the atomic rename before candidate fsync. 301 sed '/^bcheck eq renames BN 0 get BV 6 0 0 3$/d; /^bcheck eq fsync fd 0 3$/i bcheck eq renames BN 0 get BV 6 0 0 3' "$HERE/src/bots/bots.om" > "$md/bots.om";; 302 *) 303 sed "/^note BOT-GUARD $g\$/{n;s/^bcheck .*/bcheck true 99/;}" "$HERE/src/bots/bots.om" > "$md/bots.om";; 304 esac 305 cmp -s "$md/bots.om" "$HERE/src/bots/bots.om" && fail "no mutation $g" 306 set +e 307 BOTS_SOURCE=$md/bots.om sh "$HERE/scripts/bots/build.sh" "$md/bots" > "$md/build.txt" 2>&1 308 build_rc=$? 309 set -e 310 rc=NA; expected=NA; actual=NA; verdict=ERROR 311 if [ "$build_rc" = 0 ]; then 312 set +e 313 case "$g" in 314 fsync-*|barrier-order) PROBE_META=$md/outcome.tsv bash "$0" --barrier "$md/bots" "$md" > "$md/probe.txt" 2>&1;; 315 *) PROBE_META=$md/outcome.tsv bash "$0" --probe "$g" "$md/bots" "$F" "$ID" "$MID" "$md" > "$md/probe.txt" 2>&1;; 316 esac 317 rc=$? 318 set -e 319 if [ -f "$md/outcome.tsv" ]; then 320 IFS=$'\t' read -r expected actual verdict < "$md/outcome.tsv" 321 # An assertion child that failed without recording a specific counterexample is infrastructure failure. 322 if [ "$rc" != 0 ] && [ "$verdict" = SURVIVED ]; then verdict=ERROR; fi 323 if [ "$rc" = 0 ] && [ "$verdict" != SURVIVED ]; then verdict=ERROR; fi 324 fi 325 fi 326 counts[$verdict]=$((${counts[$verdict]:-0}+1)) 327 printf '%s\t%s\t%s\t%s\t%s\t%s\n' "$g" "$build_rc" "$rc" "$expected" "$actual" "$verdict" >> "$BOTS_RUN_ROOT/mutants.tsv" 328 echo "$verdict $g binary_exit=$actual probe_exit=$rc" 329 done 330 { 331 for verdict in KILLED_ADMIT KILLED_CODE KILLED_STATE KILLED_OUTPUT KILLED_BARRIER TRAPPED SIGNALLED ERROR SURVIVED; do 332 printf '%s=%s\n' "$verdict" "${counts[$verdict]:-0}" 333 done 334 printf 'crash_cases=48\nbarriers=PASS\n' 335 } > "$BOTS_RUN_ROOT/results.txt" 336 cat "$BOTS_RUN_ROOT/results.txt" 337 # Fixed-capacity array bounds make botcap/msgcap removals trap; do not claim semantic kills. 338 while IFS=$'\t' read -r g build_rc rc expected actual verdict; do 339 case "$verdict" in 340 KILLED_*) ;; 341 TRAPPED) [[ "$g" = botcap || "$g" = msgcap ]] && [ "$actual" = 103 ] || fail "unexpected trap $g=$actual";; 342 *) fail "unqualified mutant $g verdict=$verdict";; 343 esac 344 done < <(sed '1d' "$BOTS_RUN_ROOT/mutants.tsv") 345 pass 'ALL classified mutants; 48 crash equalities; commit barrier order PASS (not power-loss qualification)'