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/CUDApp/blob/main/tests/share/mutants.sh # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. 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 `CUDApp / tests / share / mutants.sh` 71 lines · 3303 bytes Raw Blame History 1 #!/bin/sh 2 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 # Mutation check for native/share/share.om. Each mutant replaces one exact span that must occur 4 # exactly once ("\n" in a span is a newline). The host suite must fail on every mutant; a 5 # surviving mutant fails this script. Called by run-share-host.sh with OMEGA_OMC set and pinned. 6 set -eu 7 : "${OMEGA_OMC:?set the pinned seeded compiler}" 8 OUT=${ZERO_COPY_OUT:-build/zero-copy} 9 mkdir -p "$OUT/mutants" 10 test -s "$OUT/abi.om" 11 12 # name|search|replace 13 cat > "$OUT/mutants/list" <<'EOF' 14 ro-dma-flag|fl = 33041|fl = 33040 15 ro-uvm-type|kind = 3|kind = 1 16 ro-cpu-access|r = mapbind m int fd 0 1|r = mapbind m int fd 0 3 17 rw-cpu-access|r = mapbind m int fd 0 3|r = mapbind m int fd 0 1 18 ro-map-flag|npput 44 1|npput 44 0 19 probe-skipped|st = nvshmap obj size 4096 ro fd|st = long 32 20 limit-not-erange|if eq st 46|if eq st 47 21 larger-accepted|if eq st 0\nst = neg long 34|if eq st 1\nst = neg long 34 22 dup-kept-on-refusal|if nvmrel slot\nput nverr 0 e\nend|put nverr 0 e 23 dup-source-swapped|npput 12 nvshget 8\nnpput 16 nvshget 12|npput 12 nvshget 12\nnpput 16 nvshget 8 24 share-mask-zero|npput 12 1\nnpput 16 2|npput 12 0\nnpput 16 2 25 share-type-wrong|npput 12 1\nnpput 16 2|npput 12 1\nnpput 16 1 26 want-unchecked|if ne size want|if ne size size 27 reexport-allowed|if eq get nvshobj slot h|if ne h h 28 unaligned-accepted|if ne and size 4095 0|if ne and size 0 0 29 bound-raised|gt size `68719476736`|gt size `137438953472` 30 magic-unchecked|if or ne nvshget 0 `1129991503` ne nvshget 4 1|if ne nvshget 4 1 31 record-size-page|nvshp64 16 get nvmlen slot|nvshp64 16 4096 32 range-fault-dropped|r = uvmctl get nvfd 2 uint 73 nvpar 0 24\nif not nvos r npget 16\nput nvfault 0 1|r = uvmctl get nvfd 2 uint 73 nvpar 0 24\nif not nvos r npget 16 33 gpu-skipped|if not nvshgpu slot ro\nret neg long 1\nend|put nvmflag slot 15 34 EOF 35 36 total=0 37 caught=0 38 while IFS='|' read -r name search replace; do 39 total=$((total + 1)) 40 python3 - native/share/share.om "$OUT/mutants/$name.om" "$search" "$replace" <<'PY' 41 import sys 42 src, dst, search, replace = sys.argv[1:5] 43 search = search.replace("\\n", "\n") 44 replace = replace.replace("\\n", "\n") 45 text = open(src).read() 46 n = text.count(search) 47 if n != 1: 48 sys.exit("mutant site found %d times: %r" % (n, search)) 49 open(dst, "w").write(text.replace(search, replace)) 50 PY 51 if cmp -s native/share/share.om "$OUT/mutants/$name.om"; then 52 echo "zero-copy mutant $name: FAIL identical to source" >&2 53 exit 1 54 fi 55 ZERO_COPY_OUT="$OUT/mutants/$name.d" ZERO_COPY_SHARE_SRC="$OUT/mutants/$name.om" \ 56 ZERO_COPY_ABI="$OUT/abi.om" sh tests/share/run-share-host.sh --suite-only \ 57 > "$OUT/mutants/$name.log" 2>&1 < /dev/null && rc=0 || rc=$? 58 if test "$rc" = 0; then 59 echo "zero-copy mutant $name: SURVIVED" >&2 60 exit 1 61 fi 62 # A mutant that does not compile proves nothing about the suite. 63 if ! grep -qx 'zero-copy: compiled' "$OUT/mutants/$name.log"; then 64 echo "zero-copy mutant $name: FAIL did not compile, see $OUT/mutants/$name.log" >&2 65 exit 1 66 fi 67 caught=$((caught + 1)) 68 echo "zero-copy mutant $name: caught (rc $rc) $(grep -m1 FAIL "$OUT/mutants/$name.log" || true)" 69 done < "$OUT/mutants/list" 70 echo "zero-copy mutants: $caught/$total caught" 71 test "$caught" = "$total"