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/tools/c5/selftest.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 / tools / c5 / selftest.sh` 37 lines · 1778 bytes Raw Blame History 1 #!/bin/sh 2 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 # Host check of build/c5_matrix with stand-in processes (no GPU, no CUDA): each case must go green with good stand-ins 4 # and red with bad ones. This checks the orchestration (spawn, pipes, markers, group kill, reaping, verdicts) only. 5 set -eu 6 cd "$(dirname "$0")/../.." 7 M=$(pwd)/build/c5_matrix 8 T=$(mktemp -d) 9 trap 'rm -rf "$T"' EXIT 10 cat > "$T/iso" <<'EOF' 11 #!/bin/sh 12 if [ "$1" = "--values-only" ]; then echo "C5 isolation values: PASS (stand-in)"; /bin/sleep 1; exit 0; fi 13 /bin/sh -c 'echo "[$$] ok: hang part: a command list made before the hang"; exec /bin/sleep 30' & 14 wait 15 EOF 16 printf '#!/bin/sh\necho "C5 isolation values: FAIL (stand-in)"; exit 1\n' > "$T/iso_bad" 17 printf '#!/bin/sh\n/bin/sleep 1; echo "[cuda] READY"; /bin/sleep 4; exit $5\n' > "$T/py" 18 printf '#!/bin/sh\n/bin/sleep 1; echo "[cuda] READY"; exit 0\n' > "$T/py_dies" 19 printf '#!/bin/sh\necho "no READY here"; exit 1\n' > "$T/py_noready" 20 chmod +x "$T"/* 21 fails=0 22 expect() { # want_rc case iso py 23 rc=0; out=$(timeout 120 "$M" "$T/$3" "$T/$4" "$2" 2>&1) || rc=$? 24 if [ "$rc" -eq "$1" ]; then echo "ok: case $2 iso=$3 py=$4 exit $rc"; else echo "FAIL: case $2 iso=$3 py=$4 exit $rc, want $1"; echo "$out"; fails=$((fails + 1)); fi 25 } 26 expect 0 c iso py 27 expect 0 p iso py 28 expect 0 k iso py 29 expect 0 r iso py 30 expect 1 c iso_bad py 31 expect 1 k iso_bad py 32 expect 1 c iso py_dies 33 expect 2 c iso py_noready 34 expect 2 x iso py 35 leftover=$(ps -eo args | grep -c "^/bin/sleep 30$" || true) 36 [ "$leftover" -eq 0 ] && echo "ok: no stand-in hang survives the group kill" || { echo "FAIL: $leftover stand-in hang(s) left"; fails=$((fails + 1)); } 37 [ "$fails" -eq 0 ] && echo "c5_matrix selftest: PASS" || { echo "c5_matrix selftest: FAIL ($fails)"; exit 1; }