Restrict the frame-regression release gate to the emulator
The on-device profile is demoted to a diagnostic: the run force-stops the app and seeds/removes a file in its storage, and the developer may be using the phone while a release runs. The release gate is now explicitly (1) TestNoFramesWhileIdle in the go-test suite and (2) scripts/profile_emulator.sh on the EMULATOR. - script: auto-select picks an emulator only (previously any connected device); no emulator -> clear error; a physical device passed via -s prints a DIAGNOSTIC (non-gating) banner and a heads-up. - doc: architecture.md §11 states the two gate tiers and the diagnostic use of the physical-device run.
This commit is contained in:
@@ -1,14 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pre-release frame-regression profile for the Pad editor.
|
||||
#
|
||||
# RELEASE GATE ON THE EMULATOR ONLY. The frame-regression guard has two
|
||||
# tiers (architecture.md §11):
|
||||
# 1. TestNoFramesWhileIdle (internal/test/e2e) — headless, in the regular
|
||||
# go-test suite, runs on every build;
|
||||
# 2. this script, run on the EMULATOR, as the pre-release checklist item.
|
||||
# Runs on a PHYSICAL device are DIAGNOSTIC only — never a gate. The script
|
||||
# force-stops the app and seeds/removes a file in its storage; the developer
|
||||
# may be using the phone while a release runs, so physical devices are
|
||||
# never auto-selected. Pass -s <phone serial> explicitly for a diagnostic
|
||||
# run (a banner reminds you the result is informational).
|
||||
#
|
||||
# Measures whether the app generates frames WITHOUT a cause. Frame emission
|
||||
# is event-driven (architecture.md §2), so a correct app emits a small
|
||||
# number of frames per user action and NOTHING while idle. This script
|
||||
# drives a fixed sequence of actions on a connected device/emulator and
|
||||
# checks the in-app profiler's CSV for phases that exceed their frame
|
||||
# budget. The headless contract of the same guard is
|
||||
# TestNoFramesWhileIdle (internal/test/e2e), which runs in the regular
|
||||
# go-test suite.
|
||||
# drives a fixed sequence of actions and checks the in-app profiler's CSV
|
||||
# for phases that exceed their frame budget.
|
||||
#
|
||||
# Usage:
|
||||
# scripts/profile_emulator.sh [-s SERIAL] [-o OUT_DIR]
|
||||
@@ -60,15 +68,23 @@ BUDGET_OPEN="${BUDGET_OPEN:-20}"
|
||||
BUDGET_SCROLL="${BUDGET_SCROLL:-8}"
|
||||
|
||||
if [ -z "$SERIAL" ]; then
|
||||
SERIAL=$(adb devices | awk 'NR>1 && $2=="device" {print $1; exit}')
|
||||
# Auto-select an EMULATOR only: physical devices are diagnostic runs and
|
||||
# must be requested explicitly (the developer may be using the phone).
|
||||
SERIAL=$(adb devices | awk 'NR>1 && $2=="device" && $1 ~ /^emulator-/ {print $1; exit}')
|
||||
if [ -z "$SERIAL" ]; then
|
||||
echo "no connected device; pass -s SERIAL" >&2
|
||||
echo "no connected emulator; start one (adb emulator / AVD Manager)" >&2
|
||||
echo "or pass -s <phone serial> for a DIAGNOSTIC (non-gating) run" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
adb() { command adb -s "$SERIAL" "$@"; }
|
||||
|
||||
echo "== profiling on $SERIAL =="
|
||||
case "$SERIAL" in
|
||||
emulator-*) echo "== release-gate profile on emulator $SERIAL ==" ;;
|
||||
*) echo "== DIAGNOSTIC (non-gating) profile on physical device $SERIAL =="
|
||||
echo " (release gate = emulator; this run force-stops the app and"
|
||||
echo " seeds a file in its storage — do not run on a phone in use)" ;;
|
||||
esac
|
||||
adb shell "mkdir -p $PERFDIR $NOTES"
|
||||
adb shell "touch $PERFDIR/enable"
|
||||
adb shell appops set "$PKG" MANAGE_EXTERNAL_STORAGE allow 2>/dev/null || true
|
||||
|
||||
Reference in New Issue
Block a user