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,46 +491,52 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by ...@@ -491,46 +491,52 @@ 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>{
final FlutterProject projectUnderTest = setupProjectUnderTest(); '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',
pretendPodIsInstalled(); '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",
pretendPodVersionIs('1.10.0'); };
fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile')) possibleErrors.forEach((String errorName, String cocoaPodsError) {
..createSync() testUsingContext('ffi $errorName failure on ARM macOS prompts gem install', () async {
..writeAsStringSync('Existing Podfile'); final FlutterProject projectUnderTest = setupProjectUnderTest();
pretendPodIsInstalled();
fakeProcessManager.addCommands(<FakeCommand>[ pretendPodVersionIs('1.10.0');
const FakeCommand( fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile'))
command: <String>['pod', 'install', '--verbose'], ..createSync()
workingDirectory: 'project/ios', ..writeAsStringSync('Existing Podfile');
environment: <String, String>{
'COCOAPODS_DISABLE_STATS': 'true', fakeProcessManager.addCommands(<FakeCommand>[
'LANG': 'en_US.UTF-8', FakeCommand(
}, command: const <String>['pod', 'install', '--verbose'],
exitCode: 1, workingDirectory: 'project/ios',
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', environment: const <String, String>{
), 'COCOAPODS_DISABLE_STATS': 'true',
const FakeCommand( 'LANG': 'en_US.UTF-8',
command: <String>['which', 'sysctl'], },
), exitCode: 1,
const FakeCommand( stdout: cocoaPodsError,
command: <String>['sysctl', 'hw.optional.arm64'], ),
stdout: 'hw.optional.arm64: 1', const FakeCommand(
), command: <String>['which', 'sysctl'],
]); ),
const FakeCommand(
await expectToolExitLater( command: <String>['sysctl', 'hw.optional.arm64'],
cocoaPodsUnderTest.processPods( stdout: 'hw.optional.arm64: 1',
xcodeProject: projectUnderTest.ios, ),
buildMode: BuildMode.debug, ]);
),
equals('Error running pod install'), await expectToolExitLater(
); cocoaPodsUnderTest.processPods(
expect( xcodeProject: projectUnderTest.ios,
logger.errorText, buildMode: BuildMode.debug,
contains('set up CocoaPods for ARM macOS'), ),
); equals('Error running pod install'),
expect(usage.events, contains(const TestUsageEvent('pod-install-failure', 'arm-ffi'))); );
expect(
logger.errorText,
contains('set up CocoaPods for ARM macOS'),
);
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 {
......
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