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 <noreply@anthropic.com>
This commit is contained in:
+20
-1
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user