forked from firka/flutter
Test codesigning xcframeworks in artifacts (#142666)
On the beta branch: ``` Verifying the code signature of /Users/m/Projects/flutter/bin/cache/artifacts/engine/ios-profile/extension_safe/Flutter.xcframework Verifying the code signature of /Users/m/Projects/flutter/bin/cache/artifacts/engine/ios-profile/Flutter.xcframework Verifying the code signature of /Users/m/Projects/flutter/bin/cache/artifacts/engine/ios/extension_safe/Flutter.xcframework Verifying the code signature of /Users/m/Projects/flutter/bin/cache/artifacts/engine/ios/Flutter.xcframework Verifying the code signature of /Users/m/Projects/flutter/bin/cache/artifacts/engine/ios-release/extension_safe/Flutter.xcframework Verifying the code signature of /Users/m/Projects/flutter/bin/cache/artifacts/engine/ios-release/Flutter.xcframework ``` Fixes https://github.com/flutter/flutter/issues/140934
This commit is contained in:
@@ -11,9 +11,11 @@ import './common.dart';
|
||||
|
||||
void main() async {
|
||||
const String flutterRoot = '/a/b/c';
|
||||
final List<String> allExpectedFiles = await binariesWithEntitlements(flutterRoot) + await binariesWithoutEntitlements(flutterRoot);
|
||||
final List<String> allExpectedFiles = binariesWithEntitlements(flutterRoot) + binariesWithoutEntitlements(flutterRoot);
|
||||
final String allFilesStdout = allExpectedFiles.join('\n');
|
||||
final List<String> withEntitlements = await binariesWithEntitlements(flutterRoot);
|
||||
final List<String> allExpectedXcframeworks = signedXcframeworks(flutterRoot);
|
||||
final String allXcframeworksStdout = allExpectedXcframeworks.join('\n');
|
||||
final List<String> withEntitlements = binariesWithEntitlements(flutterRoot);
|
||||
|
||||
group('verifyExist', () {
|
||||
test('Not all files found', () async {
|
||||
@@ -74,8 +76,8 @@ void main() async {
|
||||
});
|
||||
});
|
||||
|
||||
group('findBinaryPaths', () {
|
||||
test('All files found', () async {
|
||||
group('find paths', () {
|
||||
test('All binary files found', () async {
|
||||
final List<FakeCommand> commandList = <FakeCommand>[];
|
||||
final FakeCommand findCmd = FakeCommand(
|
||||
command: const <String>[
|
||||
@@ -117,7 +119,26 @@ void main() async {
|
||||
final ProcessManager processManager = FakeProcessManager.list(commandList);
|
||||
final List<String> foundFiles = await findBinaryPaths('$flutterRoot/bin/cache', processManager: processManager);
|
||||
expect(foundFiles, <String>[]);
|
||||
});
|
||||
});
|
||||
|
||||
test('All xcframeworks files found', () async {
|
||||
final List<FakeCommand> commandList = <FakeCommand>[
|
||||
FakeCommand(
|
||||
command: const <String>[
|
||||
'find',
|
||||
'$flutterRoot/bin/cache',
|
||||
'-type',
|
||||
'd',
|
||||
'-name',
|
||||
'*xcframework',
|
||||
],
|
||||
stdout: allXcframeworksStdout,
|
||||
)
|
||||
];
|
||||
final ProcessManager processManager = FakeProcessManager.list(commandList);
|
||||
final List<String> foundFiles = await findXcframeworksPaths('$flutterRoot/bin/cache', processManager: processManager);
|
||||
expect(foundFiles, allExpectedXcframeworks);
|
||||
});
|
||||
|
||||
group('isBinary', () {
|
||||
test('isTrue', () async {
|
||||
@@ -223,6 +244,19 @@ void main() async {
|
||||
)
|
||||
);
|
||||
}
|
||||
commandList.add(
|
||||
FakeCommand(
|
||||
command: const <String>[
|
||||
'find',
|
||||
'$flutterRoot/bin/cache',
|
||||
'-type',
|
||||
'd',
|
||||
'-name',
|
||||
'*xcframework',
|
||||
],
|
||||
stdout: allXcframeworksStdout,
|
||||
),
|
||||
);
|
||||
for (final String expectedFile in allExpectedFiles) {
|
||||
commandList.add(
|
||||
FakeCommand(
|
||||
@@ -248,6 +282,18 @@ void main() async {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
for (final String expectedXcframework in allExpectedXcframeworks) {
|
||||
commandList.add(
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
'codesign',
|
||||
'-vvv',
|
||||
expectedXcframework,
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
final ProcessManager processManager = FakeProcessManager.list(commandList);
|
||||
await expectLater(verifySignatures(flutterRoot, processManager: processManager), completes);
|
||||
});
|
||||
@@ -276,6 +322,19 @@ void main() async {
|
||||
)
|
||||
);
|
||||
}
|
||||
commandList.add(
|
||||
FakeCommand(
|
||||
command: const <String>[
|
||||
'find',
|
||||
'$flutterRoot/bin/cache',
|
||||
'-type',
|
||||
'd',
|
||||
'-name',
|
||||
'*xcframework',
|
||||
],
|
||||
stdout: allXcframeworksStdout,
|
||||
),
|
||||
);
|
||||
for (final String expectedFile in allExpectedFiles) {
|
||||
commandList.add(
|
||||
FakeCommand(
|
||||
@@ -300,6 +359,17 @@ void main() async {
|
||||
);
|
||||
}
|
||||
}
|
||||
for (final String expectedXcframework in allExpectedXcframeworks) {
|
||||
commandList.add(
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
'codesign',
|
||||
'-vvv',
|
||||
expectedXcframework,
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
final ProcessManager processManager = FakeProcessManager.list(commandList);
|
||||
|
||||
expect(
|
||||
|
||||
Reference in New Issue
Block a user