@@ -66,7 +66,7 @@ void main() {
66
66
messages: containsAll (const < ValidationMessage > [
67
67
ValidationMessage .error (
68
68
'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 '
70
70
'On Debian/Ubuntu/Mint: sudo apt-get install lib32stdc++6\n '
71
71
'On Fedora: dnf install libstdc++.i686\n '
72
72
'On Arch: pacman -S lib32-gcc-libs\n ' ,
@@ -75,6 +75,49 @@ void main() {
75
75
);
76
76
});
77
77
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
+
78
121
testWithoutContext ('FlutterValidator does not run gen_snapshot binary check if it is not already downloaded' , () async {
79
122
final FakeFlutterVersion flutterVersion = FakeFlutterVersion (
80
123
frameworkVersion: '1.0.0' ,
@@ -569,6 +612,7 @@ void main() {
569
612
class FakeOperatingSystemUtils extends Fake implements OperatingSystemUtils {
570
613
FakeOperatingSystemUtils ({
571
614
required this .name,
615
+ this .hostPlatform = HostPlatform .linux_x64,
572
616
this .whichLookup,
573
617
FileSystem ? fs,
574
618
}) {
@@ -587,6 +631,9 @@ class FakeOperatingSystemUtils extends Fake implements OperatingSystemUtils {
587
631
588
632
@override
589
633
final String name;
634
+
635
+ @override
636
+ final HostPlatform hostPlatform;
590
637
}
591
638
592
639
class FakeThrowingFlutterVersion extends FakeFlutterVersion {
0 commit comments