#!/usr/bin/env bash # verify_build.sh - Quick build correctness/uptodate check set -euo pipefail if [[ $# -lt 1 ]]; then echo "Usage: $0 " >&2 exit 1 fi bin="$1" if [[ ! -f "$bin" ]]; then echo "❌ Error: $bin not found" >&2 exit 2 fi # Check if any sources are newer than the binary bin_time=$(stat -c %Y "$bin") src_time=$(find core include adapters engines benchmarks/src -type f \( -name '*.c' -o -name '*.h' -o -name '*.inc' -o -name '*.inc.h' \) -printf '%T@\n' 2>/dev/null | sort -nr | head -n1 | cut -d. -f1) if [[ -n "${src_time}" && "${src_time}" -gt "${bin_time}" ]]; then newest=$(find core include adapters engines benchmarks/src -type f \( -name '*.c' -o -name '*.h' -o -name '*.inc' -o -name '*.inc.h' \) -printf '%T@ %p\n' 2>/dev/null | sort -nr | head -n1 | cut -d' ' -f2-) echo "⚠️ Warning: Sources newer than binary: $newest" >&2 exit 3 fi echo "✅ Build verification passed for $bin"