Unverified Commit f7bd20fc authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Detect additional ARM ffi CocoaPods error (#94385)

parent e05ddcbd
...@@ -360,8 +360,7 @@ class CocoaPods { ...@@ -360,8 +360,7 @@ class CocoaPods {
' pod repo update\n', ' pod repo update\n',
emphasis: true, emphasis: true,
); );
} else if (stdout.contains('Init_ffi_c') && } else if (stdout.contains('ffi_c.bundle') && stdout.contains('LoadError') &&
stdout.contains('symbol not found') &&
_operatingSystemUtils.hostPlatform == HostPlatform.darwin_arm) { _operatingSystemUtils.hostPlatform == HostPlatform.darwin_arm) {
// https://github.com/flutter/flutter/issues/70796 // https://github.com/flutter/flutter/issues/70796
UsageEvent( UsageEvent(
......
...@@ -491,7 +491,12 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by ...@@ -491,7 +491,12 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
); );
}); });
testUsingContext('ffi failure on ARM macOS prompts gem install', () async { final Map<String, String> possibleErrors = <String, String>{
'symbol not found': 'LoadError - dlsym(0x7fbbeb6837d0, Init_ffi_c): symbol not found - /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle',
'incompatible architecture': "LoadError - (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/lib/ffi_c.bundle' (no such file) - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle",
};
possibleErrors.forEach((String errorName, String cocoaPodsError) {
testUsingContext('ffi $errorName failure on ARM macOS prompts gem install', () async {
final FlutterProject projectUnderTest = setupProjectUnderTest(); final FlutterProject projectUnderTest = setupProjectUnderTest();
pretendPodIsInstalled(); pretendPodIsInstalled();
pretendPodVersionIs('1.10.0'); pretendPodVersionIs('1.10.0');
...@@ -500,15 +505,15 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by ...@@ -500,15 +505,15 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
..writeAsStringSync('Existing Podfile'); ..writeAsStringSync('Existing Podfile');
fakeProcessManager.addCommands(<FakeCommand>[ fakeProcessManager.addCommands(<FakeCommand>[
const FakeCommand( FakeCommand(
command: <String>['pod', 'install', '--verbose'], command: const <String>['pod', 'install', '--verbose'],
workingDirectory: 'project/ios', workingDirectory: 'project/ios',
environment: <String, String>{ environment: const <String, String>{
'COCOAPODS_DISABLE_STATS': 'true', 'COCOAPODS_DISABLE_STATS': 'true',
'LANG': 'en_US.UTF-8', 'LANG': 'en_US.UTF-8',
}, },
exitCode: 1, exitCode: 1,
stdout: 'LoadError - dlsym(0x7fbbeb6837d0, Init_ffi_c): symbol not found - /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle', stdout: cocoaPodsError,
), ),
const FakeCommand( const FakeCommand(
command: <String>['which', 'sysctl'], command: <String>['which', 'sysctl'],
...@@ -532,6 +537,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by ...@@ -532,6 +537,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
); );
expect(usage.events, contains(const TestUsageEvent('pod-install-failure', 'arm-ffi'))); expect(usage.events, contains(const TestUsageEvent('pod-install-failure', 'arm-ffi')));
}); });
});
testUsingContext('ffi failure on x86 macOS does not prompt gem install', () async { testUsingContext('ffi failure on x86 macOS does not prompt gem install', () async {
final FlutterProject projectUnderTest = setupProjectUnderTest(); final FlutterProject projectUnderTest = setupProjectUnderTest();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment