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/omega-gpu-driver/blob/main/tests/dispatch_mutants.sh # omega-gpu-driver aien-dev/omega-gpu-driver 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 `omega-gpu-driver / tests / dispatch_mutants.sh` 52 lines ยท 2219 bytes Raw Blame History 1 #!/bin/sh 2 # tests/dispatch_mutants.sh: behavioral mutation testing of gsp/dispatch.om. 3 # Single-line mutants targeting each security, prevalidation, and state transition contract. 4 # Every mutant must compile and be killed (detected) by tests/dispatch_diff.sh. 5 # Host verification only. Never invokes VFIO or device operations. 6 set -u 7 here=$(cd "$(dirname "$0")/.." && pwd) 8 src=$here/gsp/dispatch.om 9 diff_sh=$here/tests/dispatch_diff.sh 10 t=$(mktemp -d /tmp/mutants-dispatch.XXXXXX) || exit 2 11 trap 'rm -rf "$t"' EXIT 12 13 cat > "$t/list" <<'EOF' 14 prevalidation bypassed|r = dspprev nw ci|r = long 0 15 stale generation check disabled|if ne gen get bgen 0|if false 16 stale token check disabled|if ne tok get btoken 0|if false 17 suspended state check disabled|if ne get bstate 0 11|if false 18 packet truncation check disabled|if lt get bselen 0 add 120 mul nw 4|if false 19 buffer capacity check disabled|if gt nw SQMAX|if false 20 cmdIndex bound check disabled|if ge ci nw|if false 21 core permission check disabled in prevalidation|if not dspcperm op|if false 22 store save index check disabled in prevalidation|if ge k SQSAVE|if false 23 bseqdone ok=false on success|d = bseqdone gen tok true|d = bseqdone gen tok false 24 save register writeback dropped|dspp32 add 88 mul k 4 get sqsave k|note no writeback 25 non-sim whole-dispatch refusal disabled|if ne get gspmode 0 0|if false 26 EOF 27 28 killed=0 29 survived=0 30 invalid=0 31 32 while IFS='|' read -r desc old new; do 33 [ -z "$desc" ] && continue 34 m="$t/mutant.om" 35 awk -v o="$old" -v n="$new" ' 36 $0 == o { c++; print n; next } 37 { print } 38 END { if (c != 1) exit 1 }' "$src" > "$m" 39 if [ $? -ne 0 ] || cmp -s "$src" "$m"; then 40 echo "mutant INVALID (pattern not matched exactly once): $desc"; invalid=$((invalid + 1)); continue 41 fi 42 DISPATCH_OM=$m sh "$diff_sh" > "$t/m.log" 2>&1 43 rc=$? 44 case $rc in 45 0) echo "mutant SURVIVED: $desc"; survived=$((survived + 1)) ;; 46 1) echo "mutant killed: $desc"; killed=$((killed + 1)) ;; 47 *) echo "mutant INVALID (exit $rc: $(cat "$t/m.log")): $desc"; invalid=$((invalid + 1)) ;; 48 esac 49 done < "$t/list" 50 51 echo "mutants-dispatch: $killed killed, $survived survived, $invalid invalid" 52 [ "$survived" -eq 0 ] && [ "$invalid" -eq 0 ] && [ "$killed" -ge 10 ]