From 0797b11ab9398ea90d444a47d95c2fd8ed27bdbd Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Nov 2026 22:08:16 -0500 Subject: [PATCH] H7: Test the SIGTERM stop in smoke tools/smoke.sh now starts the server through packaging/server/tidewall-server, sends the wrapper SIGTERM once the server has started, and checks it writes its stats and stop lines and exits 0, as H7 asked. make check runs it. Refs #70 Co-Authored-By: Claude Opus 5.5 --- tools/smoke.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tools/smoke.sh b/tools/smoke.sh index aacbcc5..fe9185b 100755 --- a/tools/smoke.sh +++ b/tools/smoke.sh @@ -77,7 +77,26 @@ run --listen --port="$port" --seed="$seed" --bots=4 --ticks=120 --unthrottled [[ "$(field start listening)" == "true" ]] || fail "a listening server didn't say it was listening" [[ "$(field start match_phase)" == "lobby" ]] || fail "a listening server didn't start in the lobby" +# 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 & +wrapper=$! +for _ in $(seq 1 100); do + grep -q '"event":"start"' "$state/log" 2>/dev/null && break + sleep 0.1 +done +kill -TERM "$wrapper" +wait "$wrapper" +code=$? +output="$(grep '^{' "$state/log")" +rm -rf "$state" +[[ "$code" -eq 0 ]] || fail "SIGTERM to the server wrapper exited $code, expected 0" +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)" + echo "smoke: ok (clean run, reproducible hash, script error exits 1, bad config exits 2, listens, SIGTERM stops cleanly)" fi exit "$status"