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/omega-gpu-driver/blob/main/tests/params_diff.sh # omega-gpu-driver aien-dev/omega-gpu-driver 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 `omega-gpu-driver / tests / params_diff.sh` 63 lines ยท 3026 bytes Raw Blame History 1 #!/bin/sh 2 # params_diff.sh: builds the .om params dump (chan/params.om + tests/params_dump.om) and the C referee 3 # tests/params_ref.c (TEST-ONLY, compiled fresh into a temp dir against the NVIDIA open-gpu-kernel-modules 4 # 580.173.02 headers) and requires byte-identical stdout: every record's bytes, every record size 5 # against NVIDIA's sizeof, the refused cases and the exported constants. Host only. 6 # Env: OMC (pinned omc), PARAMS_OM (unit to test; mutants use it), OGKM_SRC (NVIDIA src/ tree), 7 # PARAMS_REF (referee output already produced by this script, so a mutant run skips the rebuild). 8 # Exit: 0 PASS, 1 outputs differ, 2 setup, 3 omc failure. 9 set -u 10 here=$(cd "$(dirname "$0")/.." && pwd) 11 OMC=${OMC:-$here/build/omc} 12 PARAMS_OM=${PARAMS_OM:-$here/chan/params.om} 13 OGKM_SRC=${OGKM_SRC:-/home/drakestapleton/workspace/_ext/open-gpu-kernel-modules-580.173.02/src} 14 PARAMS_REF=${PARAMS_REF:-} 15 OMC_SHA=$(sed -n 's/^OMC_SHA256=//p' "$here/tools/omc.pin") 16 run() { nice -n 19 taskset -c "${AIEN_TEST_CPUS:-0-9,15-19}" "$@"; } 17 18 got=$(sha256sum "$OMC" | cut -d' ' -f1) 19 if [ "$got" != "$OMC_SHA" ]; then 20 echo "params_diff: FAIL omc sha256 $got, pinned $OMC_SHA"; exit 2 21 fi 22 if grep -n 'vfio\|mapnew\|/dev/\|/sys/' "$PARAMS_OM" "$here/tests/params_dump.om"; then 23 echo "params_diff: FAIL params unit or dump names a device"; exit 2 24 fi 25 26 t=$(mktemp -d /tmp/params_diff.XXXXXX) || exit 2 27 trap 'rm -rf "$t"' EXIT 28 if [ -n "$PARAMS_REF" ]; then 29 [ -s "$PARAMS_REF" ] || { echo "params_diff: FAIL PARAMS_REF $PARAMS_REF missing or empty"; exit 2; } 30 cp "$PARAMS_REF" "$t/c.txt" || exit 2 31 else 32 S=$OGKM_SRC 33 if ! run cc -std=c11 -O1 -Wall -Werror \ 34 -I"$S/common/sdk/nvidia/inc" -I"$S/nvidia/arch/nvalloc/common/inc" -I"$S/common/uproc/os/common/include" \ 35 -I"$S/nvidia/inc/kernel" -I"$S/nvidia/inc" -I"$S/nvidia/generated" -I"$S/common/shared/msgq/inc" \ 36 -I"$S/nvidia/interface" -I"$S/common/inc" -o "$t/pref" "$here/tests/params_ref.c"; then 37 echo "params_diff: FAIL C referee build"; exit 2 38 fi 39 run "$t/pref" > "$t/c.txt" || { echo "params_diff: FAIL C referee run"; exit 2; } 40 fi 41 if ! cat "$PARAMS_OM" "$here/tests/params_dump.om" | run "$OMC" > "$t/pd"; then 42 echo "params_diff: FAIL omc build"; exit 3 43 fi 44 chmod +x "$t/pd" 45 run "$t/pd" > "$t/om.txt" 46 rc=$? 47 if [ "$rc" -ne 0 ]; then 48 echo "params_diff: FAIL om dump exit $rc"; exit 1 49 fi 50 n=$(wc -l < "$t/c.txt") 51 if [ "$n" -eq 0 ]; then 52 echo "params_diff: FAIL empty C output"; exit 2 53 fi 54 if ! cmp -s "$t/c.txt" "$t/om.txt"; then 55 echo "params_diff: FAIL outputs differ ($(diff "$t/c.txt" "$t/om.txt" | grep -c '^[<>]') differing lines; C $n lines, om $(wc -l < "$t/om.txt"))" 56 exit 1 57 fi 58 # negative control: the comparison must see a single corrupted byte (first record byte 01 -> 00) 59 sed '2s/^01/00/' "$t/om.txt" > "$t/bad.txt" 60 if cmp -s "$t/c.txt" "$t/bad.txt"; then 61 echo "params_diff: FAIL negative control: a corrupted byte was not detected"; exit 2 62 fi 63 echo "params_diff: PASS ($n lines identical, .om vs C referee; corrupted-byte control refused)"