Skip to content

A prelude for the checks: a daemon of its own, one check per device, and cleanup that composes - #157

Merged
lana-20 merged 1 commit into
mainfrom
checks-prelude
Oct 7, 2026
Merged

lana-20 merged 1 commit into
mainfrom
checks-prelude

Conversation

@lana-20

@lana-20 lana-20 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Why

The shell checks in docs/checks shared one daemon. In the 2026-10-06 sweeps:

  • a check left the daemon on the uiautomator backend, and every later check inherited it;
  • one run's daemon stop ended a trace another device was recording.

Nothing stopped two checks from driving the same device, and each check managed its own EXIT trap.

docs/checks/lib.sh

Every check sources it right after setting ROOT. It gives each check:

  • its own daemon: MOBIUM_SESSION=ck<pid>, stopped at exit, unless the caller set a session (a grid run or mobium test, whose sessions are kept);
  • one check per device: 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.sh handing an iPhone to its iOS half) shares the lock;
  • CHECK_TMP: a folder of its own, removed at exit;
  • at_exit / at_exit_clear in place of trap … EXIT / trap - EXIT, since a shell has one EXIT trap. 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.sh has 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.sh and test-ui.sh, which test the sessions mobium test and the grid create themselves;
  • the three scripts with no ROOT.

The 25 trap … EXIT lines became at_exit.

Verified

  • lib-selftest.sh, in make ci via docs-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 own EXIT trap; a planted trap was caught.
  • In parallel: graybox, graybox-edges, keyboard and login on the Android 15 emulator, alongside obstruction, feed and login on 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.
  • A second check on a busy simulator was refused: "in use by another check (obstruction.sh, pid …)".
  • make ci passes.

The checks README gains "Running several at once".

…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.
@lana-20
lana-20 merged commit a8e5d45 into main Oct 7, 2026
5 checks passed
@lana-20
lana-20 deleted the checks-prelude branch October 7, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant