Repository navigation
A prelude for the checks: a daemon of its own, one check per device, and cleanup that composes - #157
Merged
Merged
Conversation
…and cleanup that composes Checks shared one daemon. In one evening's sweeps a check left it on the uiautomator backend and every later check inherited it, and one run's daemon stop ended another device's trace. docs/checks/lib.sh, sourced by every check after ROOT, gives each a session of its own (MOBIUM_SESSION, unless the caller set one) stopped at exit; check_lock takes the device and refuses a second check on it, naming the first, takes over a lock whose holder has gone, and lets a check share its caller's; CHECK_TMP is its own folder; at_exit replaces trap ... EXIT, which would have replaced the prelude's own. 57 checks are on it and 56 lock their device. clean-stop.sh (it stops the caller's daemon) and the test-runner, grid and test-ui checks (they test those sessions themselves) are not. lib-selftest.sh runs in make ci: eleven cases without a device, and a check that stops using the prelude or sets its own EXIT trap fails it. Four emulator checks and three simulator checks ran side by side and passed, the emulator's being the chain that once inherited a backend, with nothing left behind; a second check on a busy simulator was refused.
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.
Why
The shell checks in
docs/checksshared one daemon. In the 2026-10-06 sweeps:uiautomatorbackend, and every later check inherited it;daemon stopended a trace another device was recording.Nothing stopped two checks from driving the same device, and each check managed its own
EXITtrap.docs/checks/lib.shEvery check sources it right after setting
ROOT. It gives each check:MOBIUM_SESSION=ck<pid>, stopped at exit, unless the caller set a session (a grid run ormobium test, whose sessions are kept);check_lock "$DEV"refuses a second check on the device, naming the first, and takes over a lock whose holder is gone. A check that runs another (third-party-app.shhanding an iPhone to its iOS half) shares the lock;CHECK_TMP: a folder of its own, removed at exit;at_exit/at_exit_clearin place oftrap … EXIT/trap - EXIT, since a shell has oneEXITtrap. The check's handlers run newest first, before the daemon stops, because they often still need it.Adoption
57 checks source it, and 56 lock their device;
boot.shhas only an AVD name when it starts. Left off on purpose:clean-stop.sh, which stops the caller's daemon;test-runner.sh,test-grid.shandtest-ui.sh, which test the sessionsmobium testand the grid create themselves;ROOT.The 25
trap … EXITlines becameat_exit.Verified
lib-selftest.sh, inmake civiadocs-check: 11 cases with no device (handler order, own and kept sessions, cleanup, exit status, and the lock's refusal, release, stale takeover and sharing). It also fails when a check stops sourcing the prelude or sets its ownEXITtrap; a planted trap was caught.graybox,graybox-edges,keyboardandloginon the Android 15 emulator, alongsideobstruction,feedandloginon the iPhone 17 Pro simulator. All passed, in 234 s of wall clock against about 360 s serially, with no daemon or lock left behind. The emulator chain is the one that inherited a backend before.make cipasses.The checks README gains "Running several at once".