#!/bin/sh # Launch a map and report honestly. Three distinct outcomes — never conflate them: # PASS reached gameplay, no exceptions # FAIL crashed / lua fatal (real bug, output shown) # DISPLAY_UNAVAILABLE hung at mod load: OpenRA is SDL/OpenGL only, so a # locked or sleeping screen stalls it forever. The process # stays ALIVE, which is why "is it still running?" is a # worthless check and this script exists. # # usage: tools/smoketest.sh [seconds] set -u MAP="${1:-arena}" WAIT="${2:-90}" DIR="$(cd "$(dirname "$0")/.." && pwd)" OUT="$(mktemp -t vg_smoke)" export PATH="/opt/homebrew/opt/dotnet@8/bin:$PATH" export DOTNET_ROLL_FORWARD=LatestMajor cd "$DIR" || exit 2 ./launch-game.sh Game.Mod=vinylgod "Launch.Map=$MAP" > "$OUT" 2>&1 & i=0 while [ "$i" -lt "$WAIT" ]; do sleep 3 i=$((i + 3)) if grep -qi "Fatal Lua\|Exception of type" "$OUT"; then echo "FAIL $MAP" grep -iE "Fatal Lua|Exception of type" "$OUT" | head -3 pkill -f OpenRA.dll exit 1 fi if grep -q "Game started" "$OUT"; then sleep 15 if grep -qi "Fatal Lua\|Exception of type" "$OUT"; then echo "FAIL $MAP (crashed after start)" grep -iE "Fatal Lua|Exception of type" "$OUT" | head -3 pkill -f OpenRA.dll exit 1 fi echo "PASS $MAP (reached gameplay, clean for 15s)" pkill -f OpenRA.dll exit 0 fi done pkill -f OpenRA.dll echo "DISPLAY_UNAVAILABLE $MAP (never reached gameplay in ${WAIT}s, no crash)" echo " -> wake the screen and re-run; this is NOT a pass and NOT a code failure" exit 3