diff --git a/dev/conductor/core/lib/src/codesign.dart b/dev/conductor/core/lib/src/codesign.dart index 4871075d12..1455740857 100644 --- a/dev/conductor/core/lib/src/codesign.dart +++ b/dev/conductor/core/lib/src/codesign.dart @@ -75,6 +75,10 @@ class CodesignCommand extends Command { FrameworkRepository get framework { return _framework ??= FrameworkRepository( checkouts, + upstreamRemote: Remote( + name: RemoteName.upstream, + url: argResults![kUpstream] as String, + ), ); } diff --git a/dev/conductor/core/test/codesign_test.dart b/dev/conductor/core/test/codesign_test.dart index 2bbf122b02..9c246f9ae9 100644 --- a/dev/conductor/core/test/codesign_test.dart +++ b/dev/conductor/core/test/codesign_test.dart @@ -167,6 +167,96 @@ void main() { expect(stdio.stdout, contains('Verified that binaries are codesigned and have expected entitlements')); }); + test('framework cloned from repo provided by --$kUpstream', () async { + const String upstreamRepo = 'https://githost.org/org/project'; + final List codesignCheckCommands = []; + for (final String bin in binariesWithEntitlements) { + codesignCheckCommands.add( + FakeCommand( + command: ['codesign', '-vvv', bin], + ), + ); + codesignCheckCommands.add( + FakeCommand( + command: ['codesign', '--display', '--entitlements', ':-', bin], + stdout: expectedEntitlements.join('\n'), + ), + ); + } + for (final String bin in binariesWithoutEntitlements) { + codesignCheckCommands.add( + FakeCommand( + command: ['codesign', '-vvv', bin], + ), + ); + } + createRunner(commands: [ + const FakeCommand(command: [ + 'git', + 'clone', + '--origin', + 'upstream', + '--', + upstreamRepo, + '${checkoutsParentDirectory}flutter_conductor_checkouts/framework', + ]), + const FakeCommand(command: [ + 'git', + 'checkout', + FrameworkRepository.defaultBranch, + ]), + const FakeCommand(command: [ + 'git', + 'rev-parse', + 'HEAD', + ], stdout: revision), + const FakeCommand(command: [ + 'git', + 'checkout', + revision, + ]), + const FakeCommand(command: [ + flutterBin, + 'help', + ]), + const FakeCommand(command: [ + flutterBin, + 'help', + ]), + const FakeCommand(command: [ + flutterBin, + 'precache', + '--android', + '--ios', + '--macos', + ]), + FakeCommand( + command: const [ + 'find', + '${checkoutsParentDirectory}flutter_conductor_checkouts/framework/bin/cache', + '-type', + 'f', + ], + stdout: allBinaries.join('\n'), + ), + for (String bin in allBinaries) + FakeCommand( + command: ['file', '--mime-type', '-b', bin], + stdout: 'application/x-mach-binary', + ), + ...codesignCheckCommands, + ]); + await runner.run([ + 'codesign', + '--$kVerify', + '--$kRevision', + revision, + '--$kUpstream', + upstreamRepo, + ]); + expect(processManager, hasNoRemainingExpectations); + expect(stdio.stdout, contains('Verified that binaries for commit $revision are codesigned and have expected entitlements')); + }); test('succeeds if every binary is codesigned and has correct entitlements', () async { final List codesignCheckCommands = [];