pointfreeco / swift-snapshot-testing

📸 Delightful Swift snapshot testing.

Home Page:https://www.pointfree.co/episodes/ep41-a-tour-of-snapshot-testing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Snapshot tests crashes on CircleCI using Xcode 14.2

gutiago opened this issue · comments

Hello team, I am updating the Xcode image on Circle CI for my app, to use Xcode 14.2.
So far, with Xcode 14.0.1 and 14.1, the snapshot tests worked on the cloud.

But I noticed in the Xcode image of Circle CI for 14.2, the snapshot tests are only crashing. The log is showing me this current line in the code.

From initial debugging, it seems the saved image data is not being able to be converted to UIImage.
I'd like to understand with you if you can think of possible scenarios where this could happen. I'm running a little of out ideas about it.

Locally it works fine, but the CI image is somehow causing this effect. I don't know if could be permission related or something else, to make the image not able to be saved and generated later.

Crash log:

Exception Type:  EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: SIGNAL 4 Illegal instruction: 4
Terminating Process: exc handler [11701]
Triggered by Thread:  0

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libswiftCore.dylib                  0x7ff80d789a78 closure #1 in closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) + 456
1   libswiftCore.dylib                  0x7ff80d78978b closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) + 267
2   libswiftCore.dylib                  0x7ff80d78957d closure #1 in _assertionFailure(_:_:file:line:flags:) + 333
3   libswiftCore.dylib                  0x7ff80d7890f5 _assertionFailure(_:_:file:line:flags:) + 309
4   SnapshotTests                  		0x131cfff80 closure #2 in static Diffing<A>.image(precision:perceptualPrecision:scale:) + 256 (UIImage.swift:26)
5   SnapshotTests                  0x131c9380c verifySnapshot<A, B>(matching:as:named:record:snapshotDirectory:timeout:file:testName:line:) + 6540 (AssertSnapshot.swift:266)
6   SnapshotTests                  0x131c91d16 assertSnapshot<A, B>(matching:as:named:record:timeout:file:testName:line:) + 582 (AssertSnapshot.swift:41)
7   SnapshotTests                  0x131c77c6e closure #1 in XCTestCase.verify(_:on:perceptualPrecision:record:file:testName:line:) + 1214 (XCTestCase+Verify.swift:40)
8   SnapshotTests                  0x131c780a6 partial apply for closure #1 in XCTestCase.verify(_:on:perceptualPrecision:record:file:testName:line:) + 70
9   SnapshotTests                  0x131c7853c thunk for @callee_guaranteed () -> () + 12
10  SnapshotTests                  0x131c785a1 thunk for @escaping @callee_guaranteed () -> () + 17
11  UIKitCore                              0x1249119ef +[UIView(Animation) performWithoutAnimation:] + 84
12  SnapshotTests                  0x131c7704a XCTestCase.verify(_:on:perceptualPrecision:record:file:testName:line:) + 906 (XCTestCase+Verify.swift:38)
13  SnapshotTests                  0x131c73e24 XCTestCase.verify(_:on:perceptualPrecision:file:testName:line:) + 292 (XCTestCase+Recording.swift:51)

Any kind of insight would be really appreciated!
Thank you!

It looks like we got the same issue in our project, but we think it is tied to macOS Version rather than Xcode Version. We use our own CI Agents with Xcode 14.0 and just upgrade them to Ventura (13.2.1).

I got the same.

@mfiebig @gutiago Did you find some workaround?

For us an unstable build environment was the root cause. The Swift toolchain crashed because the OS had some inconsistencies.

This is a known architectural issue if your local is Apple Silicon (arm64) and the CI runner is intel or vice versa.