Files

26 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Regenerates every file in output/. Needs JDK 25, Maven, curl, python3 and (for step 2) Playwright for
# Python with Chromium. Timing-dependent figures (back-pressure samples, cancel counts) differ run to run.
source "$(dirname "$0")/lib.sh"; set +e
echo "[1/6] unit + integration tests (write output/01..05)"
mvn -B -q test 2>&1 | grep "Tests run:\|FAIL\|ERROR" | tail -3
build
echo "[2/6] real browser (headless Chromium): memory, escaping, Stop button -> output/06-browser.txt, 07-stop-logs.txt"
stop_all; start_stub 20; start_app
python3 scripts/browser-test.py "http://localhost:$APP_PORT" "http://localhost:$STUB_PORT" > output/06-browser.txt 2>&1
sleep 12 # let the stub finish or abort the 200-token stream
{ echo "-- app log (the turn started by the Stop-button test)"; grep -E "CANCELLED|count 200" "$RUN/app.log"
echo "-- stub log"; grep -E "count 200|stream #.* (finished|client closed)" "$RUN/stub.log" | tail -2; } > output/07-stop-logs.txt
stop_all
echo "[3/6] client abort, upstream closed or left open? 8 runs each -> output/08-cancel-upstream.txt"
{ scripts/cancel-upstream.sh 20 8 --chat.cancel-fix=false; echo; scripts/cancel-upstream.sh 20 8; } 2>&1 | grep -v "^Picked\|Done" > output/08-cancel-upstream.txt
echo "[4/6] slow client, four ways to shape the Flux -> output/09-backpressure.txt"
for m in none limitRate slow bounded; do scripts/backpressure.sh "$m"; echo; done 2>&1 | grep -v "^Picked\|Done" > output/09-backpressure.txt
echo "[5/6] a 35 s answer with no async timeout configured -> output/10-long-stream.txt"
stop_all; start_stub 50; start_app
{ echo '$ curl -sN "localhost:'$APP_PORT'/chat/stream?message=count 700" (700 tokens x 50 ms = 35 s)'
s=$(date +%s); curl -sN "localhost:$APP_PORT/chat/stream?message=count%20700&turn=1" | tail -n 4 | sed 's/^$/<blank>/'
echo "elapsed: $(( $(date +%s) - s )) s"; grep -E "complete|error" "$RUN/app.log"; } > output/10-long-stream.txt 2>&1
stop_all
echo "[6/6] done"