Conversation
packages/devtools_app_shared/test/service/isolate_manager_test.dart
Outdated
Show resolved
Hide resolved
packages/devtools_app_shared/test/service/isolate_manager_test.dart
Outdated
Show resolved
Hide resolved
packages/devtools_app_shared/test/service/isolate_manager_test.dart
Outdated
Show resolved
Hide resolved
packages/devtools_app_shared/lib/src/service/isolate_manager.dart
Outdated
Show resolved
Hide resolved
|
LGTM from me. Will wait for @bkonyi and @jakemac53 to review before landing. |
|
In general I don't love the idea of hard coding an assumption about the test isolate debug names - although there probably isn't a better solution really. What I would do is make a PR to package:test which adds some comments where this is set up, that changing it will break DevTools. |
jakemac53
left a comment
There was a problem hiding this comment.
LGTM if we do the additional PR to add comments into package:test about not changing the debug name
packages/devtools_app_shared/lib/src/service/isolate_manager.dart
Outdated
Show resolved
Hide resolved
Will do |
| // isolate is where user code actually runs. | ||
| // See: https://github.com/flutter/devtools/issues/9747 | ||
| final testSuiteRef = _isolateStates.keys.firstWhereOrNull( | ||
| (IsolateRef ref) => ref.name?.startsWith('test_suite:') ?? false, |
There was a problem hiding this comment.
Is this isolate not marked as a system isolate? Ideally it just wouldn't appear in the isolates list.
There was a problem hiding this comment.
This is the actual test, so it's the thing we do want to find. I don't know if we can make the root isolate (test runner) be not marked as a system isolate. But that is the one we would want to ignore if any probably.
There was a problem hiding this comment.
Right, that makes sense. If we mark the main isolate as a system isolate, I'm not sure we'll need this change. We already do it for package:test via dart test, so we should probably make a similar change in flutter_tester to set the main isolate as a system isolate.
There was a problem hiding this comment.
If we can achieve the same result that way it would definitely be preferable to matching based on debug name and other heuristics
Fixes #9747
When DevTools connects to a test run, three isolates are present: the test runner (
main), the test suite isolate where user code actually runs (test_suite:...), andvm-service. Previously, DevTools fell through to selecting the first isolate (main) as a fallback, so CPU profiling and other tools showed no data and the user's test code was running in a completely different isolate.This changes
_computeMainIsolateinIsolateManagerto prefer thetest_suite:isolate when no Flutter extension or:main(isolate is found. Thetest_suite:prefix is set as adebugNamebypackage:test_corewhen it spawns each test suite isolate, making it a reliable signal to detect test runs.Before: CPU profiler showed empty results when connected to a test run.
After: CPU profiler correctly captures samples from the test suite isolate.
Pre-launch Checklist
General checklist
///).Issues checklist
contributions-welcome] or [good-first-issue] label.contributions-welcome] or [good-first-issue] label. I understand this means my PR might take longer to be reviewed.Tests checklist
AI-tooling checklist
Feature-change checklist
release-notes-not-requiredlabel or left a comment requesting the label be added.packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md.