From bbc9d4f3a6aadbb6a440ab44a135aac92a13e628 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 19 Mar 2020 15:01:02 -0700 Subject: [PATCH] Do not check the executable status of gen_snapshot if it has not yet been downloaded (#52574) --- packages/flutter_tools/lib/src/doctor.dart | 3 ++- .../test/commands.shard/hermetic/doctor_test.dart | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/flutter_tools/lib/src/doctor.dart b/packages/flutter_tools/lib/src/doctor.dart index 5a84f5e7ad5..cbe777df197 100644 --- a/packages/flutter_tools/lib/src/doctor.dart +++ b/packages/flutter_tools/lib/src/doctor.dart @@ -640,7 +640,8 @@ class FlutterValidator extends DoctorValidator { globals.artifacts.getArtifactPath(Artifact.genSnapshot); // Check that the binaries we downloaded for this platform actually run on it. - if (!_genSnapshotRuns(genSnapshotPath)) { + if (globals.fs.file(genSnapshotPath).existsSync() + && !_genSnapshotRuns(genSnapshotPath)) { final StringBuffer buf = StringBuffer(); buf.writeln(userMessages.flutterBinariesDoNotRun); if (globals.platform.isLinux) { diff --git a/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart index 7365f9017ca..e40f144310c 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart @@ -529,6 +529,16 @@ void main() { Platform: _kNoColorOutputPlatform, }); + testUsingContext('gen_snapshot binary not available', () async { + expect(await FlutterValidatorDoctor().diagnose(verbose: false), isTrue); + // gen_snapshot is downloaded on demand, and the doctor should not + // fail if the gen_snapshot binary is not present. + expect(testLogger.statusText, contains('No issues found!')); + }, overrides: { + FileSystem: () => MemoryFileSystem(), + ProcessManager: () => FakeProcessManager.any(), + }); + testUsingContext('version checking does not work', () async { final VersionCheckError versionCheckError = VersionCheckError('version error');