Pre-run checklist for the iOS battery bench.
Walks through the things that have to be right before locking the screen
and running for 30 minutes. Each check returns :ok | {:error, message}.
Goals:
- Catch the misconfigurations that would invalidate a run before the run starts (saves ~30 min of wasted bench time).
- Tell the user exactly what's wrong and how to fix it.
- Be testable — each check is a pure function returning a tagged result.
Checks performed
- USB / hardware UDID — at least one of: USB-connected device
reachable via
idevice_id -l, or a configured:hw_udid. - App installed — bundle id appears in
xcrun devicectl device info apps. - BEAM reachable — Node.connect succeeds.
- RPC responsive —
rpc.call(node, :erlang, :node, [])returns within 2 seconds. Distinguishes "BEAM up but suspended" from "fully alive". - NIF version —
mob_nif:battery_level/0is exported. (Indicates the installed app build is recent enough.) - Background NIF —
mob_nif:background_keep_alive/0is exported. Required for screen-off bench mode.
Each check is independent — failure in (3) doesn't skip (5); we run them all and report a complete picture.
Summary
Types
Result for a single check.
Functions
Returns true if every result is {:ok, _}. Stricter overall check than
examining individual results — useful for deciding whether to abort.
Format the results as a multi-line string with ✓/✗ markers.
Run all preflight checks and return a list of {name, result} tuples in
the order they were run.
Types
Functions
@spec all_ok?([{atom(), check_result()}]) :: boolean()
Returns true if every result is {:ok, _}. Stricter overall check than
examining individual results — useful for deciding whether to abort.
@spec pretty([{atom(), check_result()}]) :: String.t()
Format the results as a multi-line string with ✓/✗ markers.
@spec run(keyword()) :: [{atom(), check_result()}]
Run all preflight checks and return a list of {name, result} tuples in
the order they were run.
Common options:
:platform—:ios(default) or:android— selects platform-specifichardwareandapp_installedchecks:node— node atom (required for BEAM checks):cookie— cookie atom:bundle_id— app bundle id:host— IP/host for EPMD (default: derive from node):require_keep_alive— boolean, default true (set false for screen-on bench)
iOS-specific:
:device_id— devicectl identifier (CoreDevice UUID):hw_udid— hardware UDID for USB checks
Android-specific:
:adb_serial— ADB serial / IP:port foradbchecks