Closed UnsafePointer closed 7 years ago
A Simulator in state creating
cannot be deleted, it must be in state shutdown
. This limitation comes from the simctl
command line tool that is executed by the simctl
gem.
I'd wonder why in your teardown
method the Simulator is in state creating
. In your setup
method you were waiting for the state :booted
before you continue. So in the teardown method it's weird that the same Simulator is suddenly in state :creating
. Is it by any chance not the Simulator you expect you're working with?
simulator = SimCtl.device(name: "Unit Tests @ #{hash['name']} #{hash['OS']}")
This will fetch the first Simulator that matches this name! You can have multiple Simulator with the same name. So if there's another process on the same system creating a Simulator with this name at the same time when your teardown
method is running, you might end up with a different Simulator than your setup
method created.
In general I recommend isolating CI jobs with different device set paths. You could have a different one per job, for example.
Sorry for the late follow up! I blame GitHub notifications 😣 Could you elaborate on the device set paths? Not sure what you mean. Can I change the location of the iOS simulator?
Try this: xcrun simctl --set /tmp/simulators ...
- the path must exist, so you might want to do a mkdir /tmp/simulators
before.
Is there a way to pass a device set to a plain xcodebuild test-without-building
command? I tried to find how you do that in plu/pxctest but looks like it's using FBSimulatorControl (and private APIs) for that.
Is there a way to pass a device set to a plain xcodebuild test-without-building command?
As far is I know that's not possible, unfortunately.
Thanks for the help! The suggestion mentioned above help us to trace down the issue, it was in fact a node having more than one simulator named the same.
I'm closing this issue as this was not a problem with simctl
but with our usage.
Not sure if this is a simctl problem or something with the Simulator.app or CoreSimulatorService itself. Sometimes when we try to delete simulators we run into the following error:
This is more or less how we setup/tear down simulators: