Repository navigation
Description
In #134523, I tried to convert
| return Future<Uint8List>.value(configFile.readAsBytesSync()); |
to
return configFile.readAsBytes();However, that leads to a test not terminating:
flutter/packages/flutter_tools/test/commands.shard/hermetic/analyze_continuously_test.dart
Lines 321 to 374 in f7997c5
| testUsingContext('AnalysisService --watch skips errors from non-files', () async { | |
| final BufferLogger logger = BufferLogger.test(); | |
| final Completer<void> completer = Completer<void>(); | |
| final StreamController<List<int>> stdin = StreamController<List<int>>(); | |
| final FakeProcessManager processManager = FakeProcessManager.list( | |
| <FakeCommand>[ | |
| FakeCommand( | |
| command: const <String>[ | |
| 'Artifact.engineDartSdkPath/bin/dart', | |
| '--disable-dart-dev', | |
| 'Artifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot', | |
| '--disable-server-feature-completion', | |
| '--disable-server-feature-search', | |
| '--sdk', | |
| 'Artifact.engineDartSdkPath', | |
| '--suppress-analytics', | |
| ], | |
| stdin: IOSink(stdin.sink), | |
| stdout: ''' | |
| {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}} | |
| {"event":"analysis.errors","params":{"file":"/directoryA/bar","errors":[{"type":"TestError","message":"It's an error.","severity":"warning","code":"500","location":{"file":"/directoryA/bar","startLine":100,"startColumn":5,"offset":0}}]}} | |
| {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}} | |
| ''' | |
| ), | |
| ]); | |
| final Artifacts artifacts = Artifacts.test(); | |
| final AnalyzeCommand command = AnalyzeCommand( | |
| terminal: Terminal.test(), | |
| artifacts: artifacts, | |
| logger: logger, | |
| platform: FakePlatform(), | |
| fileSystem: MemoryFileSystem.test(), | |
| processManager: processManager, | |
| allProjectValidators: <ProjectValidator>[], | |
| suppressAnalytics: true, | |
| ); | |
| await FakeAsync().run((FakeAsync time) async { | |
| final TestFlutterCommandRunner commandRunner = TestFlutterCommandRunner(); | |
| commandRunner.addCommand(command); | |
| unawaited(commandRunner.run(<String>['analyze', '--watch'])); | |
| while (!logger.statusText.contains('analyzed 1 file')) { | |
| time.flushMicrotasks(); | |
| } | |
| completer.complete(); | |
| return completer.future; | |
| }); | |
| expect(logger.statusText, contains('No issues found!')); | |
| expect(logger.errorText, isEmpty); | |
| expect(processManager, hasNoRemainingExpectations); | |
| }); |
It's not obvious to me why this test stops terminating.
My hunch is that because the test code is not yielding anywhere, the async I/O never completes. I've tried adding some yield points in various places, but that didn't help.
No other tests fail, so it looks like the failure is localized to this test.
(Not converting this call to async, seems to have minimal to no impact on the speedup in #134523, so we can land that without converting this I/O. I ran into this because I tried to convert all I/O in the relevant Targets to async.)
Activity
[flutter_tools] Read package_config.json asynchronously in loadPackag…
github-actions commentedon Sep 23, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.