From 6c06abbb557672866de5b8ca53f0699dd5af94aa Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Tue, 18 Jun 2024 10:07:21 -0700 Subject: [PATCH] Add test for engine artifact framework permissions (#148786) Framework test to validate the iOS and macOS framework engine artifacts (Flutter.framework and FlutterMacOS.framework) have read and executable permissions. ~~Will fail until https://github.com/flutter/engine/pull/52961 rolls.~~ <-- it rolled https://github.com/flutter/flutter/pull/148819 --- .../ios_content_validation_test.dart | 7 +++---- .../macos_content_validation_test.dart | 20 ++++++++++++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/packages/flutter_tools/test/host_cross_arch.shard/ios_content_validation_test.dart b/packages/flutter_tools/test/host_cross_arch.shard/ios_content_validation_test.dart index 0f7befcac57f..5d43340ef775 100644 --- a/packages/flutter_tools/test/host_cross_arch.shard/ios_content_validation_test.dart +++ b/packages/flutter_tools/test/host_cross_arch.shard/ios_content_validation_test.dart @@ -463,10 +463,9 @@ void main() { ); expect(appCodesign, const ProcessResultMatcher()); - // Check read/write permissions are being correctly set - final String rawStatString = flutterFrameworkDir.statSync().modeString(); - final String statString = rawStatString.substring(rawStatString.length - 9); - expect(statString, 'rwxr-xr-x'); + // Check read/write permissions are being correctly set. + final String statString = flutterFrameworkDir.statSync().mode.toRadixString(8); + expect(statString, '40755'); }); }, skip: !platform.isMacOS, // [intended] only makes sense for macos platform. timeout: const Timeout(Duration(minutes: 10)) diff --git a/packages/flutter_tools/test/host_cross_arch.shard/macos_content_validation_test.dart b/packages/flutter_tools/test/host_cross_arch.shard/macos_content_validation_test.dart index 2ff219c76419..e2ae11e127f7 100644 --- a/packages/flutter_tools/test/host_cross_arch.shard/macos_content_validation_test.dart +++ b/packages/flutter_tools/test/host_cross_arch.shard/macos_content_validation_test.dart @@ -41,7 +41,7 @@ void main() { final Directory tempDir = createResolvedTempDirectorySync('macos_content_validation.'); - // Pre-cache iOS engine Flutter.xcframework artifacts. + // Pre-cache macOS engine FlutterMacOS.xcframework artifacts. final ProcessResult result = processManager.runSync( [ flutterBin, @@ -54,6 +54,17 @@ void main() { expect(result, const ProcessResultMatcher()); expect(xcframeworkArtifact.existsSync(), isTrue); + + final Directory frameworkArtifact = fileSystem.directory( + fileSystem.path.joinAll([ + xcframeworkArtifact.path, + 'macos-arm64_x86_64', + 'FlutterMacOS.framework', + ]), + ); + // Check read/write permissions are set correctly in the framework engine artifact. + final String artifactStat = frameworkArtifact.statSync().mode.toRadixString(8); + expect(artifactStat, '40755'); }); for (final String buildMode in ['Debug', 'Release']) { @@ -164,10 +175,9 @@ void main() { ), ); - // Check read/write permissions are being correctly set - final String rawStatString = outputFlutterFramework.statSync().modeString(); - final String statString = rawStatString.substring(rawStatString.length - 9); - expect(statString, 'rwxr-xr-x'); + // Check read/write permissions are being correctly set. + final String outputFrameworkStat = outputFlutterFramework.statSync().mode.toRadixString(8); + expect(outputFrameworkStat, '40755'); // Check complicated macOS framework symlink structure. final Link current = outputFlutterFramework.childDirectory('Versions').childLink('Current');