#!/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