[tools] (P7): window-2 reducers follow the contract formula, require every block and one boot session

This commit is contained in:
2026-09-23 14:39:40 -04:00
parent cf54962a61
commit 6b8690f1d5
12 changed files with 1120 additions and 146 deletions
@@ -9,9 +9,13 @@
# 40-bsl-stats.sh bsl-esc-menu x {inproc, spawn} with MOBILEGL_PIPE_STATS + maps sampler
# 50-cts-after.sh five KHR-GL46 blocks, inproc x DirectVulkan, AFTER lib deployed to mgcts
# 60-reduce.py gate-3 verdict per case, bsl peaks, CTS delta table + new-crash list
# 90-restore.sh Home, supervisor as found, unpin, stay-on as found
# 90-restore.sh Home, supervisor as found, unpin, stay-on as found, $BASE lib back in mgcts
# Each finished step leaves <out>/steps/<step>.done; a re-run skips it (gate3 / cts also resume
# inside a step). A step that fails stops the sequence; fix the cause and run the same command.
# inside a step). A step that exits 3 (gate3 / cts: loop finished, some pairs / blocks INCOMPLETE)
# is NOT marked done and the sequence carries on; a re-run of the same command retries only what
# is missing (after re-entering the same boot session with 21-preflight.sh, no reboot, if the
# phone was already restored). reduce and restore run on every pass. Any other failure stops the
# sequence; fix the cause and run the same command (RUNBOOK section 1).
set -euo pipefail
HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
. "$HERE/lib.sh"
@@ -33,13 +37,21 @@ OUT=$(w2_out "$STAMP")
mkdir -p "$OUT/steps"
log "=== WINDOW 2 START sha=$SHA stamp=$STAMP out=$OUT ==="
PARTIAL=""
skipped() { case "$SKIP" in *",$1,"*) return 0;; esac; return 1; }
step() { # <name> <command...>
local name=$1; shift
if [ -f "$OUT/steps/$name.done" ]; then log "--- $name: done earlier, skipping"; return 0; fi
case "$SKIP" in *",$name,"*) log "--- $name: skipped by --skip"; return 0;; esac
if skipped "$name"; then log "--- $name: skipped by --skip"; return 0; fi
log "--- $name: $*"
local t0; t0=$(date +%s)
"$@"
local t0 rc=0; t0=$(date +%s)
"$@" || rc=$?
if [ $rc -eq 3 ]; then
PARTIAL="$PARTIAL $name"
log "--- $name: INCOMPLETE after $(( $(date +%s) - t0 ))s - not marked done; the next run of this command retries what is missing"
return 0
fi
[ $rc -eq 0 ] || die "--- $name failed (rc=$rc); fix the cause and run the same command"
date -Is > "$OUT/steps/$name.done"
log "--- $name: OK in $(( $(date +%s) - t0 ))s"
}
@@ -47,11 +59,29 @@ step() { # <name> <command...>
step build bash "$HERE/10-build.sh" "$SHA" "$STAMP"
step preflight bash "$HERE/21-preflight.sh" "$STAMP" $REBOOT
step install bash "$HERE/20-install.sh" "$STAMP"
# A previous pass restored the phone (unpinned, stay-on as found) with device steps still open:
# re-enter the SAME boot session first (no reboot; 21-preflight.sh stops if the phone rebooted).
if [ -f "$OUT/steps/restore.done" ]; then
for s in gate3 bsl cts; do
if [ ! -f "$OUT/steps/$s.done" ] && ! skipped "$s"; then
log "--- resume: $s still open after a restore; re-entering the session"
bash "$HERE/21-preflight.sh" "$STAMP"
rm -f "$OUT/steps/restore.done"
break
fi
done
fi
step gate3 bash "$HERE/30-gate3.sh" "$STAMP"
step bsl bash "$HERE/40-bsl-stats.sh" "$STAMP"
step cts bash "$HERE/50-cts-after.sh" "$STAMP"
# The verdict is data, not a stop condition: a red gate still has to restore the phone.
# The verdict is data, not a stop condition: a red gate still has to restore the phone. Both run on
# every pass (cheap, idempotent), so a resumed window re-reduces and re-restores.
rm -f "$OUT/steps/reduce.done" "$OUT/steps/restore.done"
step reduce bash -c "python3 '$HERE/60-reduce.py' '$STAMP' > '$OUT/verdict.txt' 2>&1; echo reduce-rc=\$? >> '$OUT/verdict.txt'"
step restore bash "$HERE/90-restore.sh" "$STAMP"
log "=== WINDOW 2 DONE $STAMP: verdict in $OUT/verdict.txt ==="
if [ -n "$PARTIAL" ]; then
log "=== WINDOW 2 INCOMPLETE $STAMP: step(s)$PARTIAL left open; run the same command again (RUNBOOK section 1). verdict so far in $OUT/verdict.txt ==="
else
log "=== WINDOW 2 DONE $STAMP: verdict in $OUT/verdict.txt ==="
fi
cat "$OUT/verdict.txt"