Something went wrong. Try again.
small gleam coding and (not yet) persistent agent daemon with a detachable cli forked from okami.mom/albedo
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113#!/usr/bin/env bash# The gate before a commit. ./test.sh runs every check but only the e2e tests# the change touches (test/e2e/e2e_select.py picks them, and Go e2e only for a# cli/ change); ./test.sh --full runs everything, as CI does on every push.## test/quick.sh runs first, then the other quick checks. Then the daemon is# compiled once and every suite runs at the same time, each into its own log,# which is printed only if that suite fails. The e2e suites boot their daemons# from that one snapshot (ALBEDO_TEST_DAEMON) instead of through gleam, so none# of them waits on the build lock `gleam test` holds for its whole run.# test/manual is opt-in and not run here; those harnesses need a provider, a# PTY, or artifacts from an earlier benchmark run.set -euo pipefailcd "$(dirname "$0")"full=falsecase "${1:-}" in--full) full=true ;;"") ;;*) echo "usage: $0 [--full]" >&2 exit 2 ;;esacexport ALBEDO_NO_BROWSER=1# a detached kernel a suite left behind ends soon after, not in an hourexport ALBEDO_KERNEL_GRACE_SECONDS=20
test/quick.shcargo test --quiet --release --locked --manifest-path native/render/Cargo.tomlnative/render/install.shnpm --prefix web test# the Python e2e suite drives the CLI through this binarygo -C cli build -o bin/albedo ./cmd/albedo
scratch="${ALBEDO_TEST_TMP:-/tmp/albedo-tests}/gate-$$"mkdir -p "$scratch"trap 'rm -rf "$scratch"' EXITALBEDO_TEST_DAEMON="$(test/snapshot-daemon.sh "$scratch/daemon")"export ALBEDO_TEST_DAEMON
names=()pids=()log() { echo "$scratch/${1//[\/ ]/-}.log"}suite() { local name="$1" shift "$@" >"$(log "$name")" 2>&1 & names+=("$name") pids+=("$!")}failed=0# Names the suites still running every 30 s, so a long quiet stretch (CI's log# shows nothing until a suite ends) reads as progress rather than a stall.ticker() { while sleep 30; do local running=() for i in "${!pids[@]}"; do if kill -0 "${pids[$i]}" 2>/dev/null; then running+=("${names[$i]}") fi done echo "... ${SECONDS}s, still running: ${running[*]}" done}# Waits for every suite started so far, printing each one's log if it failed.settle() { ticker & local ticking=$! for i in "${!pids[@]}"; do if wait "${pids[$i]}"; then echo "ok ${names[$i]}" else failed=1 echo "FAILED ${names[$i]}" cat "$(log "${names[$i]}")" fi done kill "$ticking" wait "$ticking" 2>/dev/null || true names=() pids=()}
suite "gleam test" gleam testfor test in test/harness/*_test.py; do suite "$test" python3 test/python_test_runner.py "$test"donesuite "go test" go -C cli test ./internal/... ./cmd/...# the Go e2e suite builds its own CLI and boots a hermetic daemon, so it must# never reuse a cached run. Bound parallel scenarios while the other suites run.go_parallel="$(python3 -c 'import os; print(max(1, min(4, (os.cpu_count() or 1) // 4)))')"if $full; then # On a machine with fewer cores (CI's VM) the e2e suites' daemon boots starve # the unit suites' startup timeouts, so they run after them. settle suite "go e2e" go -C cli test -count=1 -parallel="$go_parallel" ./test/e2e suite "python e2e" python3 test/e2e/run.pyelse if { git diff --name-only origin/main...HEAD git diff --name-only HEAD git ls-files --others --exclude-standard } | grep '^cli/' >/dev/null; then suite "go e2e" go -C cli test -count=1 -parallel="$go_parallel" ./test/e2e fi mapfile -t selected < <(python3 test/e2e/e2e_select.py --print-reasons) suite "python e2e" python3 test/e2e/run.py "${selected[@]}"fisettleexit "$failed"