interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / collab / tests / receipt-mutants.sh

22 lines · 1395 bytes Raw Blame History
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)
5set -u
6H=$(cd "$(dirname "$0")" && pwd)
7# A mutant that fails to build is counted SURVIVED: only a failing check kills it.
8S=0
9run() { # 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}
14run receipt.sh "negctl_rc 0 not held" 's/^if eq get gcdg 9 0$/if eq get gcdg 9 999/'
15run 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/'
16run receipt.sh "symlinks followed (no O_NOFOLLOW)" 's/559104/526336/'
17run receipt.sh "ambiguity scan off" 's/^if lt k 2$/if lt k 99/'
18run receipt.sh "receipt values shown without the receipt checks" 's/^if eq rc 0$/if true/'
19run links.sh "letter before issue/ allowed" 's/^ret not and ge c 97 le c 122$/ret true/'
20run links.sh "6-digit prefixes link" 's/^if or lt n 7 gt n 40$/if or lt n 6 gt n 40/'
21echo "mutants survived: $S"
22[ "$S" = 0 ]