From 951f37c3fb3f5deb46f39df8a9673db95c3c6189 Mon Sep 17 00:00:00 2001 From: Davide Cappellini Date: Sun, 15 Nov 2026 08:33:12 +0100 Subject: [PATCH] tools: mutations p-s for the protocol module and the n counter (#18) --- tools/mutation.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/mutation.sh b/tools/mutation.sh index 7f3f215..7e2f806 100755 --- a/tools/mutation.sh +++ b/tools/mutation.sh @@ -66,6 +66,10 @@ L="GM moves a stuck token|GM drops a token|GM manual clear inside|GM: ignores wa M="Q14: a door closed|push: centre on the door line|push: one side blocked|doorway: token in an open doorway|GM drops a token" N="push: one side blocked|push: both sides invalid" O="push: centre on the door line" +P="refill is continuous" +Q="reqId boundaries" +R="nine malformed frames are tolerated" +S="the frame counter starts at 1" IDS=() run() { while [ "$(jobs -rp | wc -l)" -ge "$JOBS" ]; do wait -n; done @@ -89,9 +93,13 @@ run l "GM moves never set or clear blocked" server/moverules.nim '/^ if who.rol run m "door push: wrong side first" server/moverules.nim 's/for sg in \[(if side > 0: 1.0 else: -1.0), (if side > 0: -1.0 else: 1.0)\]:/for sg in [(if side > 0: -1.0 else: 1.0), (if side > 0: 1.0 else: -1.0)]:/' "$M" run n "door push: no validity check" server/moverules.nim 's/if inBounds(sc, p) and not overlapsAny(sc, tt): return (true, p)/return (true, p)/' "$N" run o "door push: previous position ignored on the line" server/moverules.nim 's/side = if t.hasPrev: dot(t.prev - w.a, n) else: 0.0/side = 0.0/' "$O" +run p "token bucket never refills" server/protocol.nim '/r.tokens = min(r.burst/d' "$P" +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" wait rc=0; : > "$LOG" -for id in control a b c d1 d2 e f g h i j k l m n o; 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; 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