interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / tools / c5 / policy-test.sh

28 lines · 1505 bytes Raw Blame History
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.
4set -eu
5cd "$(dirname "$0")/../.."
6OMC=${OMEGA_OMC:-${OMC:-../omega-mv/seed/out/omc}}
7B=${OUT_DIR:-build}/c5-policy
8mkdir -p "$B"
9read -r repo rev path want < tools/c5/omc.pin
10[ -x "$OMC" ] || { echo 'C5 policy: NOT_RUN (pinned OMEGA_OMC missing)' >&2; exit 2; }
11got=$(sha256sum "$OMC"); got=${got%% *}
12[ "$got" = "$want" ] || { echo 'C5 policy: NOT_RUN (compiler pin mismatch)' >&2; exit 2; }
13cat 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; }
15chmod +x "$B/positive"
16"$B/positive"
17# Mutation is a verification oracle only. Every mutant must compile and fail at its specified assertion.
18python3 tools/c5/mutants.py "$B"
19for 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)"
26done
27sha256sum "$OMC" tools/c5/policy.om tools/c5/model.om tools/c5/cases.om "$B/positive"
28echo 'C5 policy host+sim+mutants: PASS'