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-rmchan.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-rmchan.sh` 58 lines ยท 2763 bytes Raw Blame History 1 #!/bin/sh 2 # tests/mutants-rmchan.sh: single-line mutants of chan/rmchan.om. 3 # Each mutant must compile and fail tests/rmchan_diff.sh (killed). 4 set -u 5 here=$(cd "$(dirname "$0")/.." && pwd) 6 t=$(mktemp -d /tmp/mutants-rmchan.XXXXXX) || exit 2 7 trap 'rm -rf "$t"' EXIT 8 run() { nice -n 19 taskset -c "${AIEN_TEST_CPUS:-0-9,15-19}" "$@"; } 9 10 if ! sh "$here/tests/rmchan_diff.sh" > "$t/base.log" 2>&1; then 11 cat "$t/base.log"; echo "mutants-rmchan: FAIL baseline is not green"; exit 2 12 fi 13 14 cat <<'EOF' > "$t/list" 15 schedule enable command mutated to disable|r = pasched 1 0 0|r = pasched 0 0 0 16 schedule disable command mutated to enable|r = pasched 0 0 0|r = pasched 1 0 0 17 TSG allocation class mutated|r = brmalloc get rmhcli 0 get rmhdev 0 get rmhtsg 0 PACTSG b|r = brmalloc get rmhcli 0 get rmhdev 0 get rmhtsg 0 PACVAS b 18 channel allocation parent mutated|r = brmalloc get rmhcli 0 get rmhdev 0 get rmhchan 0 PACGPF b|r = brmalloc get rmhcli 0 get rmhtsg 0 get rmhchan 0 PACGPF b 19 free sequence inverted|r = brmfree get rmhcli 0 get rmhctx 0 b|r = brmfree get rmhcli 0 get rmhtsg 0 b 20 rebinding retained RM slot permitted|if or ne get rmst 0 RMSIDLE ne get rmepoch 0 0|if false 21 RM free before semaphore drain permitted|if ne st RMSDRND|if false 22 publication active state check bypassed|if ne get rmst 0 RMSACTV|if false 23 submission stale release sequence accepted|if ne uint mmrd32 add va mul i 4 get cmwds i|if false 24 schedule ACK leaves channel only prepared|put chopen get rmslot 0 1|note no activation 25 RM bind accepts a channel that is not prepared|if or ne get chopen c 2 ne get chepoch c gen|if ne get chepoch c gen 26 EOF 27 28 killed=0; survived=0; invalid=0; total=0 29 while IFS='|' read -r desc orig mut; do 30 total=$((total + 1)) 31 mfile="$t/mut_$total.om" 32 if ! grep -qF "$orig" "$here/chan/rmchan.om"; then 33 echo "mutants-rmchan: INVALID pattern '$orig'"; invalid=$((invalid + 1)); continue 34 fi 35 sed "s/$orig/$mut/" "$here/chan/rmchan.om" > "$mfile" 36 if cmp -s "$mfile" "$here/chan/rmchan.om"; then 37 echo "mutants-rmchan: INVALID identical mutation '$desc'"; invalid=$((invalid + 1)); continue 38 fi 39 if RMCHAN_OM="$mfile" sh "$here/tests/rmchan_diff.sh" > "$t/run.log" 2>&1; then 40 echo "mutants-rmchan: SURVIVED mutant '$desc'"; survived=$((survived + 1)) 41 else 42 rc=$? 43 if [ "$rc" -eq 1 ]; then 44 echo "mutants-rmchan: KILLED mutant '$desc'" 45 killed=$((killed + 1)) 46 else 47 echo "mutants-rmchan: INVALID mutant '$desc' exit $rc" 48 cat "$t/run.log" 49 invalid=$((invalid + 1)) 50 fi 51 fi 52 done < "$t/list" 53 54 echo "mutants-rmchan: $total total, $killed killed, $survived survived, $invalid invalid" 55 if [ "$survived" -gt 0 ] || [ "$invalid" -gt 0 ]; then 56 exit 1 57 fi 58 echo "mutants-rmchan: PASS all mutants killed; hardware NOT_RUN"