64bit vs 32bit simulator

I am running tests inside of bitrise that utilize FBSnapshotTestCase and when the tests are run locally they run in a 64 bit simulator, but inside of bitrise they sometimes run on a 32 bit simulator and the reference images cannot be found since 32 or 64 is appended to the folders directory that the images are in.

Is there a way to make sure tests run inside of a 64bit simulator?

Thanks,
Alex Hartwell

Hi @SWARM,

Thanks for asking this here! :wink:

Why do you think it’s running in 32 bit simulator?

So, the thing is, there’s no such thing as “bitrise iOS simulator” or similar. The Xcode Test step runs the test through Xcode’s command line tool (xcodebuild test .. - you can see the command it runs in the step’s log). Which simulator is selected is up to Xcode.

Now the thing about the iOS Simulators: whether it’s a 32 bit or 64 bit Simulator/environment depends on the iOS device you select. iPhones up to iPhone 5 were 32 bit, and since iPhone 5S all iPhones are 64 bit.

To specify which device the test should run in, you can set that with the Device (simulator_device) option of the Xcode Test step. If you specify iPhone 5 there, that will be 32-bit, because iPhone 5 is 32-bit. If you specify iPhone 6 there, that will be 64 bit, as iPhone 6 is 64 bit.

I hope this helps, feel free to ask if you have any questions!

@viktorbenei I think it’s running in a 32 bit simulator because the error I get when running the FBSnapshotTestCase tests says it is looking for the images in a folder with 32 appended to it, when on my local machine it looks inside of a 64 folder. It is set to run on an iPhone 7 simulator so that is interesting that I am running into this. It may be an issue with snapshot test case

1 Like

I’d say that’s most likely the case. You might want to try to use a newer version of fbsnapshot, might help.

If you can figure it out please let us know, I’m sure it’ll help others in the future too!
And if you’d have any questions feel free to ask here! :wink:

I still don’t know exactly what was causing the failure, I think it is some difference in build tool versions, os versions, etc between my local machine and the bitrise machine that is causing the rendering inside of FBSnapshot to differ slightly. But setting a tolerance of a few percent in the verify view method allowed the tests to pass.

I am planning on investigating more when I have time and will update this thread with any findings

1 Like

Thanks in advance, and let us know if we can help with anything!

It could be font kerning between iOS versions, or even device models.

Also, FBSnapshotTestCase is stupid. If your 64-bit image fails to match, it will re-attempt using the 32-bit image, which you probably don’t have (nobody does!) and then logs a message about the file missing. Just ignore those. It’s a sign that your 64-bit image didn’t match.

I just started using FBSnapshotTestCase on Bitrise (I’ve used it on Jenkins and Buddybuild with success) and am having matching problems. Now I need to figure out how to see the diffs.

Wow, that’s indeed quite strange.

Let us know if we can help with anything! :wink:

Thanks! I figured it out.

TIME ZONES

1 Like

Nice catch @rwalberg! :wink:

Thanks!

If anyone stumbles across this thread, the first thing you want to do is add a Bitrise Deploy step with compress for recursion that points to your snapshot diff directory, so you can find out what’s different.

To fix the timezone issue, add a Script step before the build that does this:

sudo systemsetup -settimezone America/Toronto
(replace the timezone with the one you recorded the snapshots with)

Better yet, don’t rely on timezones in your test, but sometimes it’s harder than it sounds.

1 Like

Completely agree and thanks for sharing the details, I’m sure it’ll help others! :wink: