48 lines
2.1 KiB
Bash
48 lines
2.1 KiB
Bash
#!/usr/bin/env bash
|
|
# #163: the ordered-exit relaunch bench. Two nodes, short clock, BT_FE_LOOP
|
|
# armed -> both take BTFE_RelaunchSelfAndExit at natural expiry.
|
|
# Assert: old pids DEAD (TerminateProcess fired), menu children ALIVE,
|
|
# matchlogs end with complete tails (PEER_DOWN / no mid-combat truncation).
|
|
. /c/git/bt411/scratchpad/night6/bench_common.sh
|
|
cd /c/git/bt411/content || exit 1
|
|
taskkill //F //IM btl4.exe >/dev/null 2>&1; sleep 3
|
|
rm -f rl_a.log rl_b.log rl_r.log
|
|
mv matchlog_*.txt /c/git/bt411/scratchpad/night15/mlbak/ 2>/dev/null
|
|
bt_expert_egg MP.EGG RL.EGG
|
|
sed -i "s/^map=.*/map=grass/; s/^time=.*/time=day/; s/^vehicle=.*/vehicle=madcat/; s/^length=.*/length=90/" RL.EGG
|
|
|
|
( export BT_FE_LOOP=1 BT_MATCHLOG=1 BT_SCORE_LOG=1
|
|
bt_launch rl_b.log RL.EGG 0x0C -net 1601 )
|
|
sleep 2
|
|
( export BT_FE_LOOP=1 BT_MATCHLOG=1 BT_SCORE_LOG=1
|
|
export BT_GOTO=enemy BT_GOTO_STOP=120 BT_AUTOFIRE=1 BT_AF_MISSILE=1 BT_AF_PERIOD=6
|
|
bt_launch rl_a.log RL.EGG 0x03 -net 1501 )
|
|
sleep 5
|
|
OLD_PIDS=$(tasklist //FI "IMAGENAME eq btl4.exe" //NH | awk '{print $2}' | sort | tr '\n' ' ')
|
|
echo "mission pids: $OLD_PIDS"
|
|
python ../tools/btconsole.py RL.EGG 127.0.0.1:1501 127.0.0.1:1601 > rl_r.log 2>&1 &
|
|
R=$!
|
|
sleep 170 # 90s clock + boot + margin; both nodes should relaunch menus
|
|
kill $R 2>/dev/null
|
|
|
|
NEW_PIDS=$(tasklist //FI "IMAGENAME eq btl4.exe" //NH | awk '{print $2}' | sort | tr '\n' ' ')
|
|
echo "post-round pids: $NEW_PIDS"
|
|
FAIL=0
|
|
for p in $OLD_PIDS; do
|
|
if echo " $NEW_PIDS " | grep -q " $p "; then
|
|
echo "FAIL: old mission pid $p STILL ALIVE (zombie -- TerminateProcess did not fire)"
|
|
FAIL=1
|
|
fi
|
|
done
|
|
NEWCOUNT=$(echo $NEW_PIDS | wc -w)
|
|
if [ "$NEWCOUNT" -lt 2 ]; then
|
|
echo "FAIL: expected 2 menu children, found $NEWCOUNT"
|
|
FAIL=1
|
|
fi
|
|
echo "--- [fe] relaunch lines:"
|
|
grep -ac "mission over -- relaunching" rl_a.log rl_b.log
|
|
echo "--- matchlog tails (want PEER_DOWN / clean end, not mid-combat truncation):"
|
|
for m in matchlog_*.txt; do echo "== $m"; tail -3 "$m"; done
|
|
taskkill //F //IM btl4.exe >/dev/null 2>&1
|
|
if [ "$FAIL" = "0" ]; then echo "VERDICT: PASS -- ordered exit relaunches clean, no zombies"; else echo "VERDICT: FAIL"; fi
|