interplane.Get Omega
Read in your language

omega-gpu-driver

aien-dev/omega-gpu-driver

Brought by drakestapleton

branch main Branches Tags History

omega-gpu-driver / tests / mutants-complete.sh

55 lines · 2258 bytes Raw Blame History
1#!/bin/sh
2# tests/mutants-complete.sh: single-line mutants of chan/complete.om.
3# Each mutant must compile and fail tests/complete_diff.sh (killed).
4set -u
5here=$(cd "$(dirname "$0")/.." && pwd)
6t=$(mktemp -d /tmp/mutants-complete.XXXXXX) || exit 2
7trap 'rm -rf "$t"' EXIT
8run() { nice -n 19 taskset -c "${AIEN_TEST_CPUS:-0-9,15-19}" "$@"; }
9
10if ! sh "$here/tests/complete_diff.sh" > "$t/base.log" 2>&1; then
11 cat "$t/base.log"; echo "mutants-complete: FAIL baseline is not green"; exit 2
12fi
13
14cat <<'EOF' > "$t/list"
15header method offset mutated|const CMSEMM uint 23|const CMSEMM uint 24
16release execute operation mutated to acquire|put cmwds 5 1|put cmwds 5 0
17address alignment check bypassed|if ne and va 3 0|if false
18progress check operator flipped|if gt prog inflight|if ge prog inflight
19stale observation accepted as pending|ret CMESTALE|ret 0
20capability check for DMA window bypassed|if or lt get mmwst 0 MMWDMA ge get mmwst 0 MMWQUAR|if false
21quarantine on timeout skipped|r = gmquar b|r = GMOK
22cmsub overcapacity check bypassed|if gt count sub sub ent 1 inflight|if false
23EOF
24
25killed=0; survived=0; invalid=0; total=0
26while IFS='|' read -r desc orig mut; do
27 total=$((total + 1))
28 mfile="$t/mut_$total.om"
29 if ! grep -qF "$orig" "$here/chan/complete.om"; then
30 echo "mutants-complete: INVALID pattern '$orig'"; invalid=$((invalid + 1)); continue
31 fi
32 sed "s/$orig/$mut/" "$here/chan/complete.om" > "$mfile"
33 if cmp -s "$mfile" "$here/chan/complete.om"; then
34 echo "mutants-complete: INVALID identical mutation '$desc'"; invalid=$((invalid + 1)); continue
35 fi
36 if COMPLETE_OM="$mfile" sh "$here/tests/complete_diff.sh" > "$t/run.log" 2>&1; then
37 echo "mutants-complete: SURVIVED mutant '$desc'"; survived=$((survived + 1))
38 else
39 rc=$?
40 if [ "$rc" -eq 1 ]; then
41 echo "mutants-complete: KILLED mutant '$desc'"
42 killed=$((killed + 1))
43 else
44 echo "mutants-complete: INVALID mutant '$desc' exit $rc"
45 cat "$t/run.log"
46 invalid=$((invalid + 1))
47 fi
48 fi
49done < "$t/list"
50
51echo "mutants-complete: $total total, $killed killed, $survived survived, $invalid invalid"
52if [ "$survived" -gt 0 ] || [ "$invalid" -gt 0 ]; then
53 exit 1
54fi
55echo "mutants-complete: PASS all mutants killed; hardware NOT_RUN"