mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-19 16:01:57 +09:00
[tools] (P7): window-2 reducers follow the contract formula, require every block and one boot session
This commit is contained in:
@@ -11,9 +11,18 @@
|
||||
# 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/.
|
||||
#
|
||||
# RESUMABLE: one runner invocation per (arm, case); a finished pair writes
|
||||
# <out>/gate3/state/<arm>/<case>.done and is skipped on the next start. An interrupted pair is
|
||||
# re-run from scratch (its partial archive is removed first). Run it detached:
|
||||
# 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"
|
||||
@@ -34,10 +43,14 @@ 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 is frozen on first start so a resume cannot change the denominator ----------
|
||||
# ---- 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"
|
||||
@@ -57,6 +70,13 @@ fi
|
||||
mapfile -t CASES < "$OUT/cases.txt"
|
||||
[ ${#CASES[@]} -gt 0 ] || die "empty case list"
|
||||
[ -f "$OUT/arms.txt" ] || printf 'arms=%s\nrepeat=%s\napk=%s\ntools=%s\n' "$ARMS" "$REPEAT" "$W2_APK" "$W2_TOOLS" > "$OUT/arms.txt"
|
||||
# The repeat count is 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
|
||||
log "gate3 stamp=$STAMP cases=${#CASES[@]} arms=[$ARMS] repeat=$REPEAT apk=$W2_APK tools=$W2_TOOLS"
|
||||
|
||||
arm_args() { # <arm> -> runner arguments
|
||||
@@ -68,8 +88,20 @@ arm_args() { # <arm> -> runner arguments
|
||||
*) die "unknown arm $1";;
|
||||
esac
|
||||
}
|
||||
arm_repeats() { case "$1" in inproc|spawn) echo "$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
|
||||
@@ -92,6 +124,8 @@ for arm in $ARMS; do
|
||||
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
|
||||
@@ -109,16 +143,41 @@ for arm in $ARMS; do
|
||||
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" ] && mv "$OUT/archive/$arm/run.json" "$OUT/archive/$arm/$c-DirectVulkan/run.json" 2>/dev/null
|
||||
[ -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)
|
||||
printf 'rc=%s seconds=%s attempts=%s passed_lines=%s finished=%s\n' "$rc" "$((t1 - t0))" "$attempt" "$passes" "$(date -Is)" \
|
||||
> "$OUT/state/$arm/$c.done"
|
||||
printf '%s\t%s\t%s\t%s\t%s\n' "$arm" "$c" "$rc" "$((t1 - t0))" "$(date -Is)" >> "$OUT/progress.tsv"
|
||||
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)"
|
||||
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 ==="
|
||||
|
||||
Reference in New Issue
Block a user