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/verify-vendored.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 / verify-vendored.sh` 35 lines · 1956 bytes Raw Blame History 1 #!/bin/bash 2 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 # verify-vendored: the vendored NVIDIA open headers are exactly the files THIRD_PARTY.md pins. 4 # tools/verify-vendored.sh [DIR] every file listed in DIR/SHA256SUMS matches, and DIR holds no unlisted file 5 # tools/verify-vendored.sh --self-test negative controls: a flipped byte and an extra file must both FAIL 6 # .crumb files are AIEN coordination metadata, not vendored content, and are not listed. 7 # Exit: 0 pass, 1 mismatch, 2 usage. 8 set -u 9 DEFAULT=$(cd "$(dirname "$0")/.." && pwd)/third_party/nvidia-open-580.173.02 10 11 verify() { # $1 = dir 12 local d=$1 rc=0 13 [ -f "$d/SHA256SUMS" ] || { echo "VENDORED FAIL $d: no SHA256SUMS"; return 1; } 14 local bad; bad=$(cd "$d" && sha256sum -c --quiet SHA256SUMS 2>&1) || { echo "VENDORED FAIL $d: $bad"; rc=1; } 15 local extra; extra=$(cd "$d" && LC_ALL=C comm -23 \ 16 <(find . -type f ! -name SHA256SUMS ! -name .crumb | LC_ALL=C sort) \ 17 <(awk '{print $2}' SHA256SUMS | LC_ALL=C sort)) 18 [ -z "$extra" ] || { echo "VENDORED FAIL $d: unlisted files: $(echo $extra)"; rc=1; } 19 [ $rc -eq 0 ] && echo "VENDORED PASS $d ($(wc -l < "$d/SHA256SUMS") files match SHA256SUMS, none unlisted)" 20 return $rc 21 } 22 23 if [ "${1:-}" = --self-test ]; then 24 T=$(mktemp -d); trap 'rm -rf "$T"' EXIT 25 cp -r "$DEFAULT" "$T/flip" && cp -r "$DEFAULT" "$T/extra" || exit 1 26 f=$(awk 'NR==1{print $2}' "$T/flip/SHA256SUMS") 27 printf 'x' | dd of="$T/flip/$f" bs=1 seek=0 conv=notrunc status=none 28 echo "planted" > "$T/extra/kernel-open/planted.h" 29 verify "$T/flip" >/dev/null && { echo "VENDORED SELF-TEST FAIL: flipped byte accepted"; exit 1; } 30 verify "$T/extra" >/dev/null && { echo "VENDORED SELF-TEST FAIL: unlisted file accepted"; exit 1; } 31 echo "VENDORED SELF-TEST PASS (flipped byte and unlisted file rejected)" 32 exit 0 33 fi 34 [ $# -le 1 ] || { sed -n '3,6p' "$0" >&2; exit 2; } 35 verify "${1:-$DEFAULT}"