@@ -66,7 +66,7 @@ void main() {
6666 messages: containsAll (const < ValidationMessage > [
6767 ValidationMessage .error (
6868 'Downloaded executables cannot execute on host.\n '
69- 'See https://github.com/flutter/flutter/issues/6207 for more information\n '
69+ 'See https://github.com/flutter/flutter/issues/6207 for more information. \n '
7070 'On Debian/Ubuntu/Mint: sudo apt-get install lib32stdc++6\n '
7171 'On Fedora: dnf install libstdc++.i686\n '
7272 'On Arch: pacman -S lib32-gcc-libs\n ' ,
@@ -75,6 +75,49 @@ void main() {
7575 );
7676 });
7777
78+ testWithoutContext ('FlutterValidator shows an error message if Rosetta is needed' , () async {
79+ final FakeFlutterVersion flutterVersion = FakeFlutterVersion (
80+ frameworkVersion: '1.0.0' ,
81+ channel: 'beta' ,
82+ );
83+ final MemoryFileSystem fileSystem = MemoryFileSystem .test ();
84+ final Artifacts artifacts = Artifacts .test ();
85+ final FlutterValidator flutterValidator = FlutterValidator (
86+ platform: FakePlatform (
87+ operatingSystem: 'macos' ,
88+ localeName: 'en_US.UTF-8' ,
89+ environment: < String , String > {},
90+ ),
91+ flutterVersion: () => flutterVersion,
92+ devToolsVersion: () => '2.8.0' ,
93+ userMessages: UserMessages (),
94+ artifacts: artifacts,
95+ fileSystem: fileSystem,
96+ flutterRoot: () => 'sdk/flutter' ,
97+ operatingSystemUtils: FakeOperatingSystemUtils (name: 'macOS' , hostPlatform: HostPlatform .darwin_arm64),
98+ processManager: FakeProcessManager .list (< FakeCommand > [
99+ const FakeCommand (
100+ command: < String > ['Artifact.genSnapshot' ],
101+ exitCode: 1 ,
102+ ),
103+ ])
104+ );
105+ fileSystem.file (artifacts.getArtifactPath (Artifact .genSnapshot)).createSync (recursive: true );
106+
107+ expect (await flutterValidator.validate (), _matchDoctorValidation (
108+ validationType: ValidationType .partial,
109+ statusInfo: 'Channel beta, 1.0.0, on macOS, locale en_US.UTF-8' ,
110+ messages: containsAll (const < ValidationMessage > [
111+ ValidationMessage .error (
112+ 'Downloaded executables cannot execute on host.\n '
113+ 'See https://github.com/flutter/flutter/issues/6207 for more information.\n '
114+ 'Flutter requires the Rosetta translation environment on ARM Macs. Try running:\n '
115+ ' sudo softwareupdate --install-rosetta --agree-to-license\n '
116+ ),
117+ ])),
118+ );
119+ });
120+
78121 testWithoutContext ('FlutterValidator does not run gen_snapshot binary check if it is not already downloaded' , () async {
79122 final FakeFlutterVersion flutterVersion = FakeFlutterVersion (
80123 frameworkVersion: '1.0.0' ,
@@ -569,6 +612,7 @@ void main() {
569612class FakeOperatingSystemUtils extends Fake implements OperatingSystemUtils {
570613 FakeOperatingSystemUtils ({
571614 required this .name,
615+ this .hostPlatform = HostPlatform .linux_x64,
572616 this .whichLookup,
573617 FileSystem ? fs,
574618 }) {
@@ -587,6 +631,9 @@ class FakeOperatingSystemUtils extends Fake implements OperatingSystemUtils {
587631
588632 @override
589633 final String name;
634+
635+ @override
636+ final HostPlatform hostPlatform;
590637}
591638
592639class FakeThrowingFlutterVersion extends FakeFlutterVersion {
0 commit comments