#!/usr/bin/env bash # verify.sh [--all-features] — run tests under 2G memory scope; exit non-zero on any failure. set -u LOG=$(mktemp) if [ "${1:-}" = "--all-features" ]; then systemd-run --user --scope -p MemoryMax=2G -p MemorySwapMax=0 cargo test --all-features >"$LOG" 2>&1 else systemd-run --user --scope -p MemoryMax=2G -p MemorySwapMax=0 cargo test >"$LOG" 2>&1 fi TEST_RC=$? grep -E "^test result" "$LOG" | awk '{p+=$4; f+=$6} END {if (f>0) failed=1; print "tests passed:"p+0" failed:"f+0; exit failed}' || { echo "TESTS FAILED"; grep -B2 -A12 "panicked\|FAILED" "$LOG" | head -60; rm -f "$LOG"; exit 1; } if [ "$TEST_RC" -ne 0 ]; then grep -B2 -A12 "panicked\|FAILED\|error\[" "$LOG" | head -60 rm -f "$LOG"; exit 1 fi rm -f "$LOG" cargo clippy --all-targets -- -D warnings >"$LOG" 2>&1 || { echo "CLIPPY FAILED"; grep -E "warning|error" "$LOG" | head -20; rm -f "$LOG"; exit 1; } cargo fmt --check || { echo "FMT FAILED"; exit 1; } rm -f "$LOG" echo "VERIFY OK"