[Docs] (.claude/skills, .github/workflows, CMakeLists.txt, docs/archive, docs/Disaggregated, docs/MobileVA, docs/Performance, MG_Backend, MG_Backend/DirectGLES, MG_Backend/DirectVulkan, MG_Backend/Record, MG_Gbm, MG_Impl, MG_Impl/EGLImpl, MG_Impl/GLImpl, MG_Impl/GLXImpl, MG_Impl/Pipe, MG_IntegrationTest, MG_IntegrationTest/Harness, MG_IntegrationTest/Scenarios, MG_Pipe, MG_Pipe/generated, MG_Remote, MG_Remote/Client, MG_Remote/Server, MG_Remote/Transport, MG_Remote/Wire, MG_State/GLState, MG_Test/Pipe, MG_Test/Util, MG_Test/Wire, MobileGL, scripts, scripts/data, tools/device_bench, userguide): archive the planning notes and agent contracts under docs/archive

- DEBTS.md and OPEN-QUESTIONS.md stay maintained, now in docs/Disaggregated.
This commit is contained in:
2026-10-15 20:01:45 -04:00
parent 0e3e2b7761
commit aabca3c171
1035 changed files with 410 additions and 398 deletions
+127
View File
@@ -0,0 +1,127 @@
#!/usr/bin/env bash
# 10-build.sh <pipe-sha> [<stamp>] [--apk-only|--host-only]
#
# Builds the window's two artefacts from ONE source commit and ONE explicit stamp:
# <out>/apk/trace-<stamp>.apk signed, debuggable, side-by-side id top.mobilegl.plugin.p7w1.trace
# <out>/host/{libMobileGL.so,libMobileGLServer.so,mobilegl_trace_replay} + catalog.json
# (<out> = ~/w7/logs/p7w7/<stamp>; stamp defaults to p7w7-<sha8>). The same stamp on both ends is
# what MOBILEGL_IPC_REQUIRE_SAME_BUILD=1 checks, and the device server must be THIS build (F changed
# the wire fingerprint: an old server + new client only says `no Welcome (rc=6)`).
#
# It never builds in ~/w7/pipe (read-only for agents, and a gate needs its status clean): the source
# is a DETACHED worktree ~/w7/p7w7-tree-<sha8> at <pipe-sha>, submodules copied from the pipe
# checkout when their recorded commit matches, the glslang External tree copied, LFS fixtures
# smudged by the worktree checkout. That tree is also the tools tree the device steps run from.
# Recipe = ~/w7/logs/p7w6-apk-inner.sh + ~/w7/logs/p7w6host-build.sh, parameterised.
set -euo pipefail
. "$(dirname "$0")/lib.sh"
[ $# -ge 1 ] || die "usage: $0 <pipe-sha> [<stamp>] [--apk-only|--host-only]"
SHA=$(git -C "$W2_PIPE" rev-parse --verify "$1^{commit}") || die "unknown commit $1 in $W2_PIPE"
SHA8=${SHA:0:8}
STAMP=${2:-p7w7-$SHA8}
case "${2:-}" in --*) STAMP=p7w7-$SHA8;; esac
MODE=all
for a in "$@"; do case "$a" in --apk-only) MODE=apk;; --host-only) MODE=host;; esac; done
TREE=${W2_BUILD_TREE:-$HOME/w7/p7w7-tree-$SHA8}
OUT=$(w2_out "$STAMP")
mkdir -p "$OUT/apk" "$OUT/host"
t0=$(date +%s)
log "build sha=$SHA stamp=$STAMP tree=$TREE out=$OUT mode=$MODE"
# ---- source tree ---------------------------------------------------------------------------
if [ ! -e "$TREE/.git" ]; then
log "creating detached worktree $TREE @ $SHA8"
git -C "$W2_PIPE" worktree add --detach "$TREE" "$SHA" > "$OUT/worktree.log" 2>&1
fi
[ "$(git -C "$TREE" rev-parse HEAD)" = "$SHA" ] || die "$TREE is not at $SHA (refusing to move a tree someone may be using)"
# Submodules: copy the pipe checkout's copy when it is at the recorded commit (fast, offline);
# otherwise fall back to a real submodule update for that path.
git -C "$TREE" submodule status | while read -r st path _; do
want=${st#[-+U ]}
[ -z "$(ls -A "$TREE/$path" 2>/dev/null)" ] || continue
have=$(git -C "$W2_PIPE/$path" rev-parse HEAD 2>/dev/null || true)
if [ "$have" = "$want" ]; then
rm -rf "$TREE/$path"
cp -a "$W2_PIPE/$path" "$TREE/$path"
rm -f "$TREE/$path/.git" # the gitlink points into pipe's module store: never share it
log "submodule $path: copied from pipe ($want)"
else
log "submodule $path: pipe has ${have:-nothing}, want $want - git submodule update"
git -C "$TREE" submodule update --init --recursive -- "$path"
fi
done
[ -d "$TREE/3rdparty/glslang/External/spirv-tools" ] \
|| cp -a "$W2_PIPE/3rdparty/glslang/External" "$TREE/3rdparty/glslang/"
if head -c 40 "$TREE/tools/trace_replay/fixtures/openra.tgz" | grep -q 'git-lfs'; then
log "fixtures are LFS pointers - git lfs pull"
git -C "$TREE" lfs pull
fi
# ---- APK -----------------------------------------------------------------------------------
if [ "$MODE" != host ]; then
ta=$(date +%s)
export JAVA_HOME=/usr/lib/jvm/java-21-openjdk ANDROID_HOME=$HOME/android-sdk ANDROID_SDK_ROOT=$HOME/android-sdk
export PATH=$JAVA_HOME/bin:$PATH
BT=$(ls -d "$HOME"/android-sdk/build-tools/* | sort -V | tail -1)
SUFFIX=${STAMP%%-*}
export MOBILEGL_BUILD_STAMP=$STAMP
( cd "$TREE"
rm -rf android-plugin/app/.cxx .cxx build/intermediates/cxx android-plugin/app/build/outputs/apk/trace
"$HOME/gradle-8.10.2/bin/gradle" --no-daemon -p android-plugin :app:assembleTraceRelease \
-Pmobilegl.apkSuffix="$SUFFIX" -Pmobilegl.applicationIdSuffix=.p7w1 -Pmobilegl.debuggableRelease=true \
-Pmobilegl.logLevel=MOBILEGL_LOG_LEVEL_INFO -Pmobilegl.pipePush=ON \
-Pmobilegl.buildDisaggregated=ON -Pmobilegl.buildDisaggregatedInproc=ON \
--parallel --max-workers 8 ) > "$OUT/apk/gradle.log" 2>&1 || { tail -40 "$OUT/apk/gradle.log"; die "gradle failed"; }
unsigned="$TREE/android-plugin/app/build/outputs/apk/trace/release/MobileGL-plugin-trace-release-$SUFFIX.apk"
[ -f "$unsigned" ] || die "gradle produced no $unsigned"
APK="$OUT/apk/trace-$STAMP.apk"
"$BT/apksigner" sign --ks "$HOME/.android/debug.keystore" --ks-pass pass:android --key-pass pass:android \
--ks-key-alias androiddebugkey --out "$APK" "$unsigned"
rm -rf "$TREE/android-plugin/app/.cxx"
( cd "$OUT/apk" && sha256sum "trace-$STAMP.apk" > apk.sha256 )
rm -rf "$OUT/apk/lib" && mkdir -p "$OUT/apk/lib"
unzip -o -q -j "$APK" lib/arm64-v8a/libMobileGL.so lib/arm64-v8a/libMobileGLServer.so -d "$OUT/apk/lib"
n=$(strings "$OUT/apk/lib/libMobileGL.so" | grep -c -F "$STAMP" || true)
[ "$n" -ge 1 ] || die "stamp $STAMP not found in the APK's libMobileGL.so"
( cd "$OUT/apk/lib" && sha256sum libMobileGL.so libMobileGLServer.so > ../lib.sha256 )
unzip -l "$APK" | grep -E 'libMobileGL(Server)?\.so' > "$OUT/apk/lib-listing.txt"
log "APK $(stat -c %s "$APK") bytes sha256 $(cut -c1-16 "$OUT/apk/apk.sha256"), stamp strings in lib: $n"
w2_timing "$OUT" build-apk "$ta" "$(date +%s)"
fi
# ---- host artefacts (the TCP client side; same stamp) ---------------------------------------
if [ "$MODE" != apk ]; then
th=$(date +%s)
cmake -S "$TREE" -B "$TREE/build-host" -G Ninja \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DMOBILEGL_BUILD_DISAGGREGATED=ON -DMOBILEGL_BUILD_DISAGGREGATED_INPROC=ON \
-DMOBILEGL_PIPE_PUSH=ON -DMOBILEGL_BUILD_TRACE_REPLAY=ON \
-DMOBILEGL_BUILD_INTEGRATION_TEST=ON -DMOBILEGL_BUILD_TEST=ON \
-DMOBILEGL_BUILD_STAMP="$STAMP" -DMOBILEGL_LOG_ACTIVE_LEVEL=MOBILEGL_LOG_LEVEL_INFO \
-DMOBILEGL_ITEST_EGL_VENDOR=/usr/share/glvnd/egl_vendor.d/50_mesa.json \
-DMOBILEGL_ITEST_VK_ICD=/usr/share/vulkan/icd.d/lvp_icd.json \
-DMOBILEGL_ITEST_TCP_ENDPOINT=tcp://127.0.0.1:41317 \
> "$OUT/host/configure.log" 2>&1 || { tail -30 "$OUT/host/configure.log"; die "host configure failed"; }
cmake --build "$TREE/build-host" -j 8 --target MobileGL MobileGLServer mobilegl_trace_replay \
> "$OUT/host/build.log" 2>&1 || { tail -30 "$OUT/host/build.log"; die "host build failed"; }
cp "$TREE/build-host/libMobileGL.so" "$TREE/build-host/libMobileGLServer.so" \
"$TREE/build-host/tools/trace_replay/mobilegl_trace_replay" "$OUT/host/"
n=$(strings "$OUT/host/libMobileGL.so" | grep -c -F "$STAMP" || true)
[ "$n" -ge 1 ] || die "stamp $STAMP not found in the host libMobileGL.so"
( cd "$OUT/host" && sha256sum libMobileGL.so libMobileGLServer.so mobilegl_trace_replay > ../host.sha256 )
( cd "$TREE/build-host" && ctest --show-only=json-v1 > "$OUT/host/catalog.json" )
log "host artefacts in $OUT/host (stamp strings: $n)"
w2_timing "$OUT" build-host "$th" "$(date +%s)"
fi
cat > "$OUT/build.env" <<EOF
BUILD_SHA=$SHA
BUILD_SHA8=$SHA8
BUILD_STAMP=$STAMP
BUILD_TREE=$TREE
BUILD_APK=$OUT/apk/trace-$STAMP.apk
EOF
w2_timing "$OUT" build "$t0" "$(date +%s)" "$MODE"
log "=== BUILD DONE $STAMP ==="
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
# 20-install.sh <stamp> [--verify-only]
#
# Installs <out>/apk/trace-<stamp>.apk over the side-by-side package (adb install -r keeps the
# package's data and never uninstalls anything), waits for dex2oat, and PROVES the identity: the
# on-device base.apk sha256 must equal the signed file's. That on-device hash - not run.json, not
# the newest Gradle output (W6-verify README's wrong-SHA note) - is what names the binary behind
# every picture of the window. --verify-only skips the install (the dry run proves p7w6 this way).
# The TCP supervisor dies with the package on install; 90-restore.sh restarts it if it was up.
set -euo pipefail
. "$(dirname "$0")/lib.sh"
[ $# -ge 1 ] || die "usage: $0 <stamp> [--verify-only]"
STAMP=$1; VERIFY_ONLY=0; [ "${2:-}" = --verify-only ] && VERIFY_ONLY=1
w2_load_build "$STAMP"
OUT=$(w2_out "$STAMP")/session
mkdir -p "$OUT"
w2_require_device
w2_lock
t0=$(date +%s)
WANT=$(sha256sum "$W2_APK" | cut -d' ' -f1)
echo "$WANT $W2_APK" > "$OUT/apk.sha256"
if [ $VERIFY_ONLY -eq 0 ]; then
Ash "pm list packages | grep -i mobilegl" > "$OUT/packages-before.txt" || true
log "installing $W2_APK ($WANT)"
A install -r "$W2_APK" 2>&1 | tr -d '\r' | tee "$OUT/install.txt"
grep -q Success "$OUT/install.txt" || die "install failed"
fi
Ash "dumpsys package $W2_PKG" | grep -E 'versionName|versionCode|lastUpdateTime|codePath|primaryCpuAbi' > "$OUT/apk-install.txt"
cat "$OUT/apk-install.txt"
BASE=$(Ash "pm path $W2_PKG" | sed -n 's/^package://p' | grep 'base.apk' | head -1)
GOT=$(Ash "sha256sum $BASE" | cut -d' ' -f1)
echo "device base.apk: $BASE $GOT" | tee "$OUT/apk-on-device.sha256"
[ "$GOT" = "$WANT" ] || die "installed APK ($GOT) is not $W2_APK ($WANT)"
if [ -n "${BUILD_SHA:-}" ]; then
grep -q "versionName=.*${BUILD_SHA:0:7}" "$OUT/apk-install.txt" || die "versionName does not carry ${BUILD_SHA:0:7}"
fi
# An am_kill "due to installPackageLI" inside an arm measures the installer (runbook 1 section 3).
Ash 'n=0; while pgrep dex2oat >/dev/null && [ $n -lt 150 ]; do sleep 2; n=$((n+1)); done; echo "dex2oat idle after $((n*2))s"' | tee "$OUT/dex2oat.txt"
w2_timing "$(w2_out "$STAMP")" install "$t0" "$(date +%s)" "verify_only=$VERIFY_ONLY"
log "=== INSTALL OK $STAMP (on-device sha256 $GOT) ==="
+112
View File
@@ -0,0 +1,112 @@
#!/usr/bin/env bash
# 21-preflight.sh <stamp> [--reboot] [--no-pin]
#
# Session start (runbook 1 section 2, CONTRACT-P7 7.2 "same reboot-clean session"):
# --reboot records boot_id, reboots, waits for boot_completed, records boot_id again; the two
# must differ or the window is NOT reboot-clean. Gate 3 requires it; the dry run
# does not reboot. Refused while gate3/state holds finished pairs (they belong to
# the old session). session/boot-id.txt is THE session every gate-3 record must match;
# without --reboot on a stamp that already has session/boot-id.txt: a resume - the phone must
# still be in that boot session (else stop), and boot-id.txt / reboot-clean.txt are
# kept, not rewritten (session/resumed.txt logs the re-entry);
# records the state 90-restore.sh puts back: TCP supervisor up or not, stay-on setting, pin
# state, Doze whitelist line, focused activity;
# wakes the phone and sets `svc power stayon true` (息屏 cut child TCP in window 1b, ID-P7-48);
# pins (pin_device.sh pin) unless --no-pin, then classifies `check` (PINNED-1100 = the board's
# documented 1100 MHz pwrlevel-0 reading, accepted);
# checks the CTS bundle is on the device and there is room to work.
set -uo pipefail
. "$(dirname "$0")/lib.sh"
[ $# -ge 1 ] || die "usage: $0 <stamp> [--reboot] [--no-pin]"
STAMP=$1; shift
REBOOT=0; PIN=1
for a in "$@"; do case "$a" in --reboot) REBOOT=1;; --no-pin) PIN=0;; *) die "unknown option $a";; esac; done
w2_load_build "$STAMP"
OUT=$(w2_out "$STAMP")/session
mkdir -p "$OUT"
w2_require_device
w2_lock
t0=$(date +%s)
# ---- what we found (only the FIRST preflight of a stamp writes these: restore reads them) ---
if [ ! -f "$OUT/found.env" ]; then
sup=0; w2_supervisor_running && sup=1
stayon=$(Ash "settings get global stay_on_while_plugged_in")
pinstate=$(w2_pin_check "$W2_TOOLS" "$OUT/pin-found.txt")
cat > "$OUT/found.env" <<EOF
FOUND_SUPERVISOR=$sup
FOUND_STAYON=$stayon
FOUND_PIN=$pinstate
FOUND_AT=$(date -Is)
EOF
Ash "dumpsys deviceidle whitelist" | grep -i mobilegl > "$OUT/deviceidle-found.txt" || true
Ash "dumpsys window" | grep -E 'mCurrentFocus' > "$OUT/focus-found.txt" || true
Ash "ps -A -o PID,PPID,USER,NAME,ARGS" | grep -iE 'mobilegl|mglsrv' > "$OUT/processes-found.txt" || true
log "found: supervisor=$sup stayon=$stayon pin=$pinstate"
fi
SESSION_BOOT=$(w2_session_boot_id "$STAMP")
if [ $REBOOT -eq 1 ] && compgen -G "$(w2_out "$STAMP")/gate3/state/*/*.done" > /dev/null; then
die "gate 3 has finished pairs from boot session ${SESSION_BOOT:-?}; --reboot starts a NEW session and would void them (60-reduce.py: INVALID-SESSION). Delete them first (RUNBOOK section 1 'phone rebooted') or use a new stamp"
fi
if [ $REBOOT -eq 1 ]; then
Ash "cat /proc/sys/kernel/random/boot_id" > "$OUT/boot-id-before.txt"
log "rebooting for a reboot-clean session"
A reboot
sleep 20
A wait-for-device
for _ in $(seq 1 120); do [ "$(Ash 'getprop sys.boot_completed')" = 1 ] && break; sleep 2; done
sleep 20
# File-based encryption: the app's data dir (where trace-replay-ci.sh copies each fixture with
# run-as) is readable only after the first unlock. A phone with a lock-screen credential needs
# one manual unlock here; wait up to 10 minutes for it rather than failing every case.
w2_wake
for i in $(seq 1 120); do
[ "$(Ash 'getprop sys.user.0.ce_available')" = true ] && break
[ $i = 1 ] && log "waiting for credential-encrypted storage: UNLOCK THE PHONE BY HAND if it shows a lock screen"
sleep 5
done
[ "$(Ash 'getprop sys.user.0.ce_available')" = true ] || die "user 0 storage still locked after 10 min"
fi
if [ $REBOOT -eq 0 ] && [ -n "$SESSION_BOOT" ]; then
# Re-entering this stamp's session (window.sh after 90-restore.sh ran with steps still open, or
# by hand): the phone must still be in it, and boot-id.txt / reboot-clean.txt stay as the
# session's first preflight wrote them. Stay-on and the pin are set again below.
w2_same_session "$SESSION_BOOT" "preflight (resume of $STAMP)"
echo "resumed $(date -Is): boot_id $SESSION_BOOT unchanged ($(cat "$OUT/reboot-clean.txt" 2>/dev/null))" | tee -a "$OUT/resumed.txt"
else
Ash "cat /proc/sys/kernel/random/boot_id" > "$OUT/boot-id.txt"
if [ $REBOOT -eq 1 ]; then
if cmp -s "$OUT/boot-id-before.txt" "$OUT/boot-id.txt"; then die "boot_id unchanged: the reboot did not happen"; fi
echo "reboot-clean: $(cat "$OUT/boot-id-before.txt") -> $(cat "$OUT/boot-id.txt")" | tee "$OUT/reboot-clean.txt"
else
echo "NOT reboot-clean (no --reboot): boot_id $(cat "$OUT/boot-id.txt"), up $(Ash 'cat /proc/uptime' | cut -d' ' -f1)s" | tee "$OUT/reboot-clean.txt"
fi
fi
w2_wake
Ash "svc power stayon true"
Ash "dumpsys power" | grep -E 'mWakefulness=|mStayOn=' > "$OUT/power.txt"
Ash "dumpsys deviceidle get deep" > "$OUT/deviceidle-deep.txt" 2>&1 || true
{
echo "model : $(Ash 'getprop ro.product.model') / $(Ash 'getprop ro.board.platform')"
echo "build : $(Ash 'getprop ro.build.fingerprint')"
echo "battery : $(Ash 'dumpsys battery' | grep -E 'level|temperature|AC powered|USB powered' | tr -s ' ' | tr '\n' ' ')"
echo "memory : $(Ash 'grep -E "MemTotal|MemAvailable" /proc/meminfo' | tr -s ' ' | tr '\n' ' ')"
echo "tmp free : $(Ash 'df -h /data/local/tmp' | tail -1)"
echo "mgcts : $(Ash "ls $W2_CTS_DEV 2>&1" | tr '\n' ' ')"
echo "apk : $(grep versionName "$(w2_out "$STAMP")/session/apk-install.txt" 2>/dev/null | tr -d ' ')"
} | tee "$OUT/device.txt"
if [ $PIN -eq 1 ]; then
bash "$W2_TOOLS/tools/device_bench/pin_device.sh" "$W2_SERIAL" pin > "$OUT/pin-session-start.txt" 2>&1
echo 1 > "$OUT/pinned-by-window"
fi
pin=$(w2_pin_check "$W2_TOOLS" "$OUT/pin-check-00.txt")
log "pin: $pin"
if [ $PIN -eq 1 ] && [ "$pin" != PINNED ] && [ "$pin" != PINNED-1100 ]; then
die "pin did not take ($pin, see $OUT/pin-check-00.txt)"
fi
w2_timing "$(w2_out "$STAMP")" preflight "$t0" "$(date +%s)" "reboot=$REBOOT pin=$PIN"
log "=== PREFLIGHT OK $STAMP ==="
@@ -0,0 +1,175 @@
#!/usr/bin/env bash
# 30-gate3-selftest.sh [--script PATH] (host only: no phone, no adb server, no device lock)
#
# Runs 30-gate3.sh (or PATH: red-once of an older driver) against a stub adb and a stub runner in a
# temp dir and checks its repeat bookkeeping (ID-P7-62 final ruling: the monolith arm runs x5 on
# every case whatever --repeat, the split arms x --repeat; recorded as arms.txt monolith_repeat=)
# and its resume semantics:
# fresh --cases a,b: arms.txt says repeat=3 monolith_repeat=5; the runner is asked for the
# monolith x5, inproc / spawn x3, ra0 x1; every monolith pair archives 5 repeats and
# writes its .done; exit 0
# decoupled a fresh --repeat 1 run: the split arms x1, the monolith still x5 (monolith_repeat=5)
# resume one monolith .done deleted: only that pair re-runs, again x5
# incomplete a monolith repeat-05 (beyond the split arms' 3) without its PNG: no .done,
# progress.tsv INCOMPLETE, exit 3; the same command again completes it
# frozen an arms.txt with monolith_repeat=5, resumed with --repeat 1: monolith x5, split x3
# interim an arms.txt with monolith_repeat=3 (a run the interim x3 script started): a resume
# keeps monolith x3, and the log says why
# old-format an arms.txt without monolith_repeat= (a run the pre-ID-P7-62 script started): a
# resume keeps that run's monolith x1
# Exit 0 when every check holds.
set -uo pipefail
HERE=$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
SCRIPT="$HERE/30-gate3.sh"
[ "${1:-}" = --script ] && SCRIPT=$2
TMP=$(mktemp -d "${TMPDIR:-/tmp}/w2-gate3-selftest-XXXXXX")
trap 'rm -rf "$TMP"' EXIT
BOOT=11111111-2222-3333-4444-555555555555
# The driver under test beside this tree's lib.sh (it sources "$(dirname "$0")/lib.sh").
mkdir -p "$TMP/under-test" "$TMP/bin" "$TMP/tree/tools/trace_replay" "$TMP/tree/tools/device_bench" "$TMP/logs"
cp "$SCRIPT" "$TMP/under-test/30-gate3.sh"
cp "$HERE/lib.sh" "$TMP/under-test/lib.sh"
cat > "$TMP/bin/adb" <<'EOF'
#!/usr/bin/env bash
[ "${1:-}" = -s ] && shift 2
case "$*" in
get-state) echo device;;
"shell cat /proc/sys/kernel/random/boot_id") echo "$FAKE_BOOT";;
esac
exit 0
EOF
chmod +x "$TMP/bin/adb"
printf '#!/usr/bin/env bash\necho " VERDICT: PINNED"\n' > "$TMP/tree/tools/device_bench/pin_device.sh"
cat > "$TMP/tree/tools/trace_replay/run_android_retrace_local.py" <<'EOF'
# Stub runner (lib.sh looks for: def bash_executable / def clear_repeat_outputs).
import argparse, json, os, pathlib
ap = argparse.ArgumentParser()
for flag in ("--case", "--backend", "--transport", "--archive-dir"):
ap.add_argument(flag)
ap.add_argument("--repeat", type=int, default=1)
ap.add_argument("--env", action="append", default=[])
ap.add_argument("--use-pbuffer", action="store_true")
a = ap.parse_args()
with open(os.environ["FAKE_RUNLOG"], "a") as log:
log.write("transport=%s repeat=%d case=%s env=%s\n" % (a.transport, a.repeat, a.case, ",".join(a.env)))
drop = os.environ.get("FAKE_DROP", "") # <transport>:<case>:<repeat> archived without its PNG
arm = pathlib.Path(a.archive_dir) / (a.case + "-DirectVulkan")
for i in range(1, a.repeat + 1):
rep = arm / ("repeat-%02d" % i)
rep.mkdir(parents=True, exist_ok=True)
(rep / "result.json").write_text(json.dumps({"passed": True, "ssim": 0.998}))
if drop != "%s:%s:%d" % (a.transport, a.case, i):
(rep / (a.case + "-DirectVulkan-actual.png")).write_bytes(b"png")
print('"passed": true')
(pathlib.Path(a.archive_dir) / "run.json").write_text("{}")
EOF
: > "$TMP/fake.apk"
export PATH="$TMP/bin:$PATH" FAKE_BOOT=$BOOT FAKE_RUNLOG="$TMP/runner.log" W2_LOGROOT="$TMP/logs" W2_SHARED_LOCK= \
W2_LOCK="$TMP/w2.lock" W2_TOOLS_OVERRIDE="$TMP/tree" W2_APK_OVERRIDE="$TMP/fake.apk" W2_SERIAL=stub0000
: > "$FAKE_RUNLOG"
# Never the real adb (it would reach the Windows adb server, or start one in WSL).
[ "$(command -v adb)" = "$TMP/bin/adb" ] || { echo "the stub adb is not first on PATH: $(command -v adb)" >&2; exit 2; }
TOTAL=0; FAILED=()
expect() { # <name> <condition-rc> [detail]
TOTAL=$((TOTAL + 1))
if [ "$2" -eq 0 ]; then echo " ok $1"; else echo " FAIL $1 <-- ${3:-}"; FAILED+=("$1"); fi
}
gate() { # <stamp> [args...] -> the driver's exit status; its log in $TMP/<stamp>.<n>.log
local stamp=$1; shift
mkdir -p "$W2_LOGROOT/$stamp/session"
echo "$BOOT" > "$W2_LOGROOT/$stamp/session/boot-id.txt"
RUNS=$((RUNS + 1))
bash "$TMP/under-test/30-gate3.sh" "$stamp" "$@" > "$TMP/$stamp.$RUNS.log" 2>&1
}
calls() { grep -c -- "$1" "$FAKE_RUNLOG" || true; }
reps() { find "$W2_LOGROOT/$1/gate3/archive/$2/$3-DirectVulkan" -maxdepth 1 -name 'repeat-*' 2>/dev/null | wc -l; }
RUNS=0
echo "30-gate3 self-test: driver $SCRIPT, stubs in $TMP"
echo "[fresh] a new run records monolith_repeat=5 and runs the monolith x5, the split arms x3"
gate fresh --cases case-a,case-b; rc=$?
G="$W2_LOGROOT/fresh/gate3"
expect "exit 0" $rc "rc=$rc; $(tail -3 "$TMP/fresh.$RUNS.log")"
grep -qx 'monolith_repeat=5' "$G/arms.txt" && grep -qx 'repeat=3' "$G/arms.txt"
expect "arms.txt: repeat=3 and monolith_repeat=5" $? "$(cat "$G/arms.txt")"
[ "$(calls 'transport=monolith repeat=5 ')" = 2 ] && [ "$(calls 'transport=monolith ')" = 2 ]
expect "the runner is asked for the monolith x5 on both cases (and for nothing else on the monolith)" $? \
"$(grep monolith "$FAKE_RUNLOG")"
[ "$(reps fresh monolith case-a)" = 5 ] && [ "$(reps fresh monolith case-b)" = 5 ]
expect "each monolith pair archives 5 repeats" $? "$(reps fresh monolith case-a)/$(reps fresh monolith case-b)"
[ "$(ls "$G"/state/*/*.done | wc -l)" = 8 ] && [ -f "$G/state/monolith/case-a.done" ]
expect "every (arm, case) pair has its .done (8)" $? "$(ls "$G"/state/*/)"
[ "$(calls 'transport=inproc repeat=3 ')" = 2 ] && [ "$(calls 'transport=spawn repeat=3 ')" = 2 ] \
&& [ "$(calls 'transport=inproc repeat=1 case=case-.* env=MOBILEGL_IPC_RUN_AHEAD=0')" = 2 ] \
&& [ "$(reps fresh inproc case-a)" = 3 ] && [ "$(reps fresh spawn case-b)" = 3 ]
expect "the split arms keep x3 and ra0 x1" $? "$(cat "$FAKE_RUNLOG")"
echo "[decoupled] the monolith count does not follow --repeat"
: > "$FAKE_RUNLOG"
gate decoupled --cases case-a --repeat 1; rc=$?
G="$W2_LOGROOT/decoupled/gate3"
[ $rc -eq 0 ] && grep -qx 'repeat=1' "$G/arms.txt" && grep -qx 'monolith_repeat=5' "$G/arms.txt" \
&& [ "$(calls 'transport=monolith repeat=5 ')" = 1 ] && [ "$(calls 'transport=inproc repeat=1 case=case-a env=$')" = 1 ] \
&& [ "$(calls 'transport=spawn repeat=1 ')" = 1 ] && [ "$(reps decoupled monolith case-a)" = 5 ]
expect "a fresh --repeat 1 run: inproc / spawn x1, the monolith still x5 (arms.txt monolith_repeat=5)" $? \
"rc=$rc; $(cat "$G/arms.txt" 2>/dev/null); $(cat "$FAKE_RUNLOG")"
echo "[resume] a deleted monolith .done re-runs that one pair, x5"
G="$W2_LOGROOT/fresh/gate3"
: > "$FAKE_RUNLOG"; rm "$G/state/monolith/case-a.done"
gate fresh; rc=$?
[ $rc -eq 0 ] && [ "$(wc -l < "$FAKE_RUNLOG")" = 1 ] && [ "$(calls 'transport=monolith repeat=5 case=case-a ')" = 1 ] \
&& [ -f "$G/state/monolith/case-a.done" ] && [ "$(reps fresh monolith case-a)" = 5 ]
expect "only monolith case-a re-ran, x5, and wrote its .done" $? "rc=$rc; $(cat "$FAKE_RUNLOG")"
echo "[incomplete] a monolith repeat without its PNG leaves the pair open - also beyond the split arms' 3"
: > "$FAKE_RUNLOG"
FAKE_DROP=monolith:case-b:5 gate incomplete --cases case-a,case-b; rc=$?
G="$W2_LOGROOT/incomplete/gate3"
[ $rc -eq 3 ] && [ ! -f "$G/state/monolith/case-b.done" ] && [ -f "$G/state/monolith/case-a.done" ] \
&& grep -q "^monolith case-b .* INCOMPLETE$" "$G/progress.tsv" && grep -q 'monolith case-b .*repeat-05 lack' "$TMP/incomplete.$RUNS.log"
expect "monolith case-b repeat-05 without a PNG -> no .done, progress INCOMPLETE naming repeat-05, exit 3" $? \
"rc=$rc; $(cat "$G/progress.tsv" 2>/dev/null)"
: > "$FAKE_RUNLOG"
gate incomplete; rc=$?
[ $rc -eq 0 ] && [ -f "$G/state/monolith/case-b.done" ] && [ "$(wc -l < "$FAKE_RUNLOG")" = 1 ] \
&& [ "$(calls 'transport=monolith repeat=5 case=case-b ')" = 1 ] && [ "$(reps incomplete monolith case-b)" = 5 ]
expect "...the same command again re-runs that pair only (x5) and completes, exit 0" $? "rc=$rc; $(cat "$FAKE_RUNLOG")"
echo "[frozen] a resume keeps the first run's counts, whatever --repeat it is given"
G="$W2_LOGROOT/frozen/gate3"; mkdir -p "$G"
printf 'case-a\n' > "$G/cases.txt"
printf 'arms=monolith inproc spawn inproc-ra0\nrepeat=3\nmonolith_repeat=5\n' > "$G/arms.txt"
: > "$FAKE_RUNLOG"
gate frozen --repeat 1; rc=$?
[ $rc -eq 0 ] && [ "$(calls 'transport=monolith repeat=5 ')" = 1 ] && [ "$(calls 'transport=inproc repeat=3 ')" = 1 ] \
&& [ "$(calls 'transport=spawn repeat=3 ')" = 1 ]
expect "arms.txt repeat=3 monolith_repeat=5 resumed with --repeat 1 -> monolith x5, inproc / spawn x3" $? \
"rc=$rc; $(cat "$FAKE_RUNLOG")"
echo "[interim] an arms.txt the interim x3 script froze (monolith_repeat=3) keeps its monolith x3"
G="$W2_LOGROOT/interim/gate3"; mkdir -p "$G"
printf 'case-a\n' > "$G/cases.txt"
printf 'arms=monolith inproc spawn inproc-ra0\nrepeat=3\nmonolith_repeat=3\napk=x\ntools=y\n' > "$G/arms.txt"
: > "$FAKE_RUNLOG"
gate interim; rc=$?
[ $rc -eq 0 ] && [ "$(calls 'transport=monolith repeat=3 ')" = 1 ] && [ "$(calls 'transport=monolith ')" = 1 ] \
&& [ "$(reps interim monolith case-a)" = 3 ] && [ -f "$G/state/monolith/case-a.done" ] \
&& grep -qx 'monolith_repeat=3' "$G/arms.txt" && grep -q 'monolith repeat frozen at 3' "$TMP/interim.$RUNS.log"
expect "monolith x3 with its .done, arms.txt untouched, and the log says why" $? "rc=$rc; $(cat "$FAKE_RUNLOG")"
echo "[old-format] an arms.txt the pre-ID-P7-62 script froze (no monolith_repeat=) keeps its monolith x1"
G="$W2_LOGROOT/old/gate3"; mkdir -p "$G"
printf 'case-a\n' > "$G/cases.txt"
printf 'arms=monolith inproc spawn inproc-ra0\nrepeat=3\napk=x\ntools=y\n' > "$G/arms.txt"
: > "$FAKE_RUNLOG"
gate old; rc=$?
[ $rc -eq 0 ] && [ "$(calls 'transport=monolith repeat=1 ')" = 1 ] && [ "$(reps old monolith case-a)" = 1 ] \
&& [ -f "$G/state/monolith/case-a.done" ] && [ "$(calls 'transport=inproc repeat=3 ')" = 1 ] \
&& grep -q 'monolith repeat frozen at 1' "$TMP/old.$RUNS.log"
expect "monolith x1 with its .done, the split arms x3, and the log says why" $? "rc=$rc; $(cat "$FAKE_RUNLOG")"
echo "30-gate3 self-test: $((TOTAL - ${#FAILED[@]}))/$TOTAL checks passed${FAILED:+; FAILED: ${FAILED[*]}}"
[ ${#FAILED[@]} -eq 0 ]
+202
View File
@@ -0,0 +1,202 @@
#!/usr/bin/env bash
# 30-gate3.sh <stamp> [--cases a,b,...] [--repeat N] [--arms monolith,inproc,spawn,inproc-ra0]
#
# CONTRACT-P7 7.1/7.2 exit gate 3, one reboot-clean session, DirectVulkan x --use-pbuffer:
# monolith x5 the same-session control every split reading is scored against; x5
# (MONOLITH_REPEAT, the ID-P7-62 final ruling; whatever --repeat) so the session
# itself shows whether the monolith is bit-reproducible - a case whose monolith is
# not (the Iris sundial-lite / bliss / derivative packs on Adreno 830) is judged by
# 60-reduce.py's distributional check instead of bit-identity, whose nearest-
# monolith clause needs >= 3 passes and is steadier with more
# inproc xN (N = --repeat, default 3) must be bit-identical across passes
# spawn xN same, server role in a second process
# inproc-ra0 x1 MOBILEGL_IPC_RUN_AHEAD=0 lockstep control, recorded only
# over the 36-case denominator = --matrix's DirectVulkan cases minus W2_EXCLUDED (the three that
# are red on monolith: create-indirect, 1.21.11 main menu, photon v1.3b). iterationrp carries the
# apk.yml:460-462 Magma knobs on every arm. Every repeat's result.json, actual PNG, both role logs,
# transport proof and logcat are archived under <out>/gate3/archive/<arm>/<case>-DirectVulkan/.
#
# ONE SESSION (CONTRACT-P7 7.2 "same reboot-clean session"): the phone's boot_id must equal
# <out>/session/boot-id.txt (21-preflight.sh) before and after every pair; the driver stops the
# moment it does not. Every pair's .done and every archived repeat (repeat-NN/boot_id.txt) records
# boot_id / boot_id_before, and 60-reduce.py calls the gate INVALID-SESSION unless all of them,
# over all arms, are that one boot_id.
#
# RESUMABLE: one runner invocation per (arm, case); a pair writes
# <out>/gate3/state/<arm>/<case>.done ONLY when every repeat it asked for left result.json AND an
# actual PNG in the archive - otherwise it is logged INCOMPLETE, left without a .done, and the
# next start re-runs it from scratch (its partial archive is removed first). Exit 0 = every pair
# done; 3 = the loop finished but some pairs are INCOMPLETE (window.sh carries on and leaves the
# step for the next run); anything else = stopped. Run it detached:
# bash detach.sh ~/w7/logs/p7w7/<stamp>/gate3.log 30-gate3.sh <stamp>
set -uo pipefail
. "$(dirname "$0")/lib.sh"
[ $# -ge 1 ] || die "usage: $0 <stamp> [--cases a,b] [--repeat N] [--arms list]"
STAMP=$1; shift
# ID-P7-62 final ruling: the monolith arm runs x5 on every case (the split arms stay x --repeat).
MONOLITH_REPEAT=5
CASES_ARG=""; REPEAT=3; ARMS="monolith inproc spawn inproc-ra0"
while [ $# -gt 0 ]; do
case "$1" in
--cases) CASES_ARG=$2; shift 2;;
--repeat) REPEAT=$2; shift 2;;
--arms) ARMS=${2//,/ }; shift 2;;
*) die "unknown option $1";;
esac
done
w2_load_build "$STAMP"
OUT=$(w2_out "$STAMP")/gate3
mkdir -p "$OUT"
w2_require_device
w2_lock
SESSION_BOOT=$(w2_session_boot_id "$STAMP")
[ -n "$SESSION_BOOT" ] || die "no $(w2_out "$STAMP")/session/boot-id.txt: run 21-preflight.sh first"
w2_same_session "$SESSION_BOOT" "gate 3 start"
export MOBILEGL_TRACE_PACKAGE=$W2_PKG MOBILEGL_TRACE_SKIP_INSTALL=1 MOBILEGL_TRACE_APK=$W2_APK
RUNNER="$W2_TOOLS/tools/trace_replay/run_android_retrace_local.py"
# ---- the case list (and below, the repeat count) is frozen on first start: a resume cannot change
# the denominator ------------------------------------------------------------------------------------
if [ ! -s "$OUT/cases.txt" ]; then
if [ -n "$CASES_ARG" ]; then
tr ',' '\n' <<<"$CASES_ARG" | sed '/^$/d' > "$OUT/cases.txt"
else
W2_EXCLUDED="$W2_EXCLUDED" python3 - "$W2_TOOLS/tools/trace_replay" > "$OUT/cases.txt" <<'PY'
import os, sys
sys.path.insert(0, sys.argv[1])
from trace_cases import ci_backends, ci_trace_cases, load_trace_cases, split_trace_cases
excluded = set(os.environ["W2_EXCLUDED"].split())
for case in split_trace_cases(ci_trace_cases(load_trace_cases())):
if "DirectVulkan" in ci_backends(case) and case["name"] not in excluded:
print(case["name"])
PY
fi
printf '%s\n' $W2_EXCLUDED > "$OUT/excluded.txt"
fi
mapfile -t CASES < "$OUT/cases.txt"
[ ${#CASES[@]} -gt 0 ] || die "empty case list"
[ -f "$OUT/arms.txt" ] || printf 'arms=%s\nrepeat=%s\nmonolith_repeat=%s\napk=%s\ntools=%s\n' \
"$ARMS" "$REPEAT" "$MONOLITH_REPEAT" "$W2_APK" "$W2_TOOLS" > "$OUT/arms.txt"
# The repeat counts are frozen with the case list: a resume started without the first run's --repeat
# (RUNBOOK: "30-gate3.sh <stamp>") must not re-run a pair with another count than its siblings'.
FROZEN_REPEAT=$(sed -n 's/^repeat=//p' "$OUT/arms.txt")
if [ -n "$FROZEN_REPEAT" ] && [ "$FROZEN_REPEAT" != "$REPEAT" ]; then
log "repeat frozen at $FROZEN_REPEAT by $OUT/arms.txt (asked: $REPEAT)"
REPEAT=$FROZEN_REPEAT
fi
# The monolith count is frozen the same way (arms.txt monolith_repeat=, MONOLITH_REPEAT on a fresh
# start). A run the interim ID-P7-62 script started says 3 and a resume keeps 3; an arms.txt without
# the key was frozen by the earlier script, whose monolith pairs ran x1: a resume of that run keeps
# x1. Either way every monolith pair of one run has one count (60-reduce.py reads the same key).
MONO_REPEAT=$(sed -n 's/^monolith_repeat=//p' "$OUT/arms.txt")
if [ -n "$MONO_REPEAT" ] && [ "$MONO_REPEAT" != "$MONOLITH_REPEAT" ]; then
log "monolith repeat frozen at $MONO_REPEAT by $OUT/arms.txt (this script starts a run at $MONOLITH_REPEAT)"
elif [ -z "$MONO_REPEAT" ]; then
MONO_REPEAT=1
log "monolith repeat frozen at 1 by $OUT/arms.txt (no monolith_repeat=: started by the pre-ID-P7-62 script)"
fi
log "gate3 stamp=$STAMP cases=${#CASES[@]} arms=[$ARMS] repeat=$REPEAT monolith_repeat=$MONO_REPEAT apk=$W2_APK tools=$W2_TOOLS"
arm_args() { # <arm> -> runner arguments
case "$1" in
monolith) echo "--transport monolith --repeat $MONO_REPEAT";;
inproc) echo "--transport inproc --repeat $REPEAT";;
spawn) echo "--transport spawn --repeat $REPEAT";;
inproc-ra0) echo "--transport inproc --repeat 1 --env MOBILEGL_IPC_RUN_AHEAD=0";;
*) die "unknown arm $1";;
esac
}
arm_repeats() { case "$1" in inproc|spawn) echo "$REPEAT";; monolith) echo "$MONO_REPEAT";; *) echo 1;; esac; }
# <case-archive> <n> -> the repeats (of 1..n) that lack result.json or an actual PNG; empty = complete
missing_repeats() {
local i d miss=()
for i in $(seq 1 "$2"); do
d=$(printf '%s/repeat-%02d' "$1" "$i")
if [ ! -s "$d/result.json" ] || ! compgen -G "$d/*-actual.png" > /dev/null; then miss+=("repeat-$(printf %02d "$i")"); fi
done
echo "${miss[*]}"
}
t_all=$(date +%s)
INCOMPLETE=0
for arm in $ARMS; do
mkdir -p "$OUT/state/$arm" "$OUT/logs/$arm" "$OUT/archive/$arm"
pending=0
for c in "${CASES[@]}"; do [ -f "$OUT/state/$arm/$c.done" ] || pending=$((pending + 1)); done
if [ $pending -eq 0 ]; then log "arm $arm: all ${#CASES[@]} done, skipping"; continue; fi
log "=== arm $arm start ($pending pending) ==="
pin=$(w2_pin_check "$W2_TOOLS" "$OUT/pin-before-$arm.txt"); log "pin before $arm: $pin"
t_arm=$(date +%s)
for c in "${CASES[@]}"; do
[ -f "$OUT/state/$arm/$c.done" ] && continue
rm -rf "$OUT/archive/$arm/$c-DirectVulkan"
if [ "$c" = "$W2_ITERATIONRP" ]; then
# apk.yml:460-462, verbatim; trace-replay-ci.sh reads them from the environment.
export MOBILEGL_MAGMA_FIX_ITERATIONRP_SUBGROUP_SCRATCH=1 MOBILEGL_MAGMA_DERIVE_NUM_SUBGROUPS=1 \
MOBILEGL_MAGMA_ITERATIONRP_FIX_BARRIER=1
else
unset MOBILEGL_MAGMA_FIX_ITERATIONRP_SUBGROUP_SCRATCH MOBILEGL_MAGMA_DERIVE_NUM_SUBGROUPS \
MOBILEGL_MAGMA_ITERATIONRP_FIX_BARRIER
fi
attempt=1
while :; do
w2_require_device
boot0=$(w2_boot_id)
w2_same_session "$SESSION_BOOT" "before $arm $c" "$boot0"
w2_wake
t0=$(date +%s)
# shellcheck disable=SC2046
python3 "$RUNNER" --case "$c" --backend DirectVulkan --use-pbuffer $(arm_args "$arm") \
--archive-dir "$OUT/archive/$arm" > "$OUT/logs/$arm/$c.attempt$attempt.log" 2>&1
rc=$?
t1=$(date +%s)
# trace-replay-ci.sh's "infrastructure" verdict (adb/system_server gone, not the case):
# the CI lane retries once, so does this driver - and says so in the done marker.
if [ $attempt -eq 1 ] && grep -q 'requesting one infrastructure retry' "$OUT/logs/$arm/$c.attempt1.log"; then
log " $arm $c: infrastructure failure, one retry"
attempt=2; rm -rf "$OUT/archive/$arm/$c-DirectVulkan"; sleep 20; continue
fi
break
done
cp "$OUT/logs/$arm/$c.attempt$attempt.log" "$OUT/logs/$arm/$c.log"
# The runner rewrites <archive>/run.json per invocation; keep each case's copy beside it.
[ -f "$OUT/archive/$arm/run.json" ] && mkdir -p "$OUT/archive/$arm/$c-DirectVulkan" \
&& mv "$OUT/archive/$arm/run.json" "$OUT/archive/$arm/$c-DirectVulkan/run.json" 2>/dev/null
# Session stamp on every repeat the runner archived (complete or not), read AFTER the run: a
# reboot inside the invocation shows as boot_id != boot_id_before.
boot1=$(w2_boot_id)
for d in "$OUT/archive/$arm/$c-DirectVulkan"/repeat-*/; do
[ -d "$d" ] && printf 'boot_id=%s boot_id_before=%s stamped=%s\n' "$boot1" "$boot0" "$(date -Is)" > "$d/boot_id.txt"
done
passes=$(grep -c '"passed": true' "$OUT/logs/$arm/$c.log" || true)
miss=$(missing_repeats "$OUT/archive/$arm/$c-DirectVulkan" "$(arm_repeats "$arm")")
if [ -n "$boot1" ] && [ "$boot1" != "$SESSION_BOOT" ]; then
printf '%s\t%s\t%s\t%s\t%s\tSESSION-BROKEN\n' "$arm" "$c" "$rc" "$((t1 - t0))" "$(date -Is)" >> "$OUT/progress.tsv"
w2_same_session "$SESSION_BOOT" "after $arm $c" "$boot1"
fi
if [ -n "$miss" ] || [ -z "$boot1" ]; then
# No .done: the next start of this script re-runs the pair from scratch.
printf '%s\t%s\t%s\t%s\t%s\tINCOMPLETE\n' "$arm" "$c" "$rc" "$((t1 - t0))" "$(date -Is)" >> "$OUT/progress.tsv"
why=${miss:+$miss lack result.json / actual PNG}
[ -z "$boot1" ] && why="${why:+$why; }boot_id unreadable after the run"
log " $arm $c rc=$rc $((t1 - t0))s INCOMPLETE ($why): no .done, the next run retries the pair"
INCOMPLETE=$((INCOMPLETE + 1))
continue
fi
printf 'rc=%s seconds=%s attempts=%s passed_lines=%s boot_id=%s boot_id_before=%s finished=%s\n' \
"$rc" "$((t1 - t0))" "$attempt" "$passes" "$boot1" "$boot0" "$(date -Is)" > "$OUT/state/$arm/$c.done"
printf '%s\t%s\t%s\t%s\t%s\tdone\n' "$arm" "$c" "$rc" "$((t1 - t0))" "$(date -Is)" >> "$OUT/progress.tsv"
log " $arm $c rc=$rc $((t1 - t0))s"
done
pin=$(w2_pin_check "$W2_TOOLS" "$OUT/pin-after-$arm.txt"); log "pin after $arm: $pin"
w2_timing "$(w2_out "$STAMP")" "gate3-$arm" "$t_arm" "$(date +%s)" "${#CASES[@]} cases"
log "=== arm $arm done in $(( $(date +%s) - t_arm ))s ==="
done
w2_timing "$(w2_out "$STAMP")" gate3 "$t_all" "$(date +%s)" "incomplete=$INCOMPLETE"
if [ $INCOMPLETE -gt 0 ]; then
log "=== GATE3 INCOMPLETE $STAMP: $INCOMPLETE pair(s) without .done (progress.tsv 'INCOMPLETE'); run the same command again to retry them ==="
exit 3
fi
log "=== GATE3 DONE $STAMP ==="
+125
View File
@@ -0,0 +1,125 @@
#!/usr/bin/env bash
# 40-bsl-stats.sh <stamp> [--arms inproc,spawn] [--interval 0.25]
#
# The M2 device reading the W6 window did not take (W6-verify/README.md: "峰值与 wbuf[] 仍待开
# stats 的专门一遍采集"): minecraft-1.21.4-fabric-iris-bsl-esc-menu-854, DirectVulkan x pbuffer,
# one replay per arm with MOBILEGL_PIPE_STATS=1 (PERIOD=1), while an on-device root sampler
# records every 0.25 s, for the replay's process(es):
# /proc/<pid>/maps line count (the vm.max_map_count question CONTRACT-P7 12 left open)
# VmRSS / VmHWM
# inproc samples the app process (both roles live there); spawn samples the app (client) and the
# libMobileGLServer.so child it launched. The TCP supervisor's own libMobileGLServer.so (argv has
# tcp://...) is excluded by name. The wbuf[] gauges are read from the archived role logs.
# Output: <out>/bsl/<arm>/{samples.txt,peaks.txt,wbuf.txt} + the archived repeat.
set -uo pipefail
. "$(dirname "$0")/lib.sh"
[ $# -ge 1 ] || die "usage: $0 <stamp> [--arms inproc,spawn] [--interval S]"
STAMP=$1; shift
ARMS="inproc spawn"; INTERVAL=0.25
while [ $# -gt 0 ]; do
case "$1" in
--arms) ARMS=${2//,/ }; shift 2;;
--interval) INTERVAL=$2; shift 2;;
*) die "unknown option $1";;
esac
done
w2_load_build "$STAMP"
OUT=$(w2_out "$STAMP")/bsl
mkdir -p "$OUT"
w2_require_device
w2_lock
[ "$(Ash "su -c 'id -u'")" = 0 ] || die "no root on $W2_SERIAL: /proc/<pid>/maps of an app process needs it"
export MOBILEGL_TRACE_PACKAGE=$W2_PKG MOBILEGL_TRACE_SKIP_INSTALL=1 MOBILEGL_TRACE_APK=$W2_APK
unset MOBILEGL_MAGMA_FIX_ITERATIONRP_SUBGROUP_SCRATCH MOBILEGL_MAGMA_DERIVE_NUM_SUBGROUPS MOBILEGL_MAGMA_ITERATIONRP_FIX_BARRIER
RUNNER="$W2_TOOLS/tools/trace_replay/run_android_retrace_local.py"
DEV_SAMPLER=/data/local/tmp/p7w7-sampler.sh
cat > "$OUT/sampler.sh" <<'SH'
#!/system/bin/sh
# p7w7 window-2 sampler: <out> <package> <stopfile> <interval>
out=$1; pkg=$2; stop=$3; interval=$4
: > "$out"
while [ ! -f "$stop" ]; do
ts=$(date +%s.%N)
for p in $(pidof "$pkg") $(pgrep -f libMobileGLServer); do
[ -r /proc/$p/maps ] || continue
args=$(tr '\0' ' ' < /proc/$p/cmdline 2>/dev/null)
case "$args" in *tcp://*|*p7w7-sampler*) continue;; esac
n=$(wc -l < /proc/$p/maps)
st=$(grep -E '^(VmRSS|VmHWM):' /proc/$p/status | tr -s ' \t' ' ' | tr '\n' ' ')
echo "$ts pid=$p comm=$(cat /proc/$p/comm) maps=$n $st"
done >> "$out"
sleep "$interval"
done
SH
A push "$OUT/sampler.sh" "$DEV_SAMPLER" >/dev/null || die "push sampler failed"
Ash "chmod 755 $DEV_SAMPLER"
t_all=$(date +%s)
for arm in $ARMS; do
[ -f "$OUT/$arm/.done" ] && { log "bsl $arm already done"; continue; }
rm -rf "$OUT/$arm"; mkdir -p "$OUT/$arm"
dev_out=/data/local/tmp/p7w7-samples-$arm.txt; dev_stop=/data/local/tmp/p7w7-sampler.stop
Ash "su -c 'rm -f $dev_stop $dev_out'"
# The previous replay's app process outlives its Activity; stop it BEFORE the sampler starts,
# or its 800 MB and its maps count land in this arm's peaks (seen in the dry run: a 2 s pid
# that was gate 3's last case, not this replay).
Ash "am force-stop $W2_PKG"
sleep 1
w2_wake
# The sampler runs as root on the device, in the background of one adb shell.
adb -s "$W2_SERIAL" shell "su -c 'sh $DEV_SAMPLER $dev_out $W2_PKG $dev_stop $INTERVAL'" > "$OUT/$arm/sampler-adb.log" 2>&1 &
sampler=$!
sleep 1
t0=$(date +%s)
python3 "$RUNNER" --case "$W2_BSL" --backend DirectVulkan --use-pbuffer --transport "$arm" --repeat 1 \
--archive-dir "$OUT/$arm/archive" --env MOBILEGL_PIPE_STATS=1 --env MOBILEGL_PIPE_STATS_PERIOD=1 \
> "$OUT/$arm/replay.log" 2>&1
rc=$?
t1=$(date +%s)
sleep 2
Ash "su -c 'touch $dev_stop'"
for _ in $(seq 1 20); do kill -0 $sampler 2>/dev/null || break; sleep 1; done
kill $sampler 2>/dev/null || true
A pull "$dev_out" "$OUT/$arm/samples.txt" >/dev/null 2>&1 || log " WARN: no samples pulled for $arm"
Ash "su -c 'rm -f $dev_stop $dev_out'"
# peaks per (pid, comm)
python3 - "$OUT/$arm/samples.txt" > "$OUT/$arm/peaks.txt" <<'PY'
import re, sys
peaks = {}
try:
lines = open(sys.argv[1], encoding="utf-8", errors="replace").read().splitlines()
except OSError:
lines = []
for line in lines:
m = re.match(r"(\S+) pid=(\d+) comm=(\S+) maps=(\d+)(.*)", line)
if not m:
continue
key = (m.group(2), m.group(3))
rss = re.search(r"VmRSS: (\d+) kB", m.group(5)); hwm = re.search(r"VmHWM: (\d+) kB", m.group(5))
p = peaks.setdefault(key, {"samples": 0, "maps": 0, "rss": 0, "hwm": 0, "first": m.group(1), "last": m.group(1)})
p["samples"] += 1; p["last"] = m.group(1)
p["maps"] = max(p["maps"], int(m.group(4)))
if rss: p["rss"] = max(p["rss"], int(rss.group(1)))
if hwm: p["hwm"] = max(p["hwm"], int(hwm.group(1)))
print("%-8s %-18s %-6s %7s %10s %12s %12s %8s" % ("pid", "comm", "role", "samples", "maps_peak", "VmRSS_peak_kB", "VmHWM_kB", "span_s"))
for (pid, comm), p in sorted(peaks.items(), key=lambda kv: -kv[1]["maps"]):
# comm is 15 chars: the app reads "ugin.p7w1.trace", the spawned server "libMobileGLServ".
role = "server" if comm.startswith("libMobileGL") else "app"
print("%-8s %-18s %-6s %7d %10d %12d %12d %8.1f" % (pid, comm, role, p["samples"], p["maps"], p["rss"], p["hwm"],
float(p["last"]) - float(p["first"])))
if not peaks:
print("NO SAMPLES")
PY
grep -rh 'wbuf\[' "$OUT/$arm/archive" 2>/dev/null | sed 's/^.*MGPipe stats: //' > "$OUT/$arm/wbuf.txt" || true
grep -rhoE 'wbuf\[[^]]*\]' "$OUT/$arm/archive" 2>/dev/null | sort | uniq -c > "$OUT/$arm/wbuf-gauges.txt" || true
printf 'rc=%s seconds=%s finished=%s\n' "$rc" "$((t1 - t0))" "$(date -Is)" > "$OUT/$arm/.done"
log "bsl $arm rc=$rc $((t1 - t0))s"
sed 's/^/ /' "$OUT/$arm/peaks.txt"
sed 's/^/ /' "$OUT/$arm/wbuf-gauges.txt"
w2_timing "$(w2_out "$STAMP")" "bsl-$arm" "$t0" "$t1"
done
Ash "rm -f $DEV_SAMPLER"
w2_timing "$(w2_out "$STAMP")" bsl "$t_all" "$(date +%s)"
log "=== BSL STATS DONE $STAMP ==="
+178
View File
@@ -0,0 +1,178 @@
#!/usr/bin/env bash
# 50-cts-after.sh <stamp> [--blocks shader-image,ssbo,dsa,texture,packed-pixels] [--limit N]
# [--restore-base-lib]
#
# CONTRACT-P7 7.3 exit gate 5, AFTER reading: the five KHR-GL46 blocks, inproc x DirectVulkan,
# against device-window-1/CTS-base ($BASE = monolith x DirectVulkan, p7w1). Same glcts bundle,
# same caselists, same skip file and the same run_cts.py flags as $BASE (CTS-base/README.md,
# ~/w7/logs/cts-a64/base/run-base-inner.sh); the ONLY differences are the library and the arm:
# MOBILEGL_TRANSPORT=inproc + the split acceptance knobs the retrace split lane uses
# (MOBILEGL_IPC_ROLE_SPLIT_STATE=1 MOBILEGL_IPC_STRICT_ERRORS=1 MOBILEGL_IPC_RUN_AHEAD=1).
# The library is this build's APK arm64 libMobileGL.so, pushed to /data/local/tmp/mgcts exactly as
# ~/w7/logs/cts-a64/deploy/deploy.sh pushed the $BASE one, and verified by sha256 on the device.
#
# Arm proof before any block: mgprobe (the SKILL step-5 preflight) and one glcts case, each under
# the AFTER environment, must log ConfigLoader's "Config: MOBILEGL_TRANSPORT=inproc - the MGPipe
# record stream" and a "Config: IPC" line with strict=1 role-split-state=1 run-ahead=1; the proof
# case's StatusCode is recorded in arm-proof.txt (a WARN when it is neither Pass nor Fail).
# RESUMABLE per block (<out>/cts/runs/<block>/.done), and a block's .done is written ONLY when the
# block is a complete reading: run_cts.py exited 0 and 60-reduce.py --check-block (the very test the
# verdict applies) finds report-<block>.json with a result for every non-skipped case of the
# caselist and unrun.txt empty. Otherwise the block is logged INCOMPLETE (runs/<block>/complete.txt
# says why) and redone from scratch by the next run (exit 3 = the loop finished with such blocks;
# window.sh carries on and leaves the step for the next run). Each block keeps a copy of the
# caselist it ran (runs/<block>/caselist.txt) beside its path, so the window's output reduces on its
# own after the build tree is gone. 60-reduce.py requires all five blocks. The UBO block
# (GTF-GL46 uniform_buffer_object) is not run: this glcts has no GTF module (ID-P7-16).
# --limit N runs the first N cases of each block (the dry run). --restore-base-lib re-pushes the
# $BASE library at once; 90-restore.sh does it at the end of every window anyway.
set -uo pipefail
. "$(dirname "$0")/lib.sh"
[ $# -ge 1 ] || die "usage: $0 <stamp> [--blocks list] [--limit N] [--restore-base-lib]"
STAMP=$1; shift
BLOCKS="shader-image ssbo dsa texture packed-pixels"; LIMIT=0; RESTORE_BASE=0
while [ $# -gt 0 ]; do
case "$1" in
--blocks) BLOCKS=${2//,/ }; shift 2;;
--limit) LIMIT=$2; shift 2;;
--restore-base-lib) RESTORE_BASE=1; shift;;
*) die "unknown option $1";;
esac
done
w2_load_build "$STAMP"
OUT=$(w2_out "$STAMP")/cts
mkdir -p "$OUT/deploy" "$OUT/runs" "$OUT/caselists"
w2_require_device
w2_lock
CTS_ENV=(MOBILEGL_CTS_FBO_COLOR_TEXTURE=1 MOBILEGL_TRANSPORT=inproc $W2_SPLIT_KNOBS)
ENV_ARGS=(); for kv in "${CTS_ENV[@]}"; do ENV_ARGS+=(--env "$kv"); done
DEV_ENV="MOBILEGL_BACKEND_TYPE=DirectVulkan ${CTS_ENV[*]}"
t_all=$(date +%s)
# ---- deploy ---------------------------------------------------------------------------------
for f in glcts mgprobe; do
[ "$(Ash "test -x $W2_CTS_DEV/$f && echo ok")" = ok ] || die "$W2_CTS_DEV/$f missing: deploy the bundle first ($W2_CTS_BUNDLE/deploy.sh $W2_SERIAL)"
done
[ "$(Ash "test -d $W2_CTS_DEV/gl_cts && echo ok")" = ok ] || die "$W2_CTS_DEV/gl_cts missing"
unzip -o -q -j "$W2_APK" lib/arm64-v8a/libMobileGL.so -d "$OUT/deploy" || die "no arm64 libMobileGL.so in $W2_APK"
WANT=$(sha256sum "$OUT/deploy/libMobileGL.so" | cut -d' ' -f1)
BEFORE=$(Ash "sha256sum $W2_CTS_DEV/libMobileGL.so" | cut -d' ' -f1)
{
echo "apk : $W2_APK"
echo "apk sha256 : $(sha256sum "$W2_APK" | cut -d' ' -f1)"
echo "lib sha256 : $WANT"
echo "lib stamp hits : $(strings "$OUT/deploy/libMobileGL.so" | grep -c -F "${BUILD_STAMP:-$STAMP}" || true) (${BUILD_STAMP:-$STAMP})"
echo "device before : $BEFORE"
echo "glcts sha256 : $(Ash "sha256sum $W2_CTS_DEV/glcts" | cut -d' ' -f1)"
echo "env : $DEV_ENV"
} > "$OUT/deploy/IDENTITY.txt"
if [ "$BEFORE" != "$WANT" ]; then
A push "$OUT/deploy/libMobileGL.so" "$W2_CTS_DEV/libMobileGL.so" > "$OUT/deploy/push.log" 2>&1 || die "push failed"
fi
GOT=$(Ash "sha256sum $W2_CTS_DEV/libMobileGL.so" | cut -d' ' -f1)
echo "device after : $GOT" >> "$OUT/deploy/IDENTITY.txt"
[ "$GOT" = "$WANT" ] || die "the device does not carry the AFTER library ($GOT != $WANT)"
log "deployed AFTER lib $WANT to $W2_CTS_DEV"
# ---- preflight + arm proof ---------------------------------------------------------------------
arm_proof() { # <label> <logcat file> -> 0 when inproc really resolved with the gate's knobs
local f=$2 ok=1 marker ipc good fatal
marker=$(grep -c 'Config: MOBILEGL_TRANSPORT=inproc - the MGPipe record stream' "$f")
ipc=$(grep -oE 'Config: IPC.*' "$f")
good=$(printf '%s\n' "$ipc" | grep -E '\bstrict=1\b' | grep -E '\brole-split-state=1\b' | grep -cE '\brun-ahead=1\b')
fatal=$(grep -c 'Fatal{' "$f")
[ "$marker" -ge 1 ] && [ "$good" -ge 1 ] && [ "$fatal" -eq 0 ] || ok=0
echo "$1: transport-marker=$marker ipc-lines=[$(printf '%s\n' "$ipc" | head -1)] fatal=$fatal -> $([ $ok = 1 ] && echo PROVEN || echo NOT-PROVEN)"
[ $ok = 1 ]
}
if [ ! -f "$OUT/preflight.done" ]; then
w2_wake
A logcat -c
Ash "cd $W2_CTS_DEV && LD_LIBRARY_PATH=. $DEV_ENV ./mgprobe --backend DirectVulkan --surface imagereader --lib ./libMobileGL.so" > "$OUT/preflight.txt" 2>&1
A logcat -d > "$OUT/preflight-logcat.txt" 2>&1
grep -q '^PASS' "$OUT/preflight.txt" || { cat "$OUT/preflight.txt"; die "mgprobe preflight did not PASS under the AFTER environment"; }
arm_proof mgprobe "$OUT/preflight-logcat.txt" | tee "$OUT/arm-proof.txt" || die "mgprobe did not prove the inproc arm (see $OUT/preflight-logcat.txt)"
first=$(grep -v '^#' "$W2_TOOLS/tools/cts/caselists/p7-dsa-gl46.txt" | sed '/^$/d' | head -1)
A logcat -c
Ash "cd $W2_CTS_DEV && echo $first > p7w7-proof.txt && $DEV_ENV LD_LIBRARY_PATH=. ./glcts --deqp-caselist-file=p7w7-proof.txt --deqp-surface-type=fbo --deqp-surface-width=256 --deqp-surface-height=256 --deqp-gl-config-name=rgba8888d24s8 --deqp-terminate-on-device-lost=disable --deqp-log-images=disable --deqp-log-shader-sources=disable --deqp-log-filename=p7w7-proof.qpa > /dev/null 2>&1; echo RC=\$?; grep -o 'StatusCode=\"[A-Za-z]*\"' p7w7-proof.qpa; rm -f p7w7-proof.txt p7w7-proof.qpa" > "$OUT/proof-glcts.txt" 2>&1
A logcat -d > "$OUT/proof-glcts-logcat.txt" 2>&1
arm_proof "glcts $first" "$OUT/proof-glcts-logcat.txt" | tee -a "$OUT/arm-proof.txt" || die "glcts did not prove the inproc arm (see $OUT/proof-glcts-logcat.txt)"
# Information: a proof case that is NotSupported (or crashed) says the AFTER library may not
# reach a GL 4.6 core context at all; 60-reduce.py FAILs a block without a single Pass/Fail.
proof_status=$(sed -n 's/.*StatusCode="\([A-Za-z]*\)".*/\1/p' "$OUT/proof-glcts.txt" | sed -n 1p)
echo "glcts $first: StatusCode=${proof_status:-none}" | tee -a "$OUT/arm-proof.txt"
case "$proof_status" in
Pass|Fail) ;;
*) log "WARN: the proof case $first gave StatusCode=${proof_status:-none} under the AFTER environment (see $OUT/proof-glcts.txt)";;
esac
touch "$OUT/preflight.done"
fi
# ---- blocks -------------------------------------------------------------------------------------
INCOMPLETE=0
for b in $BLOCKS; do
run="$OUT/runs/$b"
[ -f "$run/.done" ] && { log "block $b already done"; continue; }
# A report left by an interrupted attempt must not stand in for this one.
rm -rf "$run"; rm -f "$OUT/report-$b.json" "$OUT/report-$b.txt"; mkdir -p "$run"
caselist="$W2_TOOLS/tools/cts/caselists/p7-$b-gl46.txt"
[ -f "$caselist" ] || die "no caselist $caselist"
if [ "$LIMIT" -gt 0 ]; then
grep -v '^#' "$caselist" | sed '/^$/d' | head -n "$LIMIT" > "$OUT/caselists/p7-$b-gl46.first$LIMIT.txt"
caselist="$OUT/caselists/p7-$b-gl46.first$LIMIT.txt"
fi
echo "$caselist" > "$run/caselist.path"
cp "$caselist" "$run/caselist.txt"
pin=$(w2_pin_check "$W2_TOOLS" "$OUT/pin-before-$b.txt")
w2_wake
log "block $b start ($(grep -vc '^#' "$caselist") cases, pin $pin)"
t0=$(date +%s)
python3 "$W2_TOOLS/tools/cts/scripts/run_cts.py" --serial "$W2_SERIAL" --backend DirectVulkan \
--caselist "$caselist" --outdir "$run" "${ENV_ARGS[@]}" \
--surface fbo --gl-config-name rgba8888d24s8 --cpu-mask fast \
--chunk-timeout 900 --skip-file "$W2_TOOLS/tools/cts/caselists/p7-skip.txt" > "$OUT/run-$b.log" 2>&1
rc=$?
t1=$(date +%s)
python3 "$W2_TOOLS/tools/cts/scripts/qpa_report.py" "$run" --label "DirectVulkan-inproc-$b" \
--json "$OUT/report-$b.json" > "$OUT/report-$b.txt" 2>&1
qrc=$?
pin=$(w2_pin_check "$W2_TOOLS" "$OUT/pin-after-$b.txt")
for f in unrun hung crashed; do [ -s "$run/$f.txt" ] && log " [$b] $f.txt: $(wc -l < "$run/$f.txt") lines"; done
grep -E 'Pass|Fail|NotSupported|Crash|rate' "$OUT/report-$b.txt" | head -8 | sed "s/^/ [$b] /"
w2_timing "$(w2_out "$STAMP")" "cts-$b" "$t0" "$t1" "limit=$LIMIT"
# The verdict's own completeness test (60-reduce.py block_scope), so a block the reducer would
# call INCOMPLETE is never frozen by a .done that a resume then skips.
complete=$(python3 "$W2_HERE/60-reduce.py" --check-block "$run" "$OUT/report-$b.json" 2>&1); crc=$?
[ $rc -eq 0 ] || { complete="run_cts.py rc=$rc; $complete"; crc=3; }
echo "$complete" > "$run/complete.txt"
if [ $crc -eq 0 ]; then
printf 'rc=%s seconds=%s pin_after=%s finished=%s\n' "$rc" "$((t1 - t0))" "$pin" "$(date -Is)" > "$run/.done"
log "block $b rc=$rc $((t1 - t0))s: $complete"
else
INCOMPLETE=$((INCOMPLETE + 1))
log "block $b rc=$rc $((t1 - t0))s INCOMPLETE: $complete (qpa_report rc=$qrc, see $OUT/report-$b.txt); no .done, the next run redoes the block"
fi
done
# The same machine-readable shape as $BASE (tools/cts/baselines/base-DirectVulkan-monolith-p7w1-
# 9be62cbc.json, cts_multi_report.py over the $BASE runs): one suite per finished block.
suites=()
for b in $BLOCKS; do
[ -f "$OUT/runs/$b/.done" ] && suites+=(--suite DirectVulkan "$b" "$(cat "$OUT/runs/$b/caselist.path")" "$OUT/runs/$b")
done
if [ ${#suites[@]} -gt 0 ]; then
python3 "$W2_TOOLS/tools/cts/scripts/cts_multi_report.py" "${suites[@]}" --adopt-legacy --allow-incomplete \
--markdown "$OUT/after-DirectVulkan-inproc-$STAMP.md" --json "$OUT/after-DirectVulkan-inproc-$STAMP.json" \
> "$OUT/multi-report.log" 2>&1 || log "WARN: cts_multi_report failed (see $OUT/multi-report.log)"
fi
if [ $RESTORE_BASE -eq 1 ]; then
w2_restore_base_lib | tee "$OUT/deploy/restored-base.txt" || log "WARN: the \$BASE library is NOT back in $W2_CTS_DEV"
fi
w2_timing "$(w2_out "$STAMP")" cts "$t_all" "$(date +%s)" "blocks=[$BLOCKS] limit=$LIMIT incomplete=$INCOMPLETE"
if [ $INCOMPLETE -gt 0 ]; then
log "=== CTS AFTER INCOMPLETE $STAMP: $INCOMPLETE block(s) not a complete reading (runs/<block>/complete.txt); run the same command again to redo them ==="
exit 3
fi
log "=== CTS AFTER DONE $STAMP ==="
@@ -0,0 +1,70 @@
{
"what": "CTS AFTER dry run of pipe head 14e1c8b9 (arm64 lib, inproc x DirectVulkan, Redmi 2f7cbe2e, 2026-09-23), stored as its differences from $BASE (device-window-1/CTS-base/report-<block>.json): AFTER results = BASE results updated with after_differences. after_counts are the real report's counts (a check that the rebuild is exact).",
"source": "~/w7/logs/devprep/w2/pre-14e1c8b9/cts/report-<block>.json (qpa_report.py --json)",
"evidence": "docs/Disaggregated/notes/p7/device-window-2/dry-run/pre-14e1c8b9-cts/",
"blocks": {
"shader-image": {
"after_differences": {
"KHR-GL46.shader_image_load_store.advanced-sync-drawIndirect": "Pass",
"KHR-GL46.shader_image_load_store.advanced-sync-textureUpdate": "Pass",
"KHR-GL46.shader_image_load_store.advanced-sync-vertexArray": "Fail",
"KHR-GL46.shader_image_load_store.incomplete_textures": "Crash",
"KHR-GL46.shader_image_load_store.non-layered_binding": "Pass"
},
"after_counts": {
"Crash": 1,
"Fail": 3,
"NotSupported": 56,
"Pass": 65
},
"after_sha256_of_sorted_results": "06052360198585ad9b8784d39081a0072c05045bac569df2a3d5a24fea811c47"
},
"ssbo": {
"after_differences": {},
"after_counts": {
"Pass": 124
},
"after_sha256_of_sorted_results": "753fce812b22c65e341c3a7c147f3431b9d514e5801a185205fb6340bc71eae2"
},
"dsa": {
"after_differences": {
"KHR-GL46.direct_state_access.renderbuffers_storage": "Crash",
"KHR-GL46.direct_state_access.renderbuffers_storage_multisample": "Fail"
},
"after_counts": {
"CompatibilityWarning": 1,
"Crash": 1,
"Fail": 3,
"Pass": 366
},
"after_sha256_of_sorted_results": "ae644a78b6dccd831b3baabac45f05308f348584f70d4f3a0abb2dbedee9ce25"
},
"texture": {
"after_differences": {
"KHR-GL46.texture_barrier.disjoint-texels": "Pass",
"KHR-GL46.texture_barrier.overlapping-texels": "Pass",
"KHR-GL46.texture_barrier.same-texel-rw": "Pass",
"KHR-GL46.texture_barrier.same-texel-rw-multipass": "Pass",
"KHR-GL46.texture_border_clamp.Texture2DArrayCompressed": "Fail",
"KHR-GL46.texture_size_promotion.functional": "Pass",
"KHR-GL46.texture_swizzle.functional_format_idx_19_target_idx_7": "Pass",
"KHR-GL46.texture_swizzle.functional_format_idx_19_target_idx_8": "Pass",
"KHR-GL46.texture_swizzle.functional_format_idx_8_target_idx_7": "Pass",
"KHR-GL46.texture_swizzle.functional_format_idx_8_target_idx_8": "Pass"
},
"after_counts": {
"Fail": 10,
"NotSupported": 221,
"Pass": 823
},
"after_sha256_of_sorted_results": "dae6aac473ee5ecce31eaf49217f44f017a10190233d4965fac8b1205e1e3f55"
},
"packed-pixels": {
"after_differences": {},
"after_counts": {
"Pass": 4732
},
"after_sha256_of_sorted_results": "d373e2b192baa92bc2a9f42e0e5fb682dad1719331149bf6ae05c35ab7fcaa38"
}
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+64
View File
@@ -0,0 +1,64 @@
#!/usr/bin/env bash
# 90-restore.sh <stamp>
#
# Puts the phone back the way 21-preflight.sh found it (<out>/session/found.env): Home screen,
# the TCP supervisor restarted on the INSTALLED package if it was running (every replay's
# `am force-stop` kills it; tcp_device_server.py start with the same listen/token and the saved
# Doze state file, which it never overwrites), the pin released if this window set it, the
# stay-on setting as found, and the $BASE library back in /data/local/tmp/mgcts (50-cts-after.sh
# leaves the AFTER one there; pushed and verified by sha256 only when the device differs).
# Prints the final state; never uninstalls anything. Idempotent: window.sh runs it on every pass.
set -uo pipefail
. "$(dirname "$0")/lib.sh"
[ $# -ge 1 ] || die "usage: $0 <stamp>"
STAMP=$1
w2_load_build "$STAMP"
OUT=$(w2_out "$STAMP")/session
[ -f "$OUT/found.env" ] || die "no $OUT/found.env: nothing recorded to restore to"
. "$OUT/found.env"
w2_require_device
w2_lock
t0=$(date +%s)
Ash "input keyevent KEYCODE_HOME"
# A replay's app process stays cached after its Activity finishes, and a spawn replay's server
# child (libMobileGLServer.so @mgl-<pid>-...) stays with it, holding its few hundred MB (seen after
# the dry run). Stop the package first so nothing of the window outlives it, then bring the
# supervisor back if it was up when the window opened.
Ash "am force-stop $W2_PKG"
sleep 1
if [ "${FOUND_SUPERVISOR:-0}" = 1 ]; then
python3 "$W2_TOOLS/tools/trace_replay/tcp_device_server.py" start --serial "$W2_SERIAL" \
--package "$W2_PKG" --listen "$W2_LISTEN" --token "$W2_TOKEN" --allow-idle \
--state-file "$W2_IDLE_STATE" > "$OUT/supervisor-restart.txt" 2>&1
for _ in $(seq 1 20); do w2_supervisor_running && break; sleep 1; done
w2_supervisor_running && log "supervisor restarted on $W2_LISTEN" || log "WARN: supervisor NOT listening (see $OUT/supervisor-restart.txt)"
Ash "input keyevent KEYCODE_HOME"
fi
BASE_LIB_STATE=$(w2_restore_base_lib) || log "WARN: $BASE_LIB_STATE"
if [ -f "$OUT/pinned-by-window" ]; then
bash "$W2_TOOLS/tools/device_bench/pin_device.sh" "$W2_SERIAL" unpin > "$OUT/pin-session-end.txt" 2>&1
rm -f "$OUT/pinned-by-window"
fi
# MIUI's launch boost clamps both CPU policies at max for a few seconds after the service start,
# which `check` reads as DRIFT ("clamped by something other than this script"): re-read it.
for _ in 1 2 3 4; do
pin=$(w2_pin_check "$W2_TOOLS" "$OUT/pin-check-final.txt")
[ "$pin" = "${FOUND_PIN:-UNPINNED}" ] && break
sleep 5
done
if [ -n "${FOUND_STAYON:-}" ] && [ "$(Ash 'settings get global stay_on_while_plugged_in')" != "$FOUND_STAYON" ]; then
Ash "settings put global stay_on_while_plugged_in $FOUND_STAYON"
fi
sleep 2
{
echo "focus : $(Ash 'dumpsys window' | grep -m1 mCurrentFocus | tr -s ' ')"
echo "supervisor : $(w2_supervisor_running && echo listening || echo not-running) (found: ${FOUND_SUPERVISOR:-?})"
echo "pin : $pin (found: ${FOUND_PIN:-?})"
echo "stayon : $(Ash 'settings get global stay_on_while_plugged_in') (found: ${FOUND_STAYON:-?})"
echo "doze wl : $(Ash 'dumpsys deviceidle whitelist' | grep -i mobilegl | tr '\n' ' ')"
echo "$BASE_LIB_STATE"
} | tee "$OUT/restored.txt"
w2_timing "$(w2_out "$STAMP")" restore "$t0" "$(date +%s)"
log "=== RESTORE DONE $STAMP ==="
@@ -0,0 +1,254 @@
# 设备窗口 #2 运行手册(P7 收官:门 3 终局 + bsl stats + CTS AFTER)
一条命令产出三样东西:CONTRACT-P7 §7.2 的门 3 读数(36 例 × DirectVulkan × `--use-pbuffer`,
monolith ×5(ID-P7-62 终裁)+ inproc ×3 + spawn ×3 + inproc `RUN_AHEAD=0` ×1,同一 reboot-clean 会话)、
M2/M3 的 bsl-esc-menu 设备读数(`MOBILEGL_PIPE_STATS` 下的 `/proc/<pid>/maps` 行数峰值与 `wbuf[]`),
以及 §7.3 门 5 的 CTS AFTER(五块 KHR-GL46,inproc × DirectVulkan,对 `device-window-1/CTS-base`)。
脚本在 `~/w7/notes/p7/window2/`(仓库副本 `docs/Disaggregated/notes/p7/device-window-2/tools/`)。
**参数**:`<pipe-sha>` = 最终功能包全部落地后的集成树提交;`<stamp>` 缺省 `p7w7-<sha8>`。
输出根 `~/w7/logs/p7w7/<stamp>/`。设备 Redmi `2f7cbe2e`,包 `top.mobilegl.plugin.p7w1.trace`(原地 `install -r`,不卸载任何东西)。
## 0. 前置(不占设备,开窗前核对)
1. `<pipe-sha>` 必须含 `p7/devprep` 的跑器修复(`fe4c8745`:`run_android_retrace_local.py` 能从 POSIX 主机起跑、
每遍之前清掉上一遍的产物)。没拣就会在第一步被 `lib.sh` 以名字拒绝;应急可 `export W2_TOOLS_OVERRIDE=~/w7/p7-devprep`
(只借工具,APK 仍按 `<pipe-sha>` 构建)。
2. Windows 侧 adb server 在跑并看得见 `2f7cbe2e`。WSL 的 `/usr/sbin/adb` 经 mirrored networking 连的就是它;
server 没了在 **Windows** 上 `adb start-server`,不要在 WSL 里起(会抢 5037 而看不见 USB)。
3. 手机 `/data/local/tmp/mgcts` 有 `glcts`、`gl_cts/`、`mgprobe`(窗口 1 部署,现仍在;缺则 `sh ~/w7/logs/cts-a64/deploy/deploy.sh 2f7cbe2e`)。
4. 窗口期间没有别的 agent 用手机、主机不并行跑 gate(超时是墙钟)。「没有别的 agent」由锁保证:本波次所有 agent 都以
`flock -w 3600 /home/swung/w7/locks/2f7cbe2e.lock <cmd>` 用手机;`window.sh` 在 build 之后、preflight 之前拿**同一把锁**
(`lib.sh` 的 `W2_SHARED_LOCK`),一直持有到 restore 结束——两步之间别的 agent 插不进来;单独起的某一步自己拿、自己放。
拿锁是 `flock -o`:脚本以同样的参数在 flock 进程下重跑,锁 fd 不传给子进程(步骤留下的 adb server / supervisor 启动器不会把锁
带出窗口)。等锁最多 `W2_SHARED_LOCK_WAIT`(默认 3600 s),等不到退出 75、不碰手机。窗口自己的步骤锁 `W2_LOCK` 照旧。
手机若有锁屏密码,reboot 后要手动解锁一次(preflight 等 `sys.user.0.ce_available=true` 最多 10 min)。
## 1. 一条命令
```bash
bash ~/w7/notes/p7/window2/detach.sh ~/w7/logs/p7w7/window-<sha8>.log ~/w7/notes/p7/window2/window.sh <pipe-sha>
tail -f ~/w7/logs/p7w7/window-<sha8>.log # 结束行 "=== WINDOW 2 DONE <stamp>",其后打印 verdict
```
`detach.sh` = `setsid nohup … < /dev/null &`,与终端 / 工具 10 min 上限脱钩;它打印的 pid 是新会话的进程组长,
要停整个窗口用 `kill -- -<pid>`(只杀 pid 本身会留下正在跑的那一步,且放掉共享锁)。**中断后原命令重跑即续**:
每步完成写 `<out>/steps/<step>.done`;门 3 逐 (arm, case) 写 `gate3/state/<arm>/<case>.done`——**只在该对要求的每一遍都留下
`result.json` 与 actual PNG 时才写**,否则日志记 `INCOMPLETE`、`gate3/progress.tsv` 第 6 列 `INCOMPLETE`、不写 `.done`,下次整对重跑
(残档先删;遍数按首跑冻结在 `gate3/arms.txt` 的 `repeat=` 与 `monolith_repeat=`:新跑记 `monolith_repeat=5`,记 3 的是过渡版脚本开的跑、续跑仍 ×3,缺失 = ID-P7-62 之前的脚本开的跑、续跑仍 monolith ×1);CTS 逐块写 `cts/runs/<block>/.done`——**只在该块是完整读数时才写**:
`run_cts.py` 退出 0,且 `60-reduce.py --check-block`(与判读**同一段代码**)确认 `cts/report-<block>.json` 对 caselist 里每个未 skip 的用例
都有结果、`unrun.txt` 为空;否则不写,原因进 `cts/runs/<block>/complete.txt`。每块另存所跑 caselist 的副本 `cts/runs/<block>/caselist.txt`
(`caselist.path` 指向的构建树删掉之后,输出目录仍能单独判读)。循环跑完仍有 INCOMPLETE 时 `30-gate3.sh` / `50-cts-after.sh` 退出 3:`window.sh` 不给该步写 `.done`、
照走后面各步(reduce 与 restore 每次都跑),结尾打 `WINDOW 2 INCOMPLETE … left open`;原命令再跑一次只补缺的——若上一遍已 restore,
它先以 `21-preflight.sh <stamp>`(不重启)回到**同一** boot 会话(重新钉频、stay-on;boot_id 变了就停;`reboot-clean.txt` 不改写,
`session/resumed.txt` 记一笔)。
**会话**(CONTRACT-P7 §7.2「同一 reboot-clean 会话」):`session/boot-id.txt` 是本窗口唯一的会话。`30-gate3.sh` 每对前后读手机
boot_id,与它不同立即停;每对的 `.done` 与每遍归档的 `repeat-NN/boot_id.txt` 都记 `boot_id=… boot_id_before=…`;`60-reduce.py`
要求四臂所有记录是同一个 boot_id 且等于 `session/boot-id.txt`,否则 `GATE3 INVALID-SESSION`。
**中断后要删什么**(先比 `adb -s 2f7cbe2e shell cat /proc/sys/kernel/random/boot_id` 与 `<out>/session/boot-id.txt`):
- **boot_id 没变**(主机 / WSL / adb 断、脚本被杀、某步 INCOMPLETE):**什么都不删**,原命令重跑。没 `.done` 的对 / 块整对 / 整块重跑,
残档由脚本先删。只想重跑某个已完成的对:删 `gate3/state/<arm>/<case>.done` 与 `steps/gate3.done`(CTS 块同理:
`cts/runs/<block>/.done` 与 `steps/cts.done`),再原命令重跑。
- **boot_id 变了(手机重启过)**:门 3 已完成的对全部作废(`30-gate3.sh` 在下一对之前就停;`21-preflight.sh` 不带 `--reboot`
也停;带 `--reboot` 时只要 `gate3/state` 里还有 `.done` 就拒绝,防漏删)。删 `gate3/state/`、`gate3/archive/`、`gate3/logs/`、
`gate3/progress.tsv`、`gate3/pin-*.txt` 与 `steps/preflight.done`、`steps/gate3.done`,然后原命令重跑(preflight 带 `--reboot`
起新会话;`session/found.env`、`gate3/cases.txt`、`gate3/arms.txt` 保留——「找到时」状态、分母与遍数不变)。bsl 与 CTS 不受会话约束,保留。
- 或者换 stamp 从头开(`window.sh <pipe-sha> <new-stamp>`),旧目录留作记录。
不重启:`window.sh <pipe-sha> --no-reboot`(门 3 要 reboot-clean,只在复跑时用)。
## 2. 步骤(等价的逐条命令)与耗时
| # | 命令 | 做什么 | 估时 |
|---|---|---|---|
| 1 | `10-build.sh <sha> [<stamp>]` | `~/w7/p7w7-tree-<sha8>`(pipe 的 detached worktree,子模块从 pipe 拷,LFS fixture 随 checkout)里构建 APK(`assembleTraceRelease`,`.p7w1` 并排 id,debuggable,显式 stamp,debug keystore 签名)与主机制品(`build-host`:`libMobileGL.so`/`libMobileGLServer.so`/`mobilegl_trace_replay` + catalog),两端 stamp 字符串各 ≥1 | 6 min(dry:APK 131 s、host 223 s) |
| 2 | `21-preflight.sh <stamp> --reboot` | 记录「找到时」的状态(supervisor、stay-on、钉频、Doze 白名单)→ reboot,前后 boot_id 必须不同 → 唤醒、`svc power stayon true` → `pin_device.sh pin`,`check` 为 `PINNED` 或 `PINNED-1100`(本板 pwrlevel 0 实跑 1100 MHz,窗口 1 已记,脚本期望值过期) | 2–3 min |
| 3 | `20-install.sh <stamp>` | `adb install -r`;**设备上 `base.apk` 的 sha256 必须等于签名 APK**,versionName 带 `<sha7>`;等 dex2oat 空闲 | ~1 min |
| 4 | `30-gate3.sh <stamp>` | 36 例(`--matrix` 的 DirectVulkan 集减 `create-indirect` / `1.21.11-main-menu` / `photon-v1.3b`,冻结在 `gate3/cases.txt`)× 四臂(monolith ×5:`30-gate3.sh` 的 `MONOLITH_REPEAT`,ID-P7-62 终裁,不随 `--repeat`;inproc / spawn ×`--repeat`(3);ra0 ×1);iterationrp 带 `apk.yml:460-462` 三个 Magma 旋钮;每遍 result.json / actual PNG / 双角色日志 / transport-proof / logcat 归档;每臂前后 pin check;每对前后核 boot_id(§1「会话」),`.done` 只在每遍都有 result.json + actual PNG 时写,否则退出 3 留待续跑。主机自检(stub adb + stub 跑器,不占设备):`bash 30-gate3-selftest.sh` | 60–70 min(窗口 2 实测外推,见 §5;monolith ×1 时 42 min) |
| 5 | `40-bsl-stats.sh <stamp>` | bsl-esc-menu × {inproc, spawn} 各 1 遍,`MOBILEGL_PIPE_STATS=1 PERIOD=1`;先 force-stop 再起设备端 root 采样器(0.25 s:maps 行数、VmRSS、VmHWM;排除 argv 带 `tcp://` 的 supervisor server);`wbuf[]` 从归档日志取 | ~1 min |
| 6 | `50-cts-after.sh <stamp>` | APK 的 arm64 `libMobileGL.so` 推到 `mgcts` 并在设备上核 sha256;AFTER 环境 = `$BASE` 的 flag + `MOBILEGL_TRANSPORT=inproc` + `ROLE_SPLIT_STATE=1 STRICT_ERRORS=1 RUN_AHEAD=1`;臂证明(mgprobe PASS 且 logcat 有 inproc 解析句与 `Config: IPC … strict=1 role-split-state=1 run-ahead=1`、0 Fatal;再用一个 glcts 用例证一次,其 StatusCode 记进 `arm-proof.txt`,不是 Pass / Fail 时打 WARN);五块依次跑(顺序同 `$BASE`),每块 `qpa_report --json`(块的 `.done` 只在 `run_cts` 退出 0 且 `60-reduce.py --check-block` 判完整时写,否则退出 3 留待续跑),最后 `cts_multi_report` 出与 `$BASE` 同形的 JSON;UBO(GTF)块不跑:本 glcts 无 GTF 模块(ID-P7-16) | 6–7 min(pipe 头 lib inproc 实测 358 s;`$BASE` monolith 372 s) |
| 7 | `60-reduce.py <stamp>` | 写 `verdict.txt` / `verdict.json`(见 §3);每遍都跑。自检:`python3 60-reduce-selftest.py`(主机,不占设备,~12 s) | ~3 min(门 3 归档每遍一次纯 Python 的 SSIM-vs-first:`p7w7-6afa077f`(monolith ×1,每例 8 遍)只读实测 108 s,主机有负载时 130–150 s;monolith ×5 每例 12 遍、多 144 遍,按每遍同价外推 160–220 s) |
| 8 | `90-restore.sh <stamp>` | Home;`am force-stop` 包(回放后缓存的 app 进程与 spawn 回放留下的 `libMobileGLServer.so @mgl-…` 子进程会一直占着几百 MB);**把 `$BASE` 库推回 `/data/local/tmp/mgcts`**(设备 sha256 ≠ `$BASE` = `IDENTITY.txt` 的 `7f58aa0b…` 时才推,推后在设备上核 sha,结果行进 `restored.txt`);supervisor 若开窗时在跑则以 `tcp_device_server.py start --allow-idle`(同 listen / token / Doze 状态文件)在**新 APK**上重启并核实在听;解钉频(MIUI 启动 boost 会让 `check` 短暂读成 DRIFT,重读至多 20 s);stay-on 复原;每遍都跑(幂等) | ~15 s |
合计:构建 ~4–6 min + 设备 ~73–86 min(门 3 60–70 min)≈ **1.3–1.5 h**。外推依据见 §5。
## 3. 判读 `verdict.txt`
- **门 3**,先看 `-- session` 行:`session/boot-id.txt` 与四臂的每条记录(`gate3/state/<arm>/<case>.done` 的 `boot_id` / `boot_id_before`、
每遍 `repeat-NN/boot_id.txt`)必须是**同一个** boot_id;有第二个值、有记录不带 boot_id(含本规则之前的旧 `.done`)、或缺 `session/boot-id.txt`,
整门判 **`GATE3 INVALID-SESSION`**,与图无关。
- **门 3 按合同常量判,不按跑器自己的记录判(ruling: integrator 2026-09-23 after codex closeout review)**:`gate3/arms.txt` 只说明
`30-gate3.sh` 被要求跑什么,不说明门要什么;reducer 自己按 CONTRACT-P7 §7.1 / §7.2 核三件事(`-- contract` 行,违反的逐条 `! FAIL-…`):
① **遍数**:inproc 与 spawn 每例归档 ≥ 3 遍。`arms.txt` 的 `repeat=` < 3,或已完成(有 `.done`)的对归档不足 3 遍 → **`GATE3 FAIL-REPEATS`**,
不管 `arms.txt` 写的是几(`--repeat 1` 跑出来的永远不是门);没有 `.done` 的对不足 3 遍仍只是该例 INCOMPLETE(续跑整对重来)。
② **四臂**:monolith / inproc / spawn / inproc-ra0 每例都要有。某臂没有归档、且 `arms.txt` 的 `arms=` 也没列它(开跑时就没带)→ **`GATE3 FAIL-ARMS`**;
列了但还没跑到、或某例缺该臂 → 该例 INCOMPLETE。ra0 那一遍的 `mobilegl.log` 必须证明 `run-ahead=0`,否则该例 FAIL(那不是对照臂);ra0 的图与 ssim 仍只记录、不判。
③ **用例集**:`gate3/cases.txt` 必须**等于**规范分母,不是「数到 36」——按 `30-gate3.sh` 的算法从工具树 `trace_cases.json` 取 CI split 且
`ci_backends` 含 DirectVulkan 的 39 例,减去 §7.1 的三个排除(reducer 的常量 `CONTRACT_EXCLUDED`,不读本次的 `gate3/excluded.txt`,两者不同只打 WARN)。
有集外用例、有重复行、或清单已给不出 39 / 36 → **`GATE3 FAIL-CASESET`**;是规范集的真子集(`--cases` 冒烟)→ 至多 `PASS-SUBSET`。
优先级:`INVALID-SESSION` > `FAIL-REPEATS` > `FAIL-ARMS` > `FAIL-CASESET` > 逐例 `FAIL` > `INCOMPLETE`。
- 全部通过但不是门本身的读数时不记 `PASS`:用例是规范 36 例的真子集记 **`PASS-SUBSET`**,
会话不是 reboot-clean(`session/reboot-clean.txt`)记 **`PASS-NOT-REBOOT-CLEAN`**,跨臂不同而没有裁定记 **`PASS-NEEDS-ADJUDICATION`**(见下),
用了 `--extra-monolith` 的重判记 **`PASS-WITH-EXTRA-READINGS`**(见下),末行注明「不是判据」,退出码非 0。
逐例 `PASS / FAIL / INCOMPLETE` + 原因:monolith 本身通过且**确是 monolith**(该遍 `mobilegl.log`(及 client / server 日志)没有
`Config: IPC` 也没有 `MOBILEGL_TRANSPORT=` 行;没有日志即「未证」);inproc 与 spawn 各 3 遍齐全、该对有 `.done`、每遍臂证明
(`transport-proof.json` passed)通过、每遍 ssim ≥ 阈值、**同一臂内三遍 actual PNG SHA-256 相同**、每遍 `|ssim − monolith| ≤ 0.0005`;
OpenRA 在 monolith / inproc / spawn 每遍都 `1.000000` 且 mismatch 0;一遍的 logcat 与上一遍逐字节相同记 `STALE`。`-- arm identity`
行汇总 monolith 身份与 split 臂 transport-proof 的通过数。`RUN_AHEAD=0` 臂每例必须有(见上 ②),且 `Config: IPC` 全是 `run-ahead=0`;
它的 ssim、SHA 只记录、不判;它的 runner rc=1 是 `--require-inproc` 要求 `run-ahead=1` 的已知副作用(E1)。
末行 `GATE3 PASS: 36/36` 才是门 3。
- **monolith 自身不可逐位复现的例(ruling: integrator 2026-09-23,ID-P7-62,`~/w7/logs/g3det/VERDICT.md` §2;(2) 为集成者终裁的「最近 monolith」口径,monolith ×5)**:「三遍逐位相同」预设参照可逐位复现。
同一会话 monolith ≥ 3 遍(`30-gate3.sh` 跑 5 遍)而图不全相同的例,split 臂的逐位相同条款换成**分布判据**:(1) split 每遍对本会话**每个** monolith 读数 `|ssim − m| ≤ 0.0005`;
(2) **最近 monolith**:px = RGBA 任一通道不同的像素数,Δ = 最大逐通道差;一遍的「最近」= 与它 px 最少的那遍(px 相同取 Δ 小者),Δ 也量到这一遍。
`D_mm` / `Δ_mm` = 各 monolith 遍到**另一** monolith 遍的最近 px / Δ 的最大值(留一法,按遍:逐位相同的两遍互为 0);split(inproc + spawn)每遍 s 须
`px(s, 最近) ≤ 1.25 × D_mm + 32` **且** `Δ(s, 最近) ≤ 1.5 × Δ_mm + 8`(reducer 常量 `SPREAD_FACTOR` / `PX_HEADROOM` / `DELTA_FACTOR` / `DELTA_HEADROOM`,`verdict.json` 的 `gate3.rule_62` 照录)。
Δ 是单像素的最大通道差,所以单有倍数与余量:过渡版 `Δ_mm + 1` 下 derivative 在 monolith ×3 的模拟里 0% 能过、纯噪声对照只 70%,终裁口径见 §6 的通过率表。
首版「全部图对最大值 ≤ monolith 两两最大值的 1.25 倍」作废:bliss 在 monolith ×3 下只 16% 能过,对纯噪声不公平
(从归档 actual PNG 算,numpy + PIL;没有则用 compare_actuals 的标准库解码,同数,`W2_REDUCE_PNG_DECODER=pure` 可强制)。
该例打 `nondeterministic monolith (N distinct / M passes) -> distributional check`(判得的 monolith 不足 5 遍时行尾注 `[M < the 5 monolith passes 30-gate3.sh runs; …]`,只作信息)与 `D_mm` / `Δ_mm`、split 到最近的最大值(及最远的那遍)、界、`max |ssim - monolith|`;
超界的 split 遍逐遍列出(它的最近 monolith 遍与 px / Δ),`verdict.json` 的 `monolith_determinism.{mono_nearest,split_nearest}` 列每遍;跨臂不同由 (2) 判、
不需 `gate3/adjudication.tsv` 行;`-- monolith determinism` 行汇总三类例数。monolith 逐位相同、或同会话不足 3 遍(ID-P7-62 之前 ×1 的归档)的例仍按逐位相同判,
后者 split 不逐位相同时原因注明「需 ≥ 3 遍」。monolith 每遍都要本身通过且确是 monolith;已完成的 monolith 对少于 `arms.txt` 的 `monolith_repeat=` → 该例 FAIL。
**`--extra-monolith DIR[@BOOT_ID]`**(可重复)把别处归档的同会话 monolith 遍(`run_android_retrace_local.py --archive-dir` 形状,如 g3det 的 `E1-mono`)加进读数:
每遍要有本会话 boot_id(该遍的 `boot_id.txt`,否则 `@BOOT_ID` 由操作者按那次跑自己的 boot_id 记录作证),没有或不同 → `INVALID-SESSION`;
用了它的读数至多 **`PASS-WITH-EXTRA-READINGS`**——裁定用的重判,不是判据。
- **跨臂同图不是门(ruling: integrator 2026-09-23)**:§7.2 的「三遍逐位相同」是**臂内**判据——inproc 自己三遍、spawn 自己三遍各自逐位相同。
inproc / spawn / monolith 三臂之间 actual PNG 是否相同只**报告**:逐例列 `i==s==m`(`yes` / `i==s` / `no`),`-- cross-arm` 行给同图例数,
不同的例各打一行 `WARN cross-arm <case>: monolith <sha> | inproc <sha> | spawn <sha>`;WARN 不改变该例的判定
(跨臂的逐例门是每遍 `|ssim − monolith| ≤ 0.0005`)。
**但不静默放行(ruling: integrator 2026-09-23 after codex closeout review)**:每个跨臂不同的例都要在 `gate3/adjudication.tsv`
(每行 `<case><TAB><理由>`,`#` 为注释;没有理由的行不算,打 WARN)里有一行,否则本来 PASS 的门记 **`GATE3 PASS-NEEDS-ADJUDICATION`**(退出 1)。
WARN 行下给出该例各臂归档的 `mismatchPixels`(对 golden),以及三臂首遍之间直接数出的像素差(`inproc-monolith` / `spawn-monolith` / `inproc-spawn`,
compare_actuals 的 `mismatch_pixels`),再注 `adjudicated: <理由>` 或 `UNADJUDICATED`;文件里列了但各臂同图的例记 note(陈旧行)。
裁定只针对跨臂同图,不豁免任何逐例判据;裁定文件属于该 stamp 的那批图,重跑某对后要重新看图再写。
- **BSL**:每臂每进程(app / server)的 maps 行数峰值、VmRSS / VmHWM 峰值、`wbuf[wbufs wlivepk wdefpk wdefsync]`。
- **CTS**:五块(shader-image / ssbo / dsa / texture / packed-pixels)**缺一不可**:每块要有 `cts/runs/<block>/.done`、非空且有结果的
`cts/report-<block>.json`,以及读得到、非空的 caselist(先用输出目录里的副本 `runs/<block>/caselist.txt`,没有才用 `caselist.path`
所指的文件;指向的文件没了、是空的、或两者都没有,**不**拿报告自己的用例顶替),否则该块记 `MISSING`、整体 `CTS INCOMPLETE`、退出码 ≠ 0——
0 例的块永远不是读数。UBO 块(`GTF-GL46.gtf31.GL3Tests.uniform_buffer_object*`,
`p7-ubo-gl46.txt` 90 例)显式记 `unrun (not in this glcts)`(设备 glcts 无 GTF 模块,ID-P7-16),不入判据。
每块 BASE 与 AFTER 的 `P/F/NS/W/X`(W = CompatibilityWarning / QualityWarning 等,X = Crash / Timeout / InternalError / ResourceError / DeviceHang / Incomplete),
**rate = Pass / (Pass + Fail + L)**,L = `$BASE` 为 Pass、AFTER 变成 NotSupported 或其他任何非 Pass 非 Fail 状态(warning、crash)的用例:
丢掉的受支持用例按**非 Pass** 计,不从分母里消失(**ruling: integrator 2026-09-23 after codex closeout review**——按 §7.3 字面的
Pass / (Pass + Fail),ssbo 124 个 `$BASE` Pass 里 123 个变 NS、1 个仍 Pass,读数仍是 100%);其余 NS、warning、crash 不在分母里。
表里 `L` 列是其个数;§7.3 字面的 Pass / (Pass + Fail) 照印在 `(literal)` 列与每块的 `info literal` 行,只供对照、**不判**。
L 例逐条列 `LOST <case> (Pass -> <AFTER 状态>)`,块里有任何一条没在 `cts/adjudication.tsv`(每行 `<case><TAB><理由>`;没有理由的行不算,打 WARN)
裁定 → 该块 **FAIL**;**已裁定的 L 例印作 `ADJUDICATED <case> (Pass -> <状态>) out of the rate; adjudicated: <理由>`,并从该块两边的 rate 里拿掉**
(不再算 AFTER 分母里的 L,`$BASE` 少一个 Pass;表里 `A` 列是其个数;`(literal)` 与旧口径两行 info 仍把它算在内。**ruling: integrator 2026-09-23 after the int3 critic**——
否则 ssbo 1 例合理的 Pass→NS 裁定后仍是 −0.806 pp,永远红)。块判据:delta ≥ −0.5 pp、
未裁定的 L 例 = 0、**新增 crash = 0 单独硬红且不可裁定**(AFTER 为 X 而 BASE 不是——Fail→Crash 也算——另加 hung.txt;Pass→Crash 既是新 crash 也是 L 例)、`unrun.txt` 为空。
两边的 rate 只在**两边都有结果的用例**上算(同口径);`$BASE` 没有的用例打 `WARN <block>: N case(s) have no $BASE result`,不进两边的 rate,
其中的 crash 仍算新增。AFTER 一个 Pass / Fail 都没有而 `$BASE` 有(例如全变 NotSupported:`$BASE` 的 Pass 全成 L,rate 为 0)→ 该块 **FAIL**;
`$BASE` 自己没有 Pass / Fail → 该块 INCOMPLETE——算不出 delta 的块永远不是 PASS。NotSupported 数与 `$BASE` 不同时打
`WARN <block>: NotSupported …`(信息;其中原为 Pass 的是 L 例,见上)。
每块第二个 `info` 行是旧口径 Pass / (结果数 − NS):BASE、AFTER 两个 rate 与 delta,只供对照,**不判**。另列 Pass→Fail(`Pass->not`)与非 Pass→Pass 的逐例名单;
AFTER 高出 0.5 pp 以上只标注不判红。某块用的不是工具树里完整的 `p7-<block>-gl46.txt`(`--limit` 子集)时,全部通过也只记 **`CTS PASS-SUBSET`**。
- 末行 `WINDOW2 GATE3 <v> | CTS <v> -> exit <n>`:门 3 为 `PASS`(规范 36 例、inproc / spawn 各 ≥ 3 遍、四臂齐、reboot-clean、同一会话、
跨臂不同全部裁定)且 CTS 为 `PASS`(五块完整、无未裁定的 L 例)才是 0;`PASS-SUBSET` / `PASS-NOT-REBOOT-CLEAN` / `PASS-NEEDS-ADJUDICATION` /
`PASS-WITH-EXTRA-READINGS` 不是判据,`FAIL-REPEATS` / `FAIL-ARMS` / `FAIL-CASESET` 是合同常量不符,均退出 1;门 3 没跑(无 `gate3/cases.txt`)记 `NOT-RUN`,同样非 0。
`reduce` 的退出码只作记录:红的门也要走完 restore。
- 自检(主机,~12 s):`python3 60-reduce-selftest.py`(门 3 按规范 36 例、monolith ×5 造:用例名由自检自己按 `30-gate3.sh` 的算法从 `trace_cases.json` 算)——造目录验:
缺块 → `CTS INCOMPLETE`;boot_id 变 / 旧 `.done` / 缺 `boot-id.txt` → `GATE3 INVALID-SESSION`;monolith 日志带 `Config: IPC` → FAIL;
**合同常量**:`--repeat 1`、同一归档配上谎报 `repeat=3` 的 `arms.txt`、已完成的对只有 2 遍 → `FAIL-REPEATS`(同一对没有 `.done` → INCOMPLETE);
开跑不带 ra0 / 不带 spawn → `FAIL-ARMS`,ra0 已列未跑 / 缺一例 → INCOMPLETE,ra0 日志 `run-ahead=1` → 该例 FAIL;
35 例 + create-indirect / 35 例 + 集外名 / 36 例 + 排除例 / 重复行 → `FAIL-CASESET`;
**跨臂**:spawn 每例不同 → WARN + 像素差、`PASS-NEEDS-ADJUDICATION`,全部写进 `gate3/adjudication.tsv` → PASS,缺一例(无理由行)→ 仍 NEEDS-ADJUDICATION,
只一例不同且已裁定(另有陈旧行)→ PASS;臂内不同 → FAIL;**ID-P7-62 最近 monolith(终裁)**(8×8 合成图:灰 128、几段像素换值):monolith ×5 逐位相同 + inproc 不同 → FAIL;
monolith 5 遍成链(相邻两遍 4 px、Δ 2:`D_mm` 4、`Δ_mm` 2、界 1.25 × 4 + 32 = 37 px / 1.5 × 2 + 8 = 11)+ split 各遍到最近 ≤ 37 px / Δ 3(到最远 45 px,首版口径会红)→ PASS、退出 0、
不需裁定行、印出数字与四个常量、每遍最近点名(px 相同取 Δ 小者),标准库解码同数;某 split 遍到最近 38 px → FAIL;到最近 Δ 11(高于过渡版 `Δ_mm + 1` = 3、也高于 `Δ_mm + 8` = 10,恰在界上)→ PASS,
Δ 12 → FAIL;到 px 最近的那遍 Δ 12(另一遍 Δ 仅 10)→ FAIL;monolith ×5 含一对逐位相同 → 留一法按遍(`D_mm` 4,按图会是 20),split 一遍到最近 40 px → FAIL;
某 split 遍对**一个** monolith 读数差 0.00051 → FAIL;过渡版脚本的跑(monolith ×3、`monolith_repeat=3`)→ 规则照用(≥ 3 遍)、PASS、注明不足 5 遍;monolith ×1(旧归档)+ split 不同 → FAIL 且注明需 ≥ 3 遍;
已完成的 monolith 对只有 4 遍(`monolith_repeat=5`)→ FAIL(无 `.done` → INCOMPLETE);×1 归档 + `--extra-monolith DIR@BOOT` 两遍 → 规则生效、`PASS-WITH-EXTRA-READINGS`(退出 1),
不带 `@BOOT` / 另一 boot → `INVALID-SESSION`;**只由 rate 定**的块(dsa 1 / 2 / 4 例 Pass→Fail:−0.270 pp PASS、−0.541 pp FAIL、
364/6/0/1/0 −1.081 pp FAIL,无 crash);**L 例**:dsa Pass→NS 未裁定 → 367/370、−0.270 pp(字面 −0.001 pp 只作信息)、列出、dsa FAIL,裁定后 PASS
且出 rate(367/369 对 367/369、+0.000 pp、印 `ADJUDICATED`);一例裁定一例未裁定 → L 1、−0.271 pp、因未裁定例 FAIL;2 例裁定 NS + 2 例 Pass→Fail →
−0.543 pp 因 rate FAIL;无理由的裁定行不算;ssbo Pass→NS 裁定后 PASS(+0.000 pp,不再 −0.806);codex 的例子 ssbo 123/124 变 NS:字面 100% 而门 rate 0.806% → FAIL;
Pass→CompatibilityWarning 也是 L;Pass→Crash 裁定后仍因新 crash FAIL;caselist 没了 / 为空 / 全 NotSupported → MISSING / FAIL 而非 PASS;
2 例门 3、非 reboot-clean、`--limit` CTS → `PASS-SUBSET` / `PASS-NOT-REBOOT-CLEAN` 且退出非 0;`$BASE` 缺的用例 → WARN;`--check-block` 的 0 / 3;
dry run 数据(`60-reduce-selftest-pre14e1c8b9.json` = pre-14e1c8b9 五块相对 `$BASE` 的差异)上 dsa 门 rate −0.541 pp(字面 −0.272 pp、
旧口径 −0.539 pp 只作信息);`~/w7/logs/devprep/w2/pre-14e1c8b9` 在时再对原始输出验一遍。
`--reducer <py>` 可对别的 reducer 跑同一套检查(red-once:`6afa077f` 的 reducer 113 项里红 54 项;`8f3d179c` 的 reducer 116 项里红 5 项——裁定例仍进 rate;
以下为现行 137 项:`dd415408` 的 reducer(ID-P7-62 之前)红 49 项;`19cb0dbc` 的 reducer((2) 的首版 1.25 × 全部图对最大值)红 14 项;`0b3af584` 的 reducer
(过渡版 `Δ_mm + 1`)红 6 项;后两者全在 monolith-determinism;日志 `~/w7/logs/g3-tools-rev2/selftest-red-*.log`)。
`bash 30-gate3-selftest.sh [--script <sh>]`:stub adb + stub 跑器驱动 `30-gate3.sh`——新跑 `arms.txt` 记 `repeat=3`、`monolith_repeat=5`,monolith 按 ×5 调用并归档 5 遍、
split ×3、ra0 ×1;新跑带 `--repeat 1` 时 split ×1 而 monolith 仍 ×5;删一个 monolith `.done` 只重跑那一对(×5);monolith 的 repeat-05(split 臂没有的第 5 遍)缺 PNG →
无 `.done`、日志点名 repeat-05、退出 3,再跑补齐;`monolith_repeat=5` 的跑以 `--repeat 1` 续跑仍 monolith ×5、split ×3;`monolith_repeat=3`(过渡版脚本开的跑)续跑仍 ×3 且日志说明;
无 `monolith_repeat=` 的旧 `arms.txt` 续跑仍 monolith ×1(13 项;red-once:`dd415408` 的 `30-gate3.sh` 红 10 项,`19cb0dbc` / `0b3af584` 的(×3)红 8 项)。
## 4. 入库清单 → `docs/Disaggregated/notes/p7/device-window-2/`
`verdict.txt`、`verdict.json`、`timing.tsv`;`session/`(`found.env`、`reboot-clean.txt`、`boot-id*.txt`、`apk.sha256`、`apk-on-device.sha256`、
`apk-install.txt`、`pin-*.txt`、`device.txt`、`restored.txt`);`gate3/{cases.txt,excluded.txt,arms.txt,progress.tsv,pin-*.txt}`;
`bsl/<arm>/{peaks.txt,wbuf.txt,wbuf-gauges.txt}`;`cts/{IDENTITY 即 deploy/IDENTITY.txt,arm-proof.txt,preflight.txt,report-*.txt,report-*.json,after-*.json,after-*.md,pin-*.txt}`、
`cts/runs/*/{crashed,hung,unrun,skipped,complete,caselist}.txt` 与 `caselist.path`。归档图像与日志(`gate3/archive/`、`bsl/*/archive/`、qpa)留在 `~/w7/logs/p7w7/<stamp>/`,
在 README 里记绝对路径(>2 MiB 不入库)。主机制品 `<out>/host/` 与 `host.sha256` 供之后的 TCP 对照(`run_tcp_matrix.py --library/--runner`,同 stamp)。
## 5. Dry run(2026-09-23,已装 p7w6 APK `45759c30…`,只证管线,不是判据)
命令:`dry-run-p7w6.sh`(`W2_APK_OVERRIDE=~/w7/logs/p7w6/trace-p7w6.apk`,`W2_TOOLS_OVERRIDE=~/w7/p7-devprep`,不重启,钉频)。
| 步 | 结果 | 墙钟 |
|---|---|---|
| preflight(无 reboot) | found:supervisor 在跑、stay-on 15、UNPINNED;pin → PINNED | 5 s |
| install `--verify-only` | 设备 `base.apk` sha256 = `45759c30…`,versionName `26.09.0e16ca2-trace` | <1 s |
| 门 3:OpenRA + iris-bsl-in-world × 四臂 × 1 | 8 次回放全部归档;OpenRA 四臂 1.000000 / 0;bsl-in-world 四臂 0.997010 同 SHA;spawn 证明 `server role in pid …`;ra0 两例 `run-ahead=0`,rc=1(预期) | 63 s(7–8 s/例/臂) |
| bsl stats inproc(+ 第二轮 spawn) | 两臂 0.999791667、SHA `155dcdd1…`(= W6/E0a);p7w6 读数:inproc app maps 峰 8536 行 / VmHWM 823 MB;spawn server 7401 行 / 343 MB,client 4595 行 / 555 MB;`wbuf[wbufs=28 wlivepk=1052 wdefpk=3312832 wdefsync=24]` | 14 s/臂 |
| CTS AFTER dsa 前 20 例 | 部署 p7w6 lib `12861aa1…` 并核 sha;mgprobe PASS;mgprobe 与 glcts 的臂证明 PROVEN;BASE 19/0/0/1 vs AFTER 19/0/0/1,+0.000 pp,0 新 crash;之后 `$BASE` lib `7f58aa0b…` 推回 | 1–2 s/块 |
| restore | Home、supervisor 在新起的 `tcp://0.0.0.0:40613` 在听、UNPINNED、stay-on 15、Doze 白名单同开窗 | 5 s |
| 构建脚本 @ `14e1c8b9`,stamp `p7w7dry-14e1c8b9`(**未安装**) | APK `f2ca6b02…`(id `.p7w1`、versionName `26.09.14e1c8b-trace`、同 debug 证书),lib stamp 串 1;主机制品 stamp 串 1 | 358 s |
| CTS 计时样本:p7w6 inproc 全 ssbo + dsa | ssbo 124/124;dsa P/F/NS/W/X 366/3/0/1/1,合同口径 −0.272 pp(旧口径 −0.539),1 新 crash(见 §6) | 3 s + 9 s |
| CTS 预读:pipe 头 `14e1c8b9` 的 arm64 lib(取自上行未安装的 APK,只推到 `mgcts`)五块全跑 | 见 §6:dsa 与 shader-image 各 1 个新 crash;之后 `$BASE` lib 推回并核 sha | 358 s |
**外推**:窗口 1 同机同口径的逐例间隔(E0a monolith 39 例 360 s、E0a inproc 342 s、W4 inproc 412 s;最慢 derivative 30 s、
bsl-esc-menu 15–30 s)与本次 dry run 的 7–8 s/例一致。**窗口 2 实测**(`p7w7-6afa077f` 的 `timing.tsv`,每例 8 遍):门 3 共 2509 s = monolith ×1 300 s +
inproc ×3 922 s + spawn ×3 933 s + ra0 ×1 353 s,即每遍 ≈ 8.5 s(含 runner 启动与汇总页、每臂 pin check)。monolith ×5(ID-P7-62 终裁,每例 12 遍):
monolith 臂 ≈ 36 × 5 × 8.5 s ≈ 1530 s,门 3 ≈ 2509 − 300 + 1530 ≈ 3740 s ≈ **62 min**,留余量记 60–70 min(×3 时约 52 min)。
CTS 五块 inproc 实测 358 s(shader-image 9 / ssbo 3 / dsa 9 / texture 108 / packed-pixels 220 s);窗口 2 实测 363 s。
## 6. 已知事实与限制
- **门 5 在 pipe 头 `14e1c8b9` 上会红(预读,非判据,逐例归属在 `docs/Disaggregated/notes/p7/device-window-2/dry-run/pre-14e1c8b9-cts/attribution.txt`)**:同一 lib 的 monolith 与
inproc 逐例对照(inproc 带或不带三个 split 旋钮结果相同):
- `KHR-GL46.direct_state_access.renderbuffers_storage`:monolith Pass,inproc **SIGABRT** `Fatal{ReplyTooLarge, "ReadPixels 256x512 0x1908/0x1406 2097152 > 2097136"}`
——RGBA/FLOAT 回读恰 2 MiB,比一个 reply 槽的载荷上限(槽 − 16 B 头,`MG_Remote/Transport/ReplySlot.h:166-169`)多 16 B;客户端在发射前具名拒绝
(`MG_Remote/Client/ClientSession.cpp:2319`,ID-47:「chunked readback 是 P6 债」)。
- `…renderbuffers_storage_multisample`:monolith Pass,inproc Fail。两例合计 dsa 按合同口径 Pass/(Pass+Fail) 为 **−0.272 pp**
(368/370 → 366/369,在 0.5 pp 内;旧口径 Pass/(结果数 − NS) 为 −0.539 pp)——dsa 红在 1 个新 crash,不在 rate。
新 reducer 在该数据上的读数:`docs/Disaggregated/notes/p7/device-window-2/dry-run/pre-14e1c8b9-cts/verdict-contract.txt`。
**按 codex 收官复核后的裁定(ruling: integrator 2026-09-23 after codex closeout review)**,`renderbuffers_storage` 的 Pass→Crash 是 L 例:
门 rate 366/(366+3+1) = 98.919%,**−0.541 pp**,dsa 同时红在新 crash、rate 与未裁定的 L 例(字面 −0.272 pp 只作信息);
读数 `…/dry-run/pre-14e1c8b9-cts/verdict-codex-ruling.txt`。
- `KHR-GL46.shader_image_load_store.incomplete_textures`:monolith Fail(`$BASE` 亦非 Pass),inproc **SIGABRT** `Fatal{UnmigratedVerb, "Magma:image-view-window"}`
(`MG_Backend/DirectVulkan/Renderer/UniformManager.cpp:151`)——Fail 变 Crash,按门 5 是新 crash。
- `…shader_image_load_store.advanced-sync-vertexArray`:`$BASE` Pass,pipe 头 monolith 与 inproc 都 Fail——不是分离缺陷,是 p7w1 之后两臂共有的漂移。
- `KHR-GL46.texture_border_clamp.Texture2DArrayCompressed`:整块里 Fail 一次,单跑三臂都 Pass——抖动。
- 其余:ssbo、packed-pixels 与 `$BASE` 相同;texture +0.960 pp;shader-image 整体 +4.284 pp(合同口径;旧口径 +2.9,3 例修好)。
终局窗口之前要么修(ReadPixels 分块或放大 reply 槽;`image-view-window` 的 incomplete-texture 形状 decline 成 GL 语义而不是 Fatal),要么由集成者裁定。
- dry run 暴露并已修的两处:`run_android_retrace_local.py` 只会用 Git Bash 起跑(WSL 下每例 FileNotFoundError),且一遍没产出时会归档上一遍的图(假「逐位相同」)——`fe4c8745`,带 red-once 单测;
脚本自身的 `pipefail` + `grep -q` 把在跑的 supervisor 读成「不在」——已改为先取输出再匹配。
- `$BASE` 的机器可读 JSON(CTS-base/README 所称 `base-DirectVulkan-monolith-p7w1-9be62cbc.json`)此前不在任何树里;已按 `cts_multi_report.py --adopt-legacy` 从
`~/w7/logs/cts-a64/base/runs` 重生成入 `tools/cts/baselines/`(数字与 README 表逐块一致;texture 因 skip 表 1 例记 INCOMPLETE 是该工具的口径)。
判据本身用的是入库的 `CTS-base/report-*.json` 逐例结果。
- `$BASE` 库的 IDENTITY 写 stamp `p7w1-d260f110`,README / JSON 名写 `9be62cbc`:两者是同一补丁(`d260f110` 与 `9be62cbc` 同题提交),只是命名差。
- 每次回放的 `am force-stop` 会杀 TCP supervisor;restore 负责按开窗状态复原。
- **窗口 2(`p7w7-6afa077f`)按 ID-P7-62 终裁口径只读重判**(reducer `95b4dc19`,输出 `~/w7/logs/g3-tools-rev2/`,`verdict.{json,txt}` sha 前后相同、归档与 g3det 目录无改动):
原档 monolith ×1 → 三个 Iris 例仍 FAIL(规则需 ≥ 3 遍),`GATE3 FAIL 33/36`(`verdict-rereduce.txt`);加 g3det `E1-mono`(同 boot `8e396037…`,`spec1*.log` 前后核)→
sundial(`D_mm` 4113 px / `Δ_mm` 44,界 5173.25 px / 74;split 到最近 ≤ 4242 px / Δ 36)、bliss(9 px / 2,界 43.25 / 11;split ≤ 13 px / Δ 3)、
derivative(8690 px / 49,界 10894.5 / 81.5;spawn rep1 到最近 8743 px、Δ 56——过渡版 `Δ_mm + 1` = 50 下是唯一的红)全过,36/36,
只余 create-instancing 的跨臂裁定未写:**`GATE3 PASS-NEEDS-ADJUDICATION: 36/36`**(`verdict-rereduce-e1mono.txt`);再加 `E5-mono-{a,b,c}`(同 boot,`spec2.log`,只有 bliss)→
bliss monolith 18 遍 11 张、8 px / 2(界 42 / 11),split ≤ 5 px / Δ 2,**`GATE3 PASS-NEEDS-ADJUDICATION: 36/36`**(`verdict-rereduce-e1e5mono.txt`)。
两者用了 `--extra-monolith`,本就不是判据;终局读数要新窗口的门 3 自己的 monolith ×5。
- **终裁口径的通过率**(同会话 plain monolith 池任取 K 遍作参照,配门 3 自己的 split 6 遍,(1)+(2) 由本 reducer 的 `nearest_spread` 与常量算;
`~/w7/logs/g3-tools-rev2/nearsim.{py,txt}`;括号内为过渡版 `Δ_mm + 1`):
| 例(池) | monolith ×3 | monolith ×5 | monolith ×6 | 纯噪声对照(参照 ×3 / 伪 split ×3) |
|---|---|---|---|---|
| sundial-lite(6 遍 6 张) | 100%(75%),20 组 | 100%(83.3%),6 组 | 100%(100%),1 组 | 95%(70%);参照 ×5 / 伪 ×1:100%(83.3%) |
| bliss(18 遍 11 张) | 97.5%(89.6%),816 组 | 99.9%(94.3%),8568 组 | 100%(95.9%),18564 组 | 100%(98.3%);参照 ×5 / 伪 ×3:100%(98.2%) |
| derivative-main-d24.4.14(6 遍 6 张) | 95%(0%),20 组 | 100%(0%),6 组 | 100%(0%),1 组 | 95%(70%);参照 ×5 / 伪 ×1:100%(100%) |
首版口径(1.25 × 全部图对最大值):bliss ×3 16.2%、×5 27.8%。`Δ_mm` 改读作「到任一其他遍的最小 Δ」在终裁口径下与表中 monolith ×3 / ×5 / ×6 各格相同(纯噪声列未算此读法)。
derivative ×3 唯一不过的一组(参照 `E1-mono` rep2/3/4,其纯噪声对照不过的也是这组参照)与 sundial 纯噪声唯一不过的一组(参照 g3 rep1 + `E1-mono` rep2/5)都红在 Δ、不在 px:
参照 3 遍彼此的 Δ 恰好都小(`Δ_mm` 27 / 23,界 48.5 / 42.5),而被判遍到最近的 Δ 为 43–56——split 遍与 monolith 遍一样;×5 下 6 遍的池里没有这种组合。
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# detach.sh <logfile> <script> [args...]
#
# Starts one window-2 step so that it survives the terminal / the agent's 10-minute tool limit:
# a new session (setsid), immune to hangup (nohup), stdin from /dev/null, all output to <logfile>.
# Prints the pid and the log path, and returns at once. Poll with: tail -f <logfile>
# Every step is resumable (per-case / per-block done markers), so re-running the same command
# after an interruption continues where it stopped.
set -euo pipefail
[ $# -ge 2 ] || { echo "usage: $0 <logfile> <script> [args...]" >&2; exit 64; }
logfile=$1; shift
mkdir -p "$(dirname "$logfile")"
setsid nohup bash "$@" > "$logfile" 2>&1 < /dev/null &
pid=$!
disown "$pid" 2>/dev/null || true
# Linger briefly: when the caller is `wsl.exe ... bash launcher.sh`, returning at once can tear the
# WSL session down before the child has left the caller's session (observed: a step that never
# wrote its first line). Two seconds, then say whether it is really running.
sleep 2
if kill -0 "$pid" 2>/dev/null; then
echo "detached pid=$pid log=$logfile"
else
echo "WARNING: pid $pid already exited; see $logfile" >&2
fi
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# dry-run-p7w6.sh - the plumbing proof recorded in RUNBOOK.md section 5, against the p7w6 APK that
# is ALREADY installed (nothing is installed or uninstalled): 2 gate-3 cases x all four arms x1,
# bsl stats on inproc once, CTS AFTER on the first 20 dsa cases (then the $BASE lib goes back),
# reduce, restore. Not a verdict run.
set -uo pipefail
HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
export W2_LOGROOT=${W2_LOGROOT:-$HOME/w7/logs/devprep/w2}
export W2_APK_OVERRIDE=${W2_APK_OVERRIDE:-$HOME/w7/logs/p7w6/trace-p7w6.apk}
export W2_TOOLS_OVERRIDE=${W2_TOOLS_OVERRIDE:-$HOME/w7/p7-devprep}
STAMP=${1:-dry-p7w6}
CASES=${DRY_CASES:-OpenRA,minecraft-1.21.4-fabric-iris-bsl-in-world}
echo "=== DRY RUN START $(date -Is) stamp=$STAMP apk=$W2_APK_OVERRIDE tools=$W2_TOOLS_OVERRIDE ==="
bash "$HERE/21-preflight.sh" "$STAMP" || exit 1
bash "$HERE/20-install.sh" "$STAMP" --verify-only || exit 1
bash "$HERE/30-gate3.sh" "$STAMP" --cases "$CASES" --repeat 1
bash "$HERE/40-bsl-stats.sh" "$STAMP" --arms inproc
bash "$HERE/50-cts-after.sh" "$STAMP" --blocks dsa --limit 20 --restore-base-lib
python3 "$HERE/60-reduce.py" "$STAMP" > "$W2_LOGROOT/$STAMP/verdict.txt" 2>&1; echo "reduce rc=$?" >> "$W2_LOGROOT/$STAMP/verdict.txt"
bash "$HERE/90-restore.sh" "$STAMP"
cat "$W2_LOGROOT/$STAMP/verdict.txt"
echo "=== DRY RUN DONE $(date -Is) ==="
+158
View File
@@ -0,0 +1,158 @@
# Device window 2 (P7 closeout) - shared settings and helpers. Sourced, never run.
#
# Every setting is an overridable W2_* environment variable; the defaults are the Redmi
# 2f7cbe2e / p7w1-side-by-side-package facts recorded in docs/Disaggregated/notes/p7/
# device-window-1/00-session/README.md and HANDOFF-2026-09-22.md.
W2_HERE=$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
W2_ARGV=("$@") # the sourcing script's own arguments: w2_shared_lock re-runs it with them
W2_SERIAL=${W2_SERIAL:-2f7cbe2e}
W2_PKG=${W2_PKG:-top.mobilegl.plugin.p7w1.trace}
W2_TOKEN=${W2_TOKEN:-p7w1b-lan-token-20260922} # >= 16 bytes (ServerMain token rule)
W2_LISTEN=${W2_LISTEN:-tcp://0.0.0.0:40613}
W2_PIPE=${W2_PIPE:-$HOME/w7/pipe} # integration tree: READ-ONLY here
export W2_LOGROOT=${W2_LOGROOT:-$HOME/w7/logs/p7w7} # one directory per <stamp> below this
W2_CTS_BUNDLE=${W2_CTS_BUNDLE:-$HOME/w7/logs/cts-a64/deploy} # glcts + mgprobe + BASE lib
W2_CTS_DEV=${W2_CTS_DEV:-/data/local/tmp/mgcts}
W2_IDLE_STATE=${W2_IDLE_STATE:-$HOME/.cache/mobilegl/tcp-server/${W2_SERIAL}-${W2_PKG}.json}
W2_LOCK=${W2_LOCK:-$HOME/w7/logs/p7w7-device-${W2_SERIAL}.lock}
# The device lock every agent of the wave holds while it touches the phone
# ('flock -w 3600 /home/swung/w7/locks/2f7cbe2e.lock <cmd>'); empty = do not take it (host tests).
W2_SHARED_LOCK=${W2_SHARED_LOCK-$HOME/w7/locks/${W2_SERIAL}.lock}
W2_SHARED_LOCK_WAIT=${W2_SHARED_LOCK_WAIT:-3600}
W2_SHARED_LOCK_RC=75 # a step's exit status when the shared lock never came free
export MOBILEGL_FLATC_EXECUTABLE=${MOBILEGL_FLATC_EXECUTABLE:-/home/swung/w7/flatc-build/flatc}
# The three gate-3 exclusions (CONTRACT-P7 7.1, E0-attribution/exclusions.md). They are red on
# the MONOLITH arm too, so they are not split defects; they are listed, never silently dropped.
W2_EXCLUDED="minecraft-1.21.1-neoforge-create-indirect-in-world minecraft-1.21.11-main-menu minecraft-1.21.4-fabric-iris-photon-v1.3b-in-world"
W2_ITERATIONRP=minecraft-1.21.4-fabric-iris-iterationrp-in-world
W2_BSL=minecraft-1.21.4-fabric-iris-bsl-esc-menu-854
# The split acceptance knobs run_android_retrace_local.py hands every split arm
# (SPLIT_ACCEPTANCE_KNOBS); CTS AFTER uses the same arm.
W2_SPLIT_KNOBS="MOBILEGL_IPC_ROLE_SPLIT_STATE=1 MOBILEGL_IPC_STRICT_ERRORS=1 MOBILEGL_IPC_RUN_AHEAD=1"
A() { adb -s "$W2_SERIAL" "$@"; }
Ash() { adb -s "$W2_SERIAL" shell "$@" | tr -d '\r'; }
log() { printf '[%s] %s\n' "$(date +%H:%M:%S)" "$*"; }
die() { printf '[%s] FATAL: %s\n' "$(date +%H:%M:%S)" "$*" >&2; exit 1; }
# <stamp> -> the window's output directory, and the per-stamp facts 10-build.sh wrote.
w2_out() { printf '%s/%s\n' "$W2_LOGROOT" "$1"; }
w2_load_build() {
local out; out=$(w2_out "$1")
[ -f "$out/build.env" ] && . "$out/build.env"
# Overrides for a run against an APK this window did not build (the dry run: p7w6).
W2_APK=${W2_APK_OVERRIDE:-${BUILD_APK:-$out/apk/trace-$1.apk}}
W2_TOOLS=${W2_TOOLS_OVERRIDE:-${BUILD_TREE:-}}
[ -n "$W2_TOOLS" ] || die "no tools tree: run 10-build.sh first or set W2_TOOLS_OVERRIDE"
[ -f "$W2_TOOLS/tools/trace_replay/run_android_retrace_local.py" ] || die "not a MobileGL tree: $W2_TOOLS"
# The runner must be able to start from this (POSIX) host: the fix is p7/devprep fe4c8745.
grep -q 'def bash_executable' "$W2_TOOLS/tools/trace_replay/run_android_retrace_local.py" \
|| die "$W2_TOOLS lacks the POSIX-host runner fix (cherry-pick p7/devprep fe4c8745)"
grep -q 'def clear_repeat_outputs' "$W2_TOOLS/tools/trace_replay/run_android_retrace_local.py" \
|| die "$W2_TOOLS lacks the per-repeat output clear (cherry-pick p7/devprep fe4c8745)"
[ -f "$W2_APK" ] || die "APK not found: $W2_APK"
}
w2_require_device() {
w2_shared_lock # the first adb call of every device step already runs under the shared lock
local state; state=$(timeout 20 adb -s "$W2_SERIAL" get-state 2>/dev/null | tr -d '\r')
[ "$state" = device ] || die "adb does not see $W2_SERIAL (state '$state'). WSL's adb is a client of the WINDOWS adb server (mirrored networking); if it is gone, run 'adb start-server' on Windows - never start one from WSL"
}
# The wave's shared device lock ($W2_SHARED_LOCK): other agents run their device work under it, so
# the window must hold it too or it does not exclude them. window.sh takes it once, after the build,
# for every device step to the end (no other agent gets the phone between two steps); a step started
# on its own takes it for itself. Taken as `flock -o` does: this script is RE-RUN (same arguments) as
# the child of a flock process that keeps the lock, and the child does not carry the lock's fd - so
# nothing a step leaves running (an adb server, a supervisor launcher) keeps the phone locked after
# it. The re-run sees W2_SHARED_LOCK_HELD and goes on; everything before this call runs twice and
# must stay idempotent. Waits up to $W2_SHARED_LOCK_WAIT s, else exits $W2_SHARED_LOCK_RC.
w2_shared_lock() {
[ -n "$W2_SHARED_LOCK" ] || return 0
[ "${W2_SHARED_LOCK_HELD:-}" = "$W2_SHARED_LOCK" ] && return 0
mkdir -p "$(dirname "$W2_SHARED_LOCK")"
log "taking the shared device lock $W2_SHARED_LOCK (waits up to ${W2_SHARED_LOCK_WAIT}s while another agent holds $W2_SERIAL; exit $W2_SHARED_LOCK_RC if it never frees)"
export W2_SHARED_LOCK_HELD=$W2_SHARED_LOCK
exec flock -o -w "$W2_SHARED_LOCK_WAIT" -E "$W2_SHARED_LOCK_RC" "$W2_SHARED_LOCK" bash "$0" "${W2_ARGV[@]}"
}
# One device user at a time: the runner's result root and the device are both single-tenant.
# The shared lock first (it re-runs the step), then this window's own step lock.
w2_lock() {
w2_shared_lock
mkdir -p "$(dirname "$W2_LOCK")"
exec 9>"$W2_LOCK"
flock -n 9 || die "another window-2 step holds $W2_LOCK"
}
w2_wake() {
timeout 15 adb -s "$W2_SERIAL" shell input keyevent KEYCODE_WAKEUP >/dev/null 2>&1 || true
timeout 15 adb -s "$W2_SERIAL" shell wm dismiss-keyguard >/dev/null 2>&1 || true
}
# pin_device.sh check, classified. PINNED = exit 0. The one tolerated DRIFT is the documented
# board fact (00-session/README.md): this unit's GPU really runs pwrlevel 0 at 1100 MHz, while
# pin_device.sh still expects 1050 - that is PINNED-1100, not a slipped pin. Anything else is
# recorded as-is and the arm's pin status is UNPROVEN.
w2_pin_check() { # <tools-tree> <outfile>
local out=$2 rc
bash "$1/tools/device_bench/pin_device.sh" "$W2_SERIAL" check > "$out" 2>&1; rc=$?
if [ $rc -eq 0 ]; then echo PINNED; return 0; fi
if grep -q 'VERDICT: DRIFT' "$out" \
&& [ "$(grep -c '^ - ' "$out")" = 1 ] \
&& grep -q '^ - gpu pinned to pwrlevel 0 but gpuclk=1100000000 (expected 1050000000)' "$out"; then
echo PINNED-1100; return 0
fi
grep -q 'VERDICT: UNPINNED' "$out" && { echo UNPINNED; return 1; }
echo DRIFT; return 1
}
# No `| grep -q` anywhere under `set -o pipefail`: grep -q exits on the first match, the writer
# takes SIGPIPE and the pipeline reports 141 - a MATCH read as "not running" (the dry run's first
# preflight recorded a live supervisor as absent exactly this way).
w2_supervisor_running() {
local ps; ps=$(Ash "ps -A -o ARGS" 2>/dev/null)
case "$ps" in *"libMobileGLServer.so ${W2_LISTEN} --serve"*) return 0;; esac
return 1
}
# ---- one boot session (CONTRACT-P7 7.2; ruling: integrator 2026-09-23) ------------------------
# The phone's current boot_id ('' when adb cannot read it).
w2_boot_id() { timeout 20 adb -s "$W2_SERIAL" shell cat /proc/sys/kernel/random/boot_id 2>/dev/null | tr -d '\r\n '; }
# The window's session boot_id, as 21-preflight.sh recorded it.
w2_session_boot_id() {
local f; f="$(w2_out "$1")/session/boot-id.txt"
if [ -f "$f" ]; then tr -d '\r\n ' < "$f"; fi
}
# <session-boot-id> <where> [<current>]: die unless the phone is still in that boot session.
w2_same_session() {
local now=${3-$(w2_boot_id)}
[ -n "$now" ] || die "$2: cannot read the phone's boot_id (adb)"
[ "$now" = "$1" ] || die "$2: the phone left this window's session (boot_id $1 -> $now; it rebooted). Gate 3 is a one-session reading: its finished pairs are void. RUNBOOK section 1 'phone rebooted' says what to delete before a new --reboot session"
}
# ---- the $BASE library back into mgcts ---------------------------------------------------------
# 50-cts-after.sh leaves the AFTER library in $W2_CTS_DEV; whoever uses mgcts next expects $BASE
# (device-window-1/CTS-base, the p7w1 monolith). Push the bundle's lib unless the device already has
# it, verify by sha256 on the device, print one status line. 0 = the device carries $BASE.
w2_restore_base_lib() {
local want have got
want=$(awk '/^libMobileGL.so *sha256:/ {print $3}' "$W2_CTS_BUNDLE/IDENTITY.txt" 2>/dev/null)
[ -n "$want" ] || { echo "mgcts lib : NOT restored - no \$BASE sha256 in $W2_CTS_BUNDLE/IDENTITY.txt"; return 1; }
[ "$(Ash "test -d $W2_CTS_DEV && echo ok")" = ok ] || { echo "mgcts lib : no $W2_CTS_DEV on the device, nothing to restore"; return 0; }
got=$(Ash "sha256sum $W2_CTS_DEV/libMobileGL.so 2>/dev/null" | cut -d' ' -f1)
if [ "$got" = "$want" ]; then echo "mgcts lib : \$BASE $want (already)"; return 0; fi
have=$(sha256sum "$W2_CTS_BUNDLE/libMobileGL.so" 2>/dev/null | cut -d' ' -f1)
[ "$have" = "$want" ] || { echo "mgcts lib : NOT restored - bundle lib ${have:-missing} != \$BASE $want"; return 1; }
A push "$W2_CTS_BUNDLE/libMobileGL.so" "$W2_CTS_DEV/libMobileGL.so" > /dev/null 2>&1
local now; now=$(Ash "sha256sum $W2_CTS_DEV/libMobileGL.so 2>/dev/null" | cut -d' ' -f1)
if [ "$now" = "$want" ]; then echo "mgcts lib : \$BASE $want restored (was ${got:-absent})"; return 0; fi
echo "mgcts lib : RESTORE FAILED (${now:-absent} != \$BASE $want)"; return 1
}
w2_timing() { # <out> <step> <start-epoch> <end-epoch> [note]
printf '%s\t%s\t%s\t%s\t%s\n' "$2" "$(date -d @"$3" +%FT%T)" "$(date -d @"$4" +%FT%T)" \
"$(( $4 - $3 ))" "${5:-}" >> "$1/timing.tsv"
}
+94
View File
@@ -0,0 +1,94 @@
#!/usr/bin/env bash
# window.sh <pipe-sha> [<stamp>] [--no-reboot] [--skip build,preflight,install,gate3,bsl,cts,reduce,restore]
#
# The whole device window 2 as one resumable sequence (run it detached: see RUNBOOK.md):
# 10-build.sh APK + host artefacts, stamp <stamp> (default p7w7-<sha8>) host only
# 21-preflight.sh record found state, reboot-clean (unless --no-reboot), stay-on, pin
# 20-install.sh adb install -r, on-device base.apk sha256 == built APK, dex2oat idle
# 30-gate3.sh 36 cases x {monolith x5, inproc x3, spawn x3, inproc RUN_AHEAD=0 x1}
# 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, $BASE lib back in mgcts
# From preflight to restore the window holds the wave's shared device lock ($W2_SHARED_LOCK, the
# one other agents take with 'flock -w 3600 ... <cmd>'; it waits up to W2_SHARED_LOCK_WAIT s for it).
# Each finished step leaves <out>/steps/<step>.done; a re-run skips it (gate3 / cts also resume
# 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"
[ $# -ge 1 ] || die "usage: $0 <pipe-sha> [<stamp>] [--no-reboot] [--skip a,b]"
PIPE_SHA=$1; shift
STAMP=""; REBOOT=--reboot; SKIP=""
while [ $# -gt 0 ]; do
case "$1" in
--no-reboot) REBOOT=""; shift;;
--skip) SKIP=",$2,"; shift 2;;
--*) die "unknown option $1";;
*) STAMP=$1; shift;;
esac
done
SHA=$(git -C "$W2_PIPE" rev-parse --verify "$PIPE_SHA^{commit}")
STAMP=${STAMP:-p7w7-${SHA:0:8}}
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
if skipped "$name"; then log "--- $name: skipped by --skip"; return 0; fi
log "--- $name: $*"
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 "$W2_SHARED_LOCK_RC" ] && die "--- $name: the shared device lock $W2_SHARED_LOCK was not free within ${W2_SHARED_LOCK_WAIT}s (another agent holds $W2_SERIAL); run the same command later"
[ $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"
}
step build bash "$HERE/10-build.sh" "$SHA" "$STAMP"
# From here to the end the window holds the wave's shared device lock (lib.sh w2_shared_lock: this
# script is re-run under `flock -o`; the build above is done by then and skipped by the re-run), so no
# other agent gets the phone between two steps; the steps see W2_SHARED_LOCK_HELD and do not re-take it.
w2_shared_lock
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. 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"
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"