-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Open
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-iosiOS applications specificallyiOS applications specificallyteam-iosOwned by iOS platform teamOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamTriaged by iOS platform team
Description
iOS engine device tests pass on a simulator, but fail on a real device.
Steps to reproduce
- Build
ios_debug_unoptandios_test_flutter
$ ./flutter/tools/gn --no-goma --unoptimized --ios && ninja -C out/ios_debug_unopt ios_test_flutter
- Open in Xcode
$ open flutter/testing/ios/IosUnitTests/IosUnitTests.xcodeproj
- Replace contents of FlutterEngineConfig.xcconfig
FLUTTER_ENGINE=ios_debug_unopt
- Set signing team in both targets, run unit tests on real (not simulator) iPhone, see it crash:
2021-08-04 17:16:10.060629-0700 IosUnitTests[5916:8586338] Failed to load test bundle from file:///private/var/containers/Bundle/Application/26CD81D5-0183-43CD-802D-1F5278BABB72/IosUnitTests.app/PlugIns/IosUnitTestsTests.xctest/: Error Domain=NSCocoaErrorDomain Code=3587 "dlopen_preflight(/var/containers/Bundle/Application/26CD81D5-0183-43CD-802D-1F5278BABB72/IosUnitTests.app/PlugIns/IosUnitTestsTests.xctest/IosUnitTestsTests): Library not loaded: @rpath/Frameworks/libocmock_shared.dylib
Referenced from: /var/containers/Bundle/Application/26CD81D5-0183-43CD-802D-1F5278BABB72/IosUnitTests.app/PlugIns/IosUnitTestsTests.xctest/IosUnitTestsTests
Reason: image not found" UserInfo={NSLocalizedFailureReason=The bundle is damaged or missing necessary resources., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/var/containers/Bundle/Application/26CD81D5-0183-43CD-802D-1F5278BABB72/IosUnitTests.app/PlugIns/IosUnitTestsTests.xctest/IosUnitTestsTests, NSDebugDescription=dlopen_preflight(/var/containers/Bundle/Application/26CD81D5-0183-43CD-802D-1F5278BABB72/IosUnitTests.app/PlugIns/IosUnitTestsTests.xctest/IosUnitTestsTests): Library not loaded: @rpath/Frameworks/libocmock_shared.dylib
Referenced from: /var/containers/Bundle/Application/26CD81D5-0183-43CD-802D-1F5278BABB72/IosUnitTests.app/PlugIns/IosUnitTestsTests.xctest/IosUnitTestsTests
Reason: image not found, NSBundlePath=/var/containers/Bundle/Application/26CD81D5-0183-43CD-802D-1F5278BABB72/IosUnitTests.app/PlugIns/IosUnitTestsTests.xctest, NSLocalizedDescription=The bundle “IosUnitTestsTests” couldn’t be loaded because it is damaged or missing necessary resources.}
2021-08-04 17:16:11.006344-0700 IosUnitTests[5916:8586338] The bundle “IosUnitTestsTests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2021-08-04 17:16:11.006578-0700 IosUnitTests[5916:8586338] (dlopen_preflight(/var/containers/Bundle/Application/26CD81D5-0183-43CD-802D-1F5278BABB72/IosUnitTests.app/PlugIns/IosUnitTestsTests.xctest/IosUnitTestsTests): Library not loaded: @rpath/Frameworks/libocmock_shared.dylib
Referenced from: /var/containers/Bundle/Application/26CD81D5-0183-43CD-802D-1F5278BABB72/IosUnitTests.app/PlugIns/IosUnitTestsTests.xctest/IosUnitTestsTests
Reason: image not found)
The same tests pass on a simulator.
A few problems here:
- The dylibs aren't actually being embedded in the app. However, the same problem persists when I fix that.
xcode_frameworks_dir="${TARGET_BUILD_DIR}/${PlugIns/IosUnitTestsTests.xctest/Frameworks/}"
should be:
xcode_frameworks_dir="${TARGET_BUILD_DIR}/${PLUGINS_FOLDER_PATH}/IosUnitTestsTests.xctest/Frameworks/"
- When I set
DYLD_PRINT_LIBRARIES=1in the scheme environment variables I can see that the dylib still doesn't load, same crash. - dylibs aren't supported on iOS and therefore don't load. "Dynamic libraries outside of a framework bundle, which typically have the file extension .dylib, are not supported on iOS, watchOS, or tvOS, except for the system Swift libraries provided by Xcode."
https://developer.apple.com/library/archive/technotes/tn2435/_index.html
libocmock_shared.dylib and libios_test_flutter.dylib instead should be generated as framework bundles.
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-iosiOS applications specificallyiOS applications specificallyteam-iosOwned by iOS platform teamOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamTriaged by iOS platform team