Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-architecture-mv/blob/main/tools/zero-legacy/fixtures/elf-mutants.sh # aien-architecture-mv Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-architecture-mv / tools / zero-legacy / fixtures / elf-mutants.sh` 34 lines ยท 1815 bytes Raw Blame History 1 #!/bin/sh 2 # elf-mutants.sh ZLDIR OMC WORK (sh tools/zero-legacy/fixtures/elf-mutants.sh "$PWD/tools/zero-legacy" OMC DIR): each mutant is one sed edit of elfclose.om in a fresh copy of 3 # tools/zero-legacy; the gate must exit 1 for every one (a surviving mutant is a FAIL here). 4 zl=$1; omc=$2; work=$3 5 mkdir -p "$work" 6 killed=0 survived=0 7 mut() { 8 name=$1; expr=$2 9 d=$work/$name 10 mkdir -p "$d" 11 (cd "$zl" && tar --exclude=./build -cf - .) | (cd "$d" && tar -xf -) 12 sed -i "$expr" "$d/elfclose.om" 13 if cmp -s "$zl/elfclose.om" "$d/elfclose.om"; then echo "MUTANT $name INVALID (edit did not apply)"; survived=$((survived+1)); return; fi 14 (cd "$d" && AIEN_OMC=$omc sh ./gate.sh > gate.out 2>&1); rc=$? 15 if [ "$rc" -eq 1 ]; then killed=$((killed+1)); echo "MUTANT $name killed (gate rc=1): $(grep -E '_exit [1-9]|refused 0' "$d/gate.out" | tr '\n' ' ')" 16 else survived=$((survived+1)); echo "MUTANT $name SURVIVED (gate rc=$rc)"; fi 17 } 18 mut no-needed 's/^put ndn 0 add m n$/put ndn 0 0/' 19 mut dyn-not-foreign '/^fx = true$/d' 20 mut no-class-check 's/^if ne get hb 4 2$/if eq get hb 4 9/' 21 mut no-map-dedupe 's/^if same$/if false/' 22 mut perms-byte 's/^ret eq get mp add i 3 120$/ret eq get mp add i 2 120/' 23 mut vaddr-as-offset 's/^ret add p64 add b 8 sub v va$/ret v/' 24 mut no-gnu-phdr 's/^if ge t `1685382480`$/if ge t `1685382484`/' 25 mut no-comment-scan 's/^r = comment b$/r = ulong 0/' 26 mut no-path-escape 's/^if esc$/if false/' 27 mut needed-ctl-ok 's/^if ctlb c$/if false/' 28 mut needed-comma-ok 's/^if eq c 44$/if false/' 29 mut interp-ctl-ok 's/^if ctlb get ib i$/if false/' 30 mut del-not-ctl 's/^ret eq c 127$/ret false/' 31 mut load-unchecked 's/^if not inrange p64 add b 8 p64 add b 32$/if false/' 32 mut nonregular-ok 's/^if ne and m 61440 32768$/if false/' 33 echo "MUTANTS killed=$killed survived=$survived" 34 [ "$survived" -eq 0 ]