interplane-forge
INTERPLANE Forge
Brought by drakestapleton
interplane-forge / collab / tests / receipt-mutants.sh
| 1 | #!/bin/bash |
| 2 | # collab/tests/receipt-mutants.sh: negative controls for receipt.sh and links.sh. Each mutant is one sed |
| 3 | # expression on the test build (MUTX); the test must FAIL with it. Prints KILLED or SURVIVED per mutant |
| 4 | # and exits nonzero when any mutant survives. Usage: collab/tests/receipt-mutants.sh (CORES default 14) |
| 5 | set -u |
| 6 | H=$(cd "$(dirname "$0")" && pwd) |
| 7 | # A mutant that fails to build is counted SURVIVED: only a failing check kills it. |
| 8 | S=0 |
| 9 | run() { # TEST NAME SED |
| 10 | o=$(MUTX=$3 "$H/$1" 2>&1) |
| 11 | if [ $? = 0 ] || printf '%s\n' "$o" | grep -q 'BUILD FAILED'; then S=$((S+1)); echo "SURVIVED $1 $2" |
| 12 | else echo "KILLED $1 $2: $(printf '%s\n' "$o" | grep '^FAIL' | head -2 | cut -c1-120 | tr '\n' ' ')"; fi |
| 13 | } |
| 14 | run receipt.sh "negctl_rc 0 not held" 's/^if eq get gcdg 9 0$/if eq get gcdg 9 999/' |
| 15 | run receipt.sh "receipt clone checked against the verdict head, not the revision head" 's/^if eq cdhed r get gcdg 7 false$/if eq cdhed r get gcdg 4 false/' |
| 16 | run receipt.sh "symlinks followed (no O_NOFOLLOW)" 's/559104/526336/' |
| 17 | run receipt.sh "ambiguity scan off" 's/^if lt k 2$/if lt k 99/' |
| 18 | run receipt.sh "receipt values shown without the receipt checks" 's/^if eq rc 0$/if true/' |
| 19 | run links.sh "letter before issue/ allowed" 's/^ret not and ge c 97 le c 122$/ret true/' |
| 20 | run links.sh "6-digit prefixes link" 's/^if or lt n 7 gt n 40$/if or lt n 6 gt n 40/' |
| 21 | echo "mutants survived: $S" |
| 22 | [ "$S" = 0 ] |