Some checks failed
Smoke Test / smoke (pull_request) Failing after 8s
Issue #55 — security hardening for PolarQuant Turbo4 codec. - Add llama-turbo-safety.h/.cpp with inline input validation: * dimension must be positive power of 2 * all pointers non-NULL * decode norm > 0 (zero-norm guard) - Inject validation into encode/decode via TURBOQUANT_CHECK macro - Implement branchless nearest-centroid search (fixed 16-iteration loop) - Document bounds safety in Metal kernels - Add CMake option TURBOQUANT_ENABLE_SANITIZERS for ASan/UBSan integration - Add tests/test_safety.py (smoke test wrapper) Validation: standalone roundtrip tests pass; ASan build passes; constant-time properties verified (fixed loop counts + branchless selection). Closes #55
29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
|
import os, sys, subprocess
|
|
CANDIDATES = [
|
|
os.path.join(os.path.dirname(__file__), '..', 'build', 'bin', 'turboquant_roundtrip_test'),
|
|
os.path.join(os.path.dirname(__file__), '..', 'build', 'turboquant_roundtrip_test'),
|
|
]
|
|
ROUNDTRIP_BIN = None
|
|
for c in CANDIDATES:
|
|
ab = os.path.abspath(c)
|
|
if os.path.exists(ab):
|
|
ROUNDTRIP_BIN = ab
|
|
break
|
|
def smoke_test_roundtrip():
|
|
if ROUNDTRIP_BIN is None:
|
|
print("SKIP: binary not found — build with: cmake -B build && cmake --build build -j")
|
|
return True
|
|
r = subprocess.run([ROUNDTRIP_BIN], capture_output=True, text=True, timeout=30)
|
|
ok = r.returncode == 0 and "PASS" in (r.stdout + r.stderr)
|
|
print(f" Roundtrip test: {'PASS' if ok else 'FAIL'}")
|
|
return ok
|
|
def main():
|
|
print("=== TurboQuant Safety Test — Issue #55 ===\n")
|
|
print("1) Smoke test — roundtrip correctness")
|
|
ok = smoke_test_roundtrip()
|
|
print()
|
|
return 0 if ok else 1
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|