12# run.sh - what `make stress` does: fetch the datasets, run the stress3# benchmarks (built with -tags stress), print a summary table, and append4# the run to .deps/stress/results/runs.jsonl for make stress-report. When5# the observability stack is up (make obs-up), the run also goes to6# ClickHouse.7#8# BENCH=Edit|Frame only these benchmarks (a go test -bench pattern)9# BENCHTIME=500ms per benchmark (slow ones still run once)10# COUNT=1 samples per benchmark (make stress-report reads11# their spread as noise)12# PKGS="./internal/sheet"13set -euo pipefail1415root=$(cd "$(dirname "$0")/../.." && pwd)16cd "$root"17"$root/scripts/stress-data.sh"1819out="$root/.deps/stress/results"20mkdir -p "$out"21raw="$out/raw-$(date -u +%Y%m%dT%H%M%SZ).txt"22pkgs=${PKGS:-"./internal/sheet ./internal/ui ./internal/fileio ./internal/chart ./internal/telemetry ./internal/serve"}2324# shellcheck disable=SC2086 # pkgs is a list25STRESS_DIR="$root/.deps/stress" go test -tags stress -run '^$' \26 -bench "${BENCH:-.}" -benchmem -benchtime "${BENCHTIME:-500ms}" -count "${COUNT:-1}" -timeout 60m $pkgs 2>&1 |27 tee "$raw" | awk '/^Benchmark/ { print " " $1; fflush() } /^(FAIL|panic|--- FAIL)/ { print; fflush() }'2829sha=$(git -C "$root" rev-parse --short HEAD 2>/dev/null || echo unknown)30dirty=031if [ -n "$(git -C "$root" status --porcelain --untracked-files=no 2>/dev/null)" ]; then32 dirty=133fi34GIT_SHA=$sha GIT_DIRTY=$dirty go run ./internal/stress/benchrec -out "$out/runs.jsonl" <"$raw"35echo "raw output: $raw"3637if curl -fsS -o /dev/null "${CLICKHOUSE_URL:-http://localhost:8123}/ping" 2>/dev/null; then38 "$root/scripts/stress/clickhouse-load.sh"39fi