Add a local replay harness for the Emulator Preview multi-run job - #24
Merged
Conversation
Pushing to see how the preview emulator behaves is a 25-minute round trip. scripts/replay-preview-multirun.sh runs the same boot/snapshot cycles on a dev machine in a few minutes: create the AVD, install the APK with auto-play enabled, play, screenshot, shut down so the emulator writes its quickboot snapshot, and repeat. It reports the app pid per cycle, which is the property the experiment exists to check. It is written for a developer machine rather than a runner, so unlike CI it cannot assume it owns the host: - every adb call is pinned to the emulator it launched. The emulator is identified as the device that appears after launch, not by assuming emulator-5554 -- another emulator may already hold the default ports, and adb may still list a stale entry for one that has exited. If ours never appears and the log shows the console port was taken, it says so instead of driving somebody else's device. - shutdown is scoped to the emulator's own process group. - an AVD that already existed is reused and never deleted; only one the script created is cleaned up, and -k keeps that too. - an existing console auth token is left untouched. README gains the local-replay instructions and an updated CI/CD table: it still described three jobs, and the smoke matrix had grown to cover API 37.0 and 37.1 across two GPU backends and both channels.
…down A cycle that failed part-way left the emulator running, and the script went straight to removing the AVD. The emulator was still writing, so it recreated the directory after the delete -- leaving an .avd with no .ini, which the next run then reused and could not boot. Take the emulator down and wait for its process group before reporting or removing anything, and keep the AVD if it somehow will not stop. Treat an .avd/.ini pair that is missing one half as incomplete: say so and replace it, rather than trying to boot it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
scripts/replay-preview-multirun.shreplays the Emulator Preview multi-run CI job locally. Same boot/snapshot cycles, a few minutes instead of a ~25 minute push round trip:It reports the app pid per cycle — identical from cycle 2 on means the app survived every snapshot restore, which is the property the experiment exists to check.
Written for a dev machine, not a runner
CI can assume it owns the host. A laptop cannot, so:
emulator-5554. Another emulator may already hold the default ports, and adb may still list a stale entry for one that has exited. If ours never appears and the log shows the console port was taken, it reports that instead of driving someone else's device.-kkeeps that too.README
Updated the CI/CD section: it still described three jobs (there are six), and the smoke matrix had grown to API 37.0 + 37.1 across two GPU backends and both channels. Added the three experiment jobs, the shared composite action, and the local-replay instructions.
Verification
qemu-imgsnapshot table populated.-a "",-a ../evil,-n abc,-n 0without touching any AVD.HOME: reused, reported, and left intact.tail -1approach hijacked a foreign device in the stale-entry case; the new logic errors cleanly.The last one was not hypothetical — a concurrent emulator on 5554 during testing is exactly how the bug surfaced.
Not included
avd pausebefore the exit screenshot, which would have removed the few seconds of drift between the screenshot and the snapshot: the console advertises it underhelp avdbut the current preview build answersKO: not implemented, and the guest keeps running through it. Worth revisiting when it lands.