diff --git a/tools/mutation.sh b/tools/mutation.sh index 7e2f806..ab5fdd7 100755 --- a/tools/mutation.sh +++ b/tools/mutation.sh @@ -8,6 +8,10 @@ # h: capsule reduced to centre path + destination circle (prototype H10) | i: no step cap | j: blocked trigger needs centre-on-wall # k: wall removal / door open clears blocked unconditionally (no KEEP) | l: GM moves never set/clear blocked # m: door push goes to the wrong side first | n: door push skips the validity check | o: push ignores the previous-position rule +# p: token bucket never refills | q: reqId upper bound dropped | r: malformed flood never fires | s: frame counter frozen +# t: wall removal renumbers next_wall_id (the dense-id design, #3) | u: the id counter is not loaded from the DB +# v: the id counter is never written to the DB | w: a wall may stay open | x: zero-length walls accepted +# y: wall endpoints unchecked against the world bounds | z: door.set on a plain wall accepted | z2: persisted `open` loaded inverted # Parallel: MUTATION_JOBS (default nproc/4) jobs, each in its own temp copy + nimcache; output collected, printed in fixed order. # Tests run with FFF_MUTATION=1 (iteration counts ~/10, see tests/testutil.nim scaled()); only test files holding an expected # test are run per mutation (control runs all). Debug build. Wrapped in systemd-inhibit (sleep:idle) when that works. @@ -97,9 +101,20 @@ run p "token bucket never refills" server/protocol.nim '/r.tokens = min(r.burst/ run q "reqId upper bound dropped" server/protocol.nim 's/if reqId < 0 or reqId > MaxReqId: return/if reqId < 0: return/' "$Q" run r "malformed flood never fires" server/protocol.nim 's/f.count >= MalformedFloodLimit/f.count > MalformedFloodLimit/' "$R" run s "the frame counter never advances" server/conns.nim 's/ inc c.active\[i\].frames/ discard/' "$S" +# slice 4 (#19): the wall id counter (never reused, #3), the "a wall is never open" invariant, the +# 6.1 validation (a != b, in bounds) and the persisted door state. +TW="never reuses|id counter survives" +run t "wall removal renumbers next_wall_id" server/world.nim 's/^ sc\.walls\.delete idx\.get$/ sc.walls.delete idx.get; sc.nextWallId = sc.walls.len + 1/' "$TW" +run u "the id counter is not loaded from the DB" server/world.nim 's/nextWallId: parseInt(row\[10\])/nextWallId: 1/' "$TW" +run v "the id counter is never written to the DB" server/world.nim '/db.exec(sql"UPDATE scene SET next_wall_id/d' "$TW" +run w "a wall may stay open" server/world.nim 's/^ if result\.kind == wkWall: result\.open = false$/ discard/' "a wall is never open" +run x "zero-length walls accepted" server/world.nim 's/ (rec\.a\.x != rec\.b\.x or rec\.a\.y != rec\.b\.y) and inBounds/ inBounds/' "zero-length wall" +run y "wall endpoints unchecked against the world bounds" server/world.nim 's/p\.x >= 0 and p\.y >= 0 and p\.x <= sc\.w and p\.y <= sc\.h/p.x >= 0 and p.y >= 0/' "both endpoints must be inside" +run z "door.set accepted on a plain wall" server/world.nim '/if sc.walls\[idx.get\].kind != wkDoor: return waNotDoor/d' "wrong kinds are their own" +run z2 "persisted open state loaded inverted" server/world.nim 's/open: row\[6\] == "1",/open: row[6] == "0",/' "round-trip through a reload" wait rc=0; : > "$LOG" -for id in control a b c d1 d2 e f g h i j k l m n o p q r s; do +for id in control a b c d1 d2 e f g h i j k l m n o p q r s t u v w x y z z2; do [ -f "$T/$id/res" ] && cat "$T/$id/res" >> "$LOG" if [ -f "$T/$id/verdict" ]; then tee -a "$LOG" < "$T/$id/verdict"; [ "$(cat "$T/$id/rc")" = 0 ] || rc=1 else echo "$id: NO RESULT (job killed?)" | tee -a "$LOG"; rc=1; fi