Files
zeekayandHanzo Dev 377c4f4416 make check — does this checkout work
Twelve lanes in the order that needs the least, so the first failure names the
smallest missing piece: node, then go, then the cloud source, then fetched data.

A lane whose data nobody has fetched is SKIPPED and says which command fetches
it, counted separately from the passes. Twelve ok over four silent skips is the
same green a broken suite prints, and this suite has spent a week finding
exactly that shape.

It names the tree the binary lanes build from, above their results. Two
different repositories check out as `cloud`; against the wrong one all five run
and fail, which reads as five broken lanes rather than one wrong path. With the
line printed, `hanzo-inc/cloud · c17b10d8` sits directly above four failures and
the diagnosis is immediate.

Verified from a fresh clone: 12 ok, 0 failed, 2 skipped with the source named.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-16 13:03:44 -07:00

57 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Does this checkout work?
#
# Not a benchmark: a benchmark tells you what something costs, and this tells you
# whether the thing that measures it runs at all. Every lane, in the order that
# needs the least, so the first failure names the smallest missing piece.
#
# bash check.sh # everything it can reach
# CLOUD_SRC=/path bash check.sh # including the four that build the binary
#
# A lane that needs data nobody has fetched is SKIPPED and says so. A lane that
# runs and fails is a failure. The difference matters: this file existing and
# reporting "0 failed" over four skipped lanes would be the same green a broken
# suite prints.
set -uo pipefail
cd "$(dirname "$0")"
ok=0 bad=0 skip=0
run() {
local name=$1; shift
printf ' %-32s ' "$name"
if "$@" >/tmp/bench-check.log 2>&1; then printf 'ok\n'; ok=$((ok + 1))
else printf 'FAIL — %s\n' "$(grep -vE '_nvm_lazy|^ld: warning' /tmp/bench-check.log | tail -1 | cut -c1-58)"; bad=$((bad + 1)); fi
}
skipped() { printf ' %-32s skipped — %s\n' "$1" "$2"; skip=$((skip + 1)); }
echo 'needs only node'
run 'fleet' node fleet/fleet.mjs /tmp/bench-check-fleet
run 'pricing' node pricing/pricing.mjs
run 'sandbox' node sandbox/sandbox.mjs
echo 'needs go'
if command -v go >/dev/null; then
run 'goroutine builds' env GOWORK=off go build -o /tmp/bench-check-g ./goroutine
run 'transport harness builds' env GOWORK=off go build -o /tmp/bench-check-t ./transport/harness
else
skipped 'goroutine' 'no go toolchain'; skipped 'transport harness' 'no go toolchain'
fi
echo 'needs the cloud source (CLOUD_SRC, or ../cloud)'
# NAME THE SUBJECT BEFORE MEASURING IT. These five build a binary, and two
# different repositories check out as `cloud`. Against the wrong one they run
# and fail, which reads as five broken lanes instead of one wrong path — so the
# tree is printed here, above its own results.
if . ./host.sh && cloud_src >/dev/null 2>&1; then
cloud_src >/dev/null 2>/tmp/bench-check-src; sed 's/^/ /' /tmp/bench-check-src | grep . | head -1
run 'self' bash self/run.sh
run 'self/modules' bash self/modules.sh
run 'cipher' bash cipher/run.sh
run 'egress' bash egress/run.sh
run 'transport' bash transport/run.sh
else
for l in self self/modules cipher egress transport; do skipped "$l" 'no cloud source — see README'; done
fi
printf '\n%d ok, %d failed, %d skipped\n' "$ok" "$bad" "$skip"
[ "$bad" -eq 0 ]