#!/usr/bin/env bash # Plays one whole offline match, lobby to results: one scripted player and 23 bots on # a local server. Saves the command log to build/match/match.tclog, replays it and # checks the replay ends in the same state. Prints one JSON line per event and the # verdict. See tools/match.gd. # # tools/match.sh seed 29, where the scripted player also builds # MATCH_SEED=7 tools/match.sh set -uo pipefail cd "$(dirname "${BASH_SOURCE[0]}")/.." seed="${MATCH_SEED:-29}" [[ "$seed" =~ ^[0-9]+$ ]] || { echo "match FAIL: bad MATCH_SEED '$seed'"; exit 2; } raw="$(timeout --signal=KILL 900 nice -n 15 tools/godot.sh --script res://tools/match.gd -- --seed="$seed" 2>&1)" code=$? grep -E '^\{|^match' <<<"$raw" if [[ "$code" -ne 0 ]] && ! grep -q '^match' <<<"$raw"; then echo "match FAIL: the run exited $code" tail -n 15 <<<"$raw" fi exit "$code"