Files
BT411/scratchpad/night13/layoutteardown.sh
T
Joe DiPrimaandClaude Opus 5 43d30ca7e4 #140 receipts: name the corruption case in a FIELD log
Two ungated one-liners, because no bench here reached the failing path and
the next playtest is a better instrument than more automation:

  [glasswin] destroy entry #N windows=M   -- N=2,M=0 is the double-destroy
  [glasswin] saved ... (live=L remembered=R) -- live=0 IS the corruption case
                                                (pre-cache that wrote a file
                                                holding only the plasma line)

Also lands the benches that did NOT reproduce it, with their failure modes
recorded in the headers so the next attempt does not repeat them:
layoutsave.sh (round trip -- passes on the fixed build), layoutteardown.sh
(graceful WM_CLOSE; still never reaches the dtor chain), layoutround.sh (MP
round boundary; the relay never started the mission inside the window).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NCJQkvq6G2JNrpVbA75tVZ
2026-08-07 01:23:33 -05:00

53 lines
2.1 KiB
Bash

#!/usr/bin/env bash
# =========================================================================
# #140 -- exercise the TEARDOWN path, which is where the bug lives.
#
# WHY THIS EXISTS: bench_common's bt_kill_ours uses `taskkill /F`. That is a
# HARD kill -- no destructors, so ~LBE4ControlsManager / ~PadRIO never run and
# BTGlassPanels_Destroy (the function that saves, and the one that ran twice)
# is never reached. Both of the first attempts died before teardown and the
# result looked like a difference between builds when it was really a
# difference in how far each run got. A graceful `taskkill` (NO /F) posts
# WM_CLOSE and lets the dtor chain run.
#
# Pass a label; run it once on the pre-fix build and once on the fixed one.
# =========================================================================
LABEL="${1:-run}"
. /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 2
rm -f glass_layout.cfg lt_${LABEL}.log
( export BT_GLASS_PANELS=1 BT_GLASS_LAYOUT=save
bt_launch lt_${LABEL}.log ARENA1.EGG 0x03 )
# wait for the panels to actually exist before asking for a shutdown
for i in $(seq 1 60); do
grep -aq "per-display cockpit up" lt_${LABEL}.log 2>/dev/null && break
sleep 2
done
grep -aq "per-display cockpit up" lt_${LABEL}.log || { echo "PANELS NEVER CAME UP"; }
sleep 20 # let it settle into the mission
PID=$(cat "$BT_PIDFILE" 2>/dev/null | head -1)
echo "graceful close of pid $PID"
taskkill //PID "$PID" > /dev/null 2>&1 # NO /F -- WM_CLOSE, dtors run
for i in $(seq 1 30); do
tasklist //FI "PID eq $PID" 2>/dev/null | grep -q btl4 || break
sleep 1
done
taskkill //F //IM btl4.exe > /dev/null 2>&1 # backstop
rm -f "$BT_PIDFILE"
sleep 2
echo "=============== $LABEL ==============="
echo "--- every SaveLayout receipt (TWO lines = the double-save) ---"
grep -a "window position" lt_${LABEL}.log
echo
echo "--- glass_layout.cfg entries after teardown ---"
grep -aE "^[^#]+=" glass_layout.cfg 2>/dev/null || echo "(no file)"
echo
echo -n "entry count: "; grep -acE "^[^#]+=" glass_layout.cfg 2>/dev/null || echo 0