Repository navigation
test: create an iPhone simulator when the runner has none - #19
Merged
Merged
Conversation
#16's Test on macOS failed on a tuist-macos-26-3 runner whose image has the iOS simulator runtime but no simulators: Xcode listed only the "Any iOS Simulator Device" placeholder. #18 had passed on another runner of the same profile that did have them. When Xcode lists no iPhone, the test now creates one with simctl on the newest iOS runtime installed, using an iPhone model it supports, and asks Xcode again. execute now returns standard output, kept apart from standard error, which drops the temporary log files its callers managed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The message before this PR printed them, and they are what diagnosed #16's failure: they showed the iOS platform installed with no simulator on it. The lookup now returns them alongside the simulator it found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes the "Test on macOS" failure on #16, which comes from the runner, not from #16's README change.
The failure
On one
tuist-macos-26-3runner,xcodebuild -showdestinationslisted only the placeholder for iOS simulators, so the test found no iPhone:That placeholder appears without an error, which means the iOS simulator runtime is installed. There were just no simulators created on that machine. #18 passed on another runner of the same profile that did have them, so the images apparently differ in whether simulators are pre-created.
The fix
When Xcode lists no iPhone, the test now creates one:
simctl create "TestCoverageAttribution iPhone"on the newest iOS runtime fromsimctl list runtimes available --json, with the first iPhone model that runtime supports. It then asks Xcode again, so it still only uses a device the selected Xcode can run. If even that fails, the message includes Xcode's destination list, as it did before, since that list is what diagnosed this failure.executenow returns the process's standard output, kept separate from standard error sosimctl's JSON parses cleanly. Its callers no longer manage temporary log files, which also covers the cleanup the review of #15 noted.Verification
attributesEachTestToTheCountersItMovedpassed on it. I deleted that simulator afterwards.mise run test(8 tests) andmise run lintpass.Once this merges, #16 needs a rebase to pick it up.
Code review
Fixed:
Not changed:
🤖 Generated with Claude Code