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/mutants-mmio.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 / mutants-mmio.sh` 63 lines ยท 3541 bytes Raw Blame History 1 #!/bin/sh 2 # mutants-mmio.sh: single-token (one is a two-line order swap) mutants of gsp/mmio.om; each must make 3 # tests/mmio_diff.sh go red. The simulator and the test driver are never mutated. A mutant must change 4 # exactly the named line(s) and still compile; otherwise it is INVALID and the run fails. 5 set -u 6 here=$(cd "$(dirname "$0")/.." && pwd) 7 src=$here/gsp/mmio.om 8 diff_sh=$here/tests/mmio_diff.sh 9 t=$(mktemp -d /tmp/mutants-mmio.XXXXXX) || exit 2 10 trap 'rm -rf "$t"' EXIT 11 12 if ! sh "$diff_sh" > "$t/base.log" 2>&1; then 13 cat "$t/base.log"; echo "mutants-mmio: FAIL baseline is not green"; exit 2 14 fi 15 16 # desc|old line|new line[|old line 2|new line 2] (whole-line matches, each exactly once) 17 cat > "$t/list" <<'EOF' 18 QTAIL written after QHEAD (doorbell before tail)|gspwr S2QT sub mul dw 4 4|gspwr S2QH 0|gspwr S2QH 0|gspwr S2QT sub mul dw 4 4 19 EMEMC AINCW bit 23 instead of 24|const AINCW ulong `16777216`|const AINCW ulong `8388608` 20 emem dword formula 32 dwords per block|const DWBLK ulong 64|const DWBLK ulong 32 21 poll budget off by one (gt for ge)|if ge n b|if gt n b 22 lockdown high-half check shifts 31|if eq m1 shr pa 32|if eq m1 shr pa 31 23 CPUCTL active bit 6 instead of 7|const CPUACT ulong 128|const CPUACT ulong 64 24 notify writes 1 to QUEUE_HEAD|gspwr GQH 0|gspwr GQH 1 25 FALCON_OS gets fmc_args_pa, not app_version|gspwr GOS get gin 2|gspwr GOS get gin 1 26 mask timeout reports the lockdown code|ret gspfail EMASK|ret gspfail ELOCK 27 tail not zero-padded (one byte past len)|while lt add i k ln bound 4|while le add i k ln bound 4 28 target-lock mask covers the low byte|const PRIVMSK ulong `4294967040`|const PRIVMSK ulong `4294967295` 29 lockdown bit 12 instead of 13|const LOCKDN ulong 8192|const LOCKDN ulong 4096 30 dword count rounds down|dw = div add ln 3 4|dw = div add ln 0 4 31 QUEUE_TAIL = padded size, not size - 4|gspwr S2QT sub mul dw 4 4|gspwr S2QT sub mul dw 4 0 32 SEC2 busy value off by one|const CMDBUSY ulong `3221342974`|const CMDBUSY ulong `3221342975` 33 FMC error reported as OK|ret gspfail EFMC|ret gspfail EOK 34 step 8 waits for MAILBOX0 zero|ret or eq and h LOCKDN 0 ne m0 0|ret or eq and h LOCKDN 0 eq m0 0 35 EMEM pointer check inverted|if ne and sub ememdw ea st M32 dw|if eq and sub ememdw ea st M32 dw 36 channel bound refuses exactly 1024 bytes|if or eq ln 0 gt ln CHBYTES|if or eq ln 0 ge ln CHBYTES 37 step 1 waits for HEAD != TAIL|ret eq hd gsprd S2QT|ret ne hd gsprd S2QT 38 SEC2 timeout reads MAILBOX0 for MAILBOX1|put gout 7 gsprd S2MB1|put gout 7 gsprd S2MB0 39 HWCFG2 zero counts as released|if eq h 0|if eq h 1 40 EOF 41 42 killed=0; survived=0; invalid=0 43 while IFS='|' read -r desc o1 n1 o2 n2; do 44 m=$t/mmio.om 45 awk -v o1="$o1" -v n1="$n1" -v o2="${o2:-}" -v n2="${n2:-}" ' 46 $0 == o1 && !d1 { print n1; c1++; d1 = 1; next } 47 o2 != "" && $0 == o2 && !d2 { print n2; c2++; d2 = 1; next } 48 $0 == o1 { c1++ } o2 != "" && $0 == o2 { c2++ } 49 { print } 50 END { if (c1 != 1 || (o2 != "" && c2 != 1)) exit 1 }' "$src" > "$m" 51 if [ $? -ne 0 ] || cmp -s "$src" "$m"; then 52 echo "mutant INVALID (pattern not matched exactly once): $desc"; invalid=$((invalid + 1)); continue 53 fi 54 MMIO_OM=$m sh "$diff_sh" > "$t/m.log" 2>&1 55 rc=$? 56 case $rc in 57 0) echo "mutant SURVIVED: $desc"; survived=$((survived + 1)) ;; 58 1) echo "mutant killed: $desc"; killed=$((killed + 1)) ;; 59 *) echo "mutant INVALID (exit $rc: $(cat "$t/m.log")): $desc"; invalid=$((invalid + 1)) ;; 60 esac 61 done < "$t/list" 62 echo "mutants-mmio: $killed killed, $survived survived, $invalid invalid" 63 [ "$survived" -eq 0 ] && [ "$invalid" -eq 0 ] && [ "$killed" -ge 10 ]