R1: Linux export pipeline (make dist, make dist-check)
make dist (tools/dist.sh) checks the official export templates against tools/engine.sha512, installs only the Linux x86_64 ones into the repo-local engine data, exports the "Linux" preset, checks the binary is the verified release template, and packs build/dist/tidewall-<version>-linux-x86_64.tar.gz with a .sha256: tidewall.x86_64, tidewall.pck, a tidewall-server launcher that runs the same game headless with clean SIGTERM handling, an example server.cfg, README, VERSION, licences and asset provenance. BuildInfo gives the version (application/config/version, now 0.9.0) and the commit (build_commit.txt written by make dist, or .git in a checkout). The main menu shows "Version 0.9.0 (commit)" and the server's start log line carries version and commit. make dist-check (tools/dist_check.sh) unpacks the package outside the repo with HOME and XDG dirs in a temp dir and runs smoke against it (new SMOKE_DIST mode), a whole bot match, and the exported game joining the exported server over loopback. A release template crashes on a call on null (exit 139) and ignores invalid calls, so in package mode smoke's fault check expects only a non-zero exit. Closes #60 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+32
-8
@@ -9,6 +9,8 @@
|
||||
#
|
||||
# tools/smoke.sh unthrottled, so it finishes in seconds
|
||||
# SMOKE_REALTIME=1 tools/smoke.sh at the real 30 Hz tick rate (about 34 seconds)
|
||||
# SMOKE_DIST=DIR tools/smoke.sh the same checks on an unpacked release package
|
||||
# (R1): DIR/tidewall-server instead of the repo
|
||||
set -uo pipefail
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
||||
|
||||
@@ -18,11 +20,21 @@ pace="--unthrottled"
|
||||
[[ "${SMOKE_REALTIME:-0}" == "1" ]] && pace=""
|
||||
status=0
|
||||
code=0
|
||||
dist="${SMOKE_DIST:-}"
|
||||
if [[ -n "$dist" ]]; then
|
||||
[[ -x "$dist/tidewall-server" ]] || { echo "smoke FAIL: no $dist/tidewall-server"; exit 2; }
|
||||
dist_state="$(mktemp -d)"
|
||||
trap 'rm -rf "$dist_state"' EXIT
|
||||
fi
|
||||
|
||||
# run <args...>: runs the server, sets $output (JSON lines only) and $code.
|
||||
run() {
|
||||
local raw
|
||||
raw="$(timeout --signal=KILL 300 tools/godot.sh -- --server "$@" 2>&1)"
|
||||
if [[ -n "$dist" ]]; then
|
||||
raw="$(TIDEWALL_STATE="$dist_state" timeout --signal=KILL 300 "$dist/tidewall-server" "$@" 2>&1)"
|
||||
else
|
||||
raw="$(timeout --signal=KILL 300 tools/godot.sh -- --server "$@" 2>&1)"
|
||||
fi
|
||||
code=$?
|
||||
output="$(grep '^{' <<<"$raw")"
|
||||
stderr_tail="$(grep -v '^{' <<<"$raw" | tail -n 15)"
|
||||
@@ -52,7 +64,7 @@ seeded="$(grep -c "\"seed\":$seed[,}]" <<<"$output")"
|
||||
[[ "$lines" -eq "$seeded" ]] || fail "only $seeded of $lines log lines carry the seed"
|
||||
[[ "$(field stats ticks)" == "$ticks" ]] || fail "ran $(field stats ticks) ticks, expected $ticks"
|
||||
hash="$(field stats state_hash)"
|
||||
echo "smoke: $ticks ticks, 24 bots, seed $seed"
|
||||
echo "smoke: $ticks ticks, 24 bots, seed $seed${dist:+, release package $dist}"
|
||||
echo "smoke: tick us min $(field stats min_us) mean $(field stats mean_us) p50 $(field stats p50_us)" \
|
||||
"p95 $(field stats p95_us) p99 $(field stats p99_us) max $(field stats max_us)," \
|
||||
"$(field stats over_budget) over the $(field stats budget_us) us budget"
|
||||
@@ -63,8 +75,14 @@ run --seed="$seed" --bots=24 --ticks="$ticks" --unthrottled
|
||||
|| fail "a second run with the same seed gave a different state hash"
|
||||
|
||||
run --seed="$seed" --bots=2 --ticks=50 --unthrottled --fault=script-error
|
||||
[[ "$code" -eq 1 ]] || fail "a script error exited $code, expected 1"
|
||||
[[ "$(field stop errors)" -ge 1 ]] || fail "a script error wasn't counted in the stop line"
|
||||
if [[ -n "$dist" ]]; then
|
||||
# A release template has no script error checks: the call on null crashes the
|
||||
# process (139) rather than being reported. Either way it must not exit 0.
|
||||
[[ "$code" -ne 0 ]] || fail "a script error exited 0 in the release package"
|
||||
else
|
||||
[[ "$code" -eq 1 ]] || fail "a script error exited $code, expected 1"
|
||||
[[ "$(field stop errors)" -ge 1 ]] || fail "a script error wasn't counted in the stop line"
|
||||
fi
|
||||
|
||||
run --bots=99 --nonsense
|
||||
[[ "$code" -eq 2 ]] || fail "a bad command line exited $code, expected 2"
|
||||
@@ -79,9 +97,13 @@ run --listen --port="$port" --seed="$seed" --bots=4 --ticks=120 --unthrottled
|
||||
|
||||
# SIGTERM to the packaged wrapper becomes a clean stop: stats and stop lines, exit 0.
|
||||
state="$(mktemp -d)"
|
||||
TIDEWALL_ENGINE="$(pwd)/tools/godot/$(sed -n 's/^\([0-9a-f]*\) *tools\/godot\/\(.*_linux\.x86_64\)$/\2/p' tools/engine.sha512)" \
|
||||
TIDEWALL_GAME="$(pwd)" TIDEWALL_STATE="$state" \
|
||||
packaging/server/tidewall-server --seed="$seed" --bots=2 >"$state/log" 2>&1 &
|
||||
if [[ -n "$dist" ]]; then
|
||||
TIDEWALL_STATE="$state" "$dist/tidewall-server" --seed="$seed" --bots=2 >"$state/log" 2>&1 &
|
||||
else
|
||||
TIDEWALL_ENGINE="$(pwd)/tools/godot/$(sed -n 's/^\([0-9a-f]*\) *tools\/godot\/\(.*_linux\.x86_64\)$/\2/p' tools/engine.sha512)" \
|
||||
TIDEWALL_GAME="$(pwd)" TIDEWALL_STATE="$state" \
|
||||
packaging/server/tidewall-server --seed="$seed" --bots=2 >"$state/log" 2>&1 &
|
||||
fi
|
||||
wrapper=$!
|
||||
for _ in $(seq 1 100); do
|
||||
grep -q '"event":"start"' "$state/log" 2>/dev/null && break
|
||||
@@ -97,6 +119,8 @@ grep -q '"event":"stats"' <<<"$output" || fail "SIGTERM left no stats line"
|
||||
[[ "$(field stop exit_code)" == "0" ]] || fail "SIGTERM left no clean stop line"
|
||||
|
||||
if [[ "$status" -eq 0 ]]; then
|
||||
echo "smoke: ok (clean run, reproducible hash, script error exits 1, bad config exits 2, listens, SIGTERM stops cleanly)"
|
||||
fault_exit="1"
|
||||
[[ -n "$dist" ]] && fault_exit="non-zero"
|
||||
echo "smoke: ok (clean run, reproducible hash, script error exits $fault_exit, bad config exits 2, listens, SIGTERM stops cleanly)"
|
||||
fi
|
||||
exit "$status"
|
||||
|
||||
Reference in New Issue
Block a user