interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / quiet / tests / mutants.sh

27 lines · 1753 bytes Raw Blame History
1#!/bin/bash
2# ORACLE: negative controls for quiet/tests/check.sh. Not product code.
3# Each mutant is one sed expression that takes one bound fix back out of the test build
4# (QUIET_MUTANT); check.sh must then FAIL, and its log must hold the line named here. A mutant that
5# does not build, or a run that fails for another reason only, counts as SURVIVED.
6# QUIET_LOCK=<pool lock> QUIET_PORT=<port> FORGED_CPUS=<cores> bash quiet/tests/mutants.sh [LOGDIR]
7# About one check.sh run per mutant.
8set -u
9H=$(cd "$(dirname "$0")" && pwd)
10D=${1:-$(mktemp -d /tmp/quiet-mutants.XXXXXX)}
11mkdir -p "$D"
12K=0; S=0
13run() { # run NAME SED WANT: WANT is a fixed string that the failing log must contain
14 QUIET_MUTANT=$2 bash "$H/check.sh" > "$D/$1.log" 2>&1; rc=$?
15 if [ "$rc" != 0 ] && grep -q '^MUTANT ' "$D/$1.log" && grep -q -F "$3" "$D/$1.log"; then
16 K=$((K+1)); echo "KILLED $1: exit $rc; $(grep -F "$3" "$D/$1.log" | head -1)"
17 else
18 S=$((S+1)); echo "SURVIVED $1: exit $rc; $(tail -1 "$D/$1.log")"
19 fi
20}
21run agent-len 's/^if gt al 39$/if gt al 4096/' 'FAIL after agent of 41 bytes: server exited rc=104'
22run repo-len 's/^if gt rl 39$/if gt rl 4096/' 'FAIL after repo of 41 bytes: server exited rc=104'
23run canon-bound '/^fn qncanh /,/^end$/s/^for i ulong n bound 200$/for i ulong n bound 64/' 'FAIL after the .receipt of the planted 65-byte cmd: server exited rc=104'
24run subs-line 's/^for i ulong sub e p bound 8192$/for i ulong sub e p bound 256/' 'FAIL after the 300-byte subscription line: server exited rc=104'
25run subs-word 's/^if or gt get qnfn 0 39 gt get qnrn 0 39$/if or gt get qnfn 0 255 gt get qnrn 0 255/' 'FAIL after the 100-byte filter word: server exited rc=104'
26echo "quiet mutants: $K killed, $S survived (logs in $D)"
27[ "$S" = 0 ]