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
CUDApp / tools / c5 / policy-test.sh
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | # Host-only: never opens a GPU, invokes chip.sh, or downloads a compiler. |
| 4 | set -eu |
| 5 | cd "$(dirname "$0")/../.." |
| 6 | OMC=${OMEGA_OMC:-${OMC:-../omega-mv/seed/out/omc}} |
| 7 | B=${OUT_DIR:-build}/c5-policy |
| 8 | mkdir -p "$B" |
| 9 | read -r repo rev path want < tools/c5/omc.pin |
| 10 | [ -x "$OMC" ] || { echo 'C5 policy: NOT_RUN (pinned OMEGA_OMC missing)' >&2; exit 2; } |
| 11 | got=$(sha256sum "$OMC"); got=${got%% *} |
| 12 | [ "$got" = "$want" ] || { echo 'C5 policy: NOT_RUN (compiler pin mismatch)' >&2; exit 2; } |
| 13 | cat tools/c5/policy.om tools/c5/model.om tools/c5/cases.om > "$B/positive.om" |
| 14 | "$OMC" < "$B/positive.om" > "$B/positive" 2> "$B/positive.err" || { cat "$B/positive.err" >&2; exit 1; } |
| 15 | chmod +x "$B/positive" |
| 16 | "$B/positive" |
| 17 | # Mutation is a verification oracle only. Every mutant must compile and fail at its specified assertion. |
| 18 | python3 tools/c5/mutants.py "$B" |
| 19 | for entry in deadline:6 overflow:4 owner:12 generation:13 range:16 ack:19 order:20 epoch:37 stale:42; do |
| 20 | name=${entry%:*}; want=${entry#*:} |
| 21 | "$OMC" < "$B/$name.om" > "$B/$name" 2> "$B/$name.err" || { cat "$B/$name.err" >&2; exit 1; } |
| 22 | chmod +x "$B/$name" |
| 23 | rc=0; "$B/$name" > "$B/$name.log" 2>&1 || rc=$? |
| 24 | [ "$rc" -eq "$want" ] || { echo "C5 mutant $name: FAIL (exit $rc, expected assertion $want)" >&2; exit 1; } |
| 25 | echo "C5 mutant $name: caught (assertion $rc)" |
| 26 | done |
| 27 | sha256sum "$OMC" tools/c5/policy.om tools/c5/model.om tools/c5/cases.om "$B/positive" |
| 28 | echo 'C5 policy host+sim+mutants: PASS' |