Skip to content

fix(desktop): Keep an open log stream on desktop for integration testing. - #189192

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
fuzzybinary:135673-multiple-integration-test-fix
Aug 5, 2026
Merged

auto-submit[bot] merged 3 commits into
flutter:masterfrom
fuzzybinary:135673-multiple-integration-test-fix

Conversation

@fuzzybinary

@fuzzybinary fuzzybinary commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

When attempting to test multiple integration tests, the DesktopLogReader would cause a failure because DesktopLogReader._inputController was closed, so a new process couldn't use it.

DesktopLogReader now keeps a persistent log reader per device that isn't closed on process termination, which fixes the issue for integration tests. However, ProtocolDiscovery requires the stream to close to detect that a launched process exited without providing a VM Service. This introduces SingleLaunchLogReader, which is specifically used for VM discovery, to satisfy that requirement.

This is in line with how Android deals with the same issue.

refs: #135673

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

…ing.

When attempting to test multiple integration tests, the `DesktopLogReader` would cause a failure because `DesktopLogReader._inputController` was closed, so a new process couldn't use it.

`DesktopLogReader` now keeps a persistent log reader per device that isn't closed on process termination, which fixes the issue for integration tests. However, `ProtocolDiscovery` requires the stream to close to detect that a launche dprocess exited without providing a VM Service. This introduces `SingleLaunchLogReader`, which is specifically used for VM discovery, to satisfy that requirement.

This is in line with how Android deals with the same issue.

refs: flutter#135673
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jul 9, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors desktop device logging by decoupling the lifetime of DesktopLogReader from individual process exits, allowing external callers to continuously observe multiple application launches. It introduces SingleLaunchLogReader to handle VM service discovery scoped to a single process launch, and updates FlutterTesterDevice and DesktopDevice accordingly. Unit tests are added to verify these behaviors. Feedback highlights potential unhandled asynchronous errors and missing stream error forwarding in both SingleLaunchLogReader and DesktopLogReader when listening to process output.

Comment thread packages/flutter_tools/lib/src/desktop_device.dart
Comment thread packages/flutter_tools/lib/src/desktop_device.dart

@bkonyi bkonyi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@bkonyi
bkonyi requested a review from chingjun August 5, 2026 15:37
@bkonyi bkonyi added the CICD Run CI/CD label Aug 5, 2026
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Aug 5, 2026
@bkonyi bkonyi added autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD labels Aug 5, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 5, 2026
Merged via the queue into flutter:master with commit 3a1a745 Aug 5, 2026
28 of 29 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants