-
Notifications
You must be signed in to change notification settings - Fork 53
Description
I noticed an issue when working with the BuildSettingExtractor repo that we've been having in our projects as well.
When the code signing for the test target is set to
- Team: None
- Signing Certificate: Sign to Run Locally
The tests hang during the start of the tests, and never actually run. This comes down to some issue with the way codesigning works for the test target specifically and seems to be a new issue with Xcode 12.
The annoying part though is that there are no error messages thrown or anything. It just hangs silently, which causes confusion. I was finally able to get a little more detail by running the tests via the command line using:
xcodebuild test -project BuildSettingExtractor.xcodeproj -scheme BuildSettingExtractor -destination 'platform=OS X,arch=x86_64'That does print out an error:
dyld: warning: could not load inserted library '/Users/username/Library/Developer/Xcode/DerivedData/BuildSettingExtractor-gexjqvcazybyggesggvvqlnbhxdm/Build/Products/Debug/BuildSettingExtractor.app/Contents/Frameworks/libXCTestBundleInject.dylib' into hardened process because no suitable image found. Did find:
/Users/username/Library/Developer/Xcode/DerivedData/BuildSettingExtractor-gexjqvcazybyggesggvvqlnbhxdm/Build/Products/Debug/BuildSettingExtractor.app/Contents/Frameworks/libXCTestBundleInject.dylib: code signature in (/Users/username/Library/Developer/Xcode/DerivedData/BuildSettingExtractor-gexjqvcazybyggesggvvqlnbhxdm/Build/Products/Debug/BuildSettingExtractor.app/Contents/Frameworks/libXCTestBundleInject.dylib) not valid for use in process using Library Validation: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)
/Users/username/Library/Developer/Xcode/DerivedData/BuildSettingExtractor-gexjqvcazybyggesggvvqlnbhxdm/Build/Products/Debug/BuildSettingExtractor.app/Contents/Frameworks/libXCTestBundleInject.dylib: stat() failed with errno=1
2020-10-20 08:24:50.415510-0500 BuildSettingExtractor[59650:864840] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
The issue is described in a little more detail here: https://posts.boy.sh/fix-mapped-file-has-no-team-id-xcode
Anyway, for our apps at work, we've decided to set a specific value in the test target's code signing as a workaround. The advantage being that it will at least throw an error for the user to act upon.