Files
leleka/scripts/test-cuda-q6-driver.sh
Pavlo RatushnyiandClaude Sonnet 5.5 9b08355660 scripts: restore the executable bit lost in the 2026-10-14 import (every workflow job died at "Permission denied")
7f896a8bb changed 100755 to 100644 on 16 scripts that the workflows or check-local.sh execute by path, among them
scripts/install-pinned-rustup.sh (the first step of every job), scripts/test-cuda-fixed-ptx.sh, scripts/test-cuda-driver-bootstrap.sh,
scripts/build-cpu.sh and the GPU gate scripts. A Linux checkout keeps git's mode, so `scripts/install-pinned-rustup.sh ...` failed with
"Permission denied" before any build. Found by running the steps from a `git archive` in a Linux container; the Windows and WSL-on-/mnt/c
runs of the first audit show every file as executable and could not see it. Only modes change; engine/strata is not touched.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 01:42:33 +01:00

37 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# New, bounded component gate. Old bootstrap remains a separate unchanged gate.
# Only an offline, non-root, GPU-hidden Linux container may execute this script.
set -euo pipefail
[[ $# == 2 && "$1" == --inside && -f /.dockerenv && "$(id -u)" == 65532 ]]
[[ "$(awk '/^Cap(Eff|Prm|Bnd):/{print $2}' /proc/self/status)" == $'0000000000000000\n0000000000000000\n0000000000000000' ]]
for device in /dev/nvidia* /dev/dri/*; do [[ ! -e "$device" ]]; done
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
[[ ! -e "$root/engine" && ! -e "$root/control-plane" ]]
! command -v nvcc >/dev/null
[[ "$2" == /tmp/* && ! -e "$2" ]]
work="$2"
mkdir -p "$work/q6"
export CARGO_TARGET_DIR="$work/target"
cd "$root"
cc -std=c11 -Wall -Wextra -Werror -Wno-misleading-indentation -ffp-contract=off -fno-fast-math -shared -fPIC \
"$root/crates/cuda-driver/tests/q6_mock_cuda.c" -lm -o "$work/q6/libcuda.so.1"
sha256sum "$work/q6/libcuda.so.1"
cargo test --offline --locked -p leleka-cuda-driver --test q6_oracle -- --nocapture
MOCK_CUDA_Q5_PTX="$root/crates/cuda-driver/src/q5_k_q8_1.ptx" \
MOCK_CUDA_Q6_PTX="$root/crates/cuda-driver/src/q6_k_q8_1.ptx" \
LELEKA_CUDA_MOCK_HARNESS=1 LELEKA_CUDA_Q6_MOCK_ROOT="$work" \
cargo test --offline --locked -p leleka-cuda-driver --features cuda-driver --test q6_mock \
-- --exact isolated_q6_protocol_matrix --ignored --test-threads=1 --nocapture
rlib="$(find "$work/target/debug/deps" -name 'libleleka_cuda_driver-*.rlib' -print -quit)"
[[ -n "$rlib" ]]
cat > "$work/reject.rs" <<'RS'
use leleka_cuda_driver::{Driver,Q6KProjectionShape};
fn main(){let d=Driver::load().unwrap();let c=d.device(0).unwrap().create_context(4096).unwrap();let mut w=c.allocate(210).unwrap();let x=c.allocate(1024).unwrap();c.q6_k_q8_1(&w,&x,&mut w,Q6KProjectionShape{rows:1,columns:256}).unwrap();}
RS
if rustc --edition=2024 --extern "leleka_cuda_driver=$rlib" -L "dependency=$work/target/debug/deps" \
"$work/reject.rs" -o "$work/reject" 2> "$work/reject.log"; then
echo 'Q6 output alias escaped' >&2; exit 1
fi
grep -q 'cannot borrow.*w.*as mutable because it is also borrowed as immutable' "$work/reject.log"
echo 'Q6 output alias compile refusal: PASS'