Commit 2c3ac47aa0
2c3ac47aa06090c68c7e421c6f9a17509d7f331a
parent: 3a99d7a208
Unsigned
cmc <hello@cleberg.net> · 2026-10-24 21:16 UTC
Wait for the simulator to boot before running tests (!24)
E2's actual mechanism, and the fix.
A cold simulator races its own boot. `xcodebuild` boots the device itself, then
sometimes tries to launch the test host before it is ready:
```
Simulator device failed to launch net.cleberg.DomainDig.
Error Domain=NSPOSIXErrorDomain Code=3 "No such process"
Application launch for 'net.cleberg.DomainDig' did not return a process handle
```
No test reports, and `xcodebuild` sits for about 380 seconds before calling it
a failure. `run_tier`'s `grep` keeps only test results and compiler errors, so
the launch error is dropped and what reaches the console is a bare
`** TEST FAILED **` with no failing test — which reads as a broken change
rather than a broken harness.
`simctl bootstatus -b` boots the device if needed and blocks until it is ready.
## Measured, same commit each time
| device state | result |
|---|---|
| already booted | 225 passed, 28 s |
| cold, `xcodebuild` boots it | launch failure, no tests, 380 s |
| `simctl bootstatus -b` first | 225 passed, 34 s |
| both tiers from cold, with this fix | 225 passed on each, one invocation |
## Two corrections to how E2 was written up
It is not specific to the second tier of a pair — a single `xcodebuild test`
invocation fails the same way. And `xcrun simctl shutdown all` between runs,
which I had been doing as cleanup, *caused* it by guaranteeing a cold boot
every time.
`IDESchemeActionSDKRecord: ... invalidDigitCount`, which I had noted as
appearing at the point of failure, is unrelated: it appears in passing runs too.
Layout: unified · split
Scripts/test.sh
+9
| @@ -61,6 +61,15 @@ run_tier() { |
| 61 | 61 | echo " deployment target, so this is not true floor coverage." |
| 62 | 62 | fi |
| 63 | 63 | |
| 64 | # Boot and wait before handing the destination to xcodebuild. Left to |
| 65 | # xcodebuild, a cold device races its own boot: the test host fails to launch |
| 66 | # with "Application launch did not return a process handle" (NSPOSIXErrorDomain |
| 67 | # Code=3), no test reports, and the run stalls about 380 seconds before it |
| 68 | # calls that a failure. `bootstatus -b` boots if needed and blocks until the |
| 69 | # device is ready, which is the whole fix. |
| 70 | echo " booting and waiting for the device" |
| 71 | xcrun simctl bootstatus "$udid" -b > /dev/null 2>&1 || true |
| 72 | |
| 64 | 73 | set -o pipefail |
| 65 | 74 | xcodebuild test \ |
| 66 | 75 | -project "$PROJECT" \ |