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 / evidence / xorwow-mix-20261109 / run.sh
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | # L441 receipt runner: build omega/libraries/xorwow_mix.om with the pinned omc, |
| 4 | # compare its scores with the Wolfram values in expected.txt, then build three |
| 5 | # mutants that must fail with their own exit codes. |
| 6 | # Usage: OMC=/abs/path/to/omc sh evidence/xorwow-mix-20261109/run.sh OUTDIR |
| 7 | # Prints RESULT PASS and exits 0 only if every row holds. |
| 8 | set -u |
| 9 | PIN=2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f |
| 10 | R=$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd) |
| 11 | SRC=$R/omega/libraries/xorwow_mix.om |
| 12 | EXP=$R/evidence/xorwow-mix-20261109/expected.txt |
| 13 | OUT=${1:?usage: OMC=... run.sh OUTDIR} |
| 14 | [ -x "${OMC:-}" ] || { echo "NOT_RUN: set OMC to the pinned seeded compiler"; exit 3; } |
| 15 | [ "$(sha256sum < "$OMC" | cut -c1-64)" = "$PIN" ] || { echo "NOT_RUN: omc is not $PIN"; exit 3; } |
| 16 | mkdir -p "$OUT" |
| 17 | fail=0 |
| 18 | echo "omc sha256 $PIN" |
| 19 | echo "source sha256 $(sha256sum < "$SRC" | cut -c1-64)" |
| 20 | |
| 21 | # build NAME SRCFILE: compile to $OUT/NAME, print the compile status |
| 22 | build() { |
| 23 | "$OMC" < "$2" > "$OUT/$1" 2> "$OUT/$1.omc-stderr" |
| 24 | rc=$? |
| 25 | chmod +x "$OUT/$1" |
| 26 | echo "compile $1 rc=$rc" |
| 27 | return $rc |
| 28 | } |
| 29 | |
| 30 | if build good "$SRC"; then |
| 31 | "$OUT/good" > "$OUT/good.stdout" |
| 32 | rc=$? |
| 33 | cat "$OUT/good.stdout" |
| 34 | echo "run good rc=$rc" |
| 35 | [ "$rc" = 0 ] || fail=1 |
| 36 | if cmp -s "$OUT/good.stdout" "$EXP"; then echo "PASS stdout equals the Wolfram scores"; else echo "FAIL stdout differs from the Wolfram scores"; fail=1; fi |
| 37 | echo "binary sha256 $(sha256sum < "$OUT/good" | cut -c1-64)" |
| 38 | else |
| 39 | fail=1 |
| 40 | fi |
| 41 | |
| 42 | # mutant NAME WANT FROM TO: replace one exact line, require exit WANT |
| 43 | mutant() { |
| 44 | awk -v from="$3" -v to="$4" 'BEGIN{n=0} $0==from{print to; n++; next} {print} END{if(n!=1) exit 9}' "$SRC" > "$OUT/$1.om" \ |
| 45 | || { echo "FAIL $1: line not found once"; fail=1; return; } |
| 46 | if build "$1" "$OUT/$1.om"; then |
| 47 | "$OUT/$1" > "$OUT/$1.stdout" |
| 48 | rc=$? |
| 49 | if [ "$rc" = "$2" ]; then echo "PASS mutant $1 caught: exit $rc"; else echo "FAIL mutant $1: exit $rc, wanted $2"; fail=1; fi |
| 50 | else |
| 51 | fail=1 |
| 52 | fi |
| 53 | } |
| 54 | mutant weyl 10 'd = xmixmask add get xmst 5 362437' 'd = xmixmask add get xmst 5 362438' |
| 55 | mutant nofold 30 'ret xor o shr o 16' 'ret o' |
| 56 | mutant bmlen 20 'lc = sub add i 1 lc' 'lc = lc' |
| 57 | |
| 58 | if [ "$fail" = 0 ]; then echo "RESULT PASS"; else echo "RESULT FAIL"; fi |
| 59 | exit "$fail" |