-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix skwasm tests #145570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix skwasm tests #145570
Conversation
|
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. Changes reported for pull request #145570 at sha 09c677cd50733fdb8463c864f6c134891beac9ff |
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. Changes reported for pull request #145570 at sha d691bf354ae49a4571e711f8809d8596c2381a9e |
c108806 to
e59a641
Compare
ditman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing jumps to me as totally egregious. (The bulk of the PR comes from the isSkiaWeb-related test skips.)
| @JS('window.flutterCanvasKit') | ||
| external JSAny? get _windowFlutterCanvasKit; | ||
|
|
||
| @JS('window._flutter_skwasmInstance') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mix of cases here is a little alarming... should this be either _flutterSkwasmInstance or _flutter_skwasm_instance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I just realized we're in the wrong repo to be discussing this :) )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this would need to change at the engine level. Yeah maybe the case mixing is weird.
| // These tests are broken and need to be fixed. | ||
| // TODO(jacksongardner): https://github.com/flutter/flutter/issues/71604 | ||
| 'test/material/text_field_test.dart', | ||
| 'test/widgets/performance_overlay_test.dart', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how the performance_overlay_test is breaking, but it might just be failing on detecting that the web doesn't have a performance_overlay (?) #52258 (and others)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The basic difference here is that the HTML renderer silently does nothing when the performance overlay is enabled, and the canvaskit and skwasm renderers actually throw. I think it's fine to just skip it this way for now, since that's what we're doing with CanvasKit.
|
|
||
| extension on web.HTMLCollection { | ||
| Iterable<web.Element> get iterable => _genIterable(this); | ||
| Iterable<web.Element?> get iterable => Iterable<web.Element?>.generate(length, (int index) => item(index)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these iterable of nullable values? (also on CSSRuleList below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because collections like these can theoretically have holes in them with undefined in there (yay JavaScript) so item(index) has a nullable return. We do the null assertions inside the test, which feels like the appropriate place.
|
|
||
| // Wait for any pending shader compilation. | ||
| tester.pumpAndSettle(); | ||
| await tester.pumpAndSettle(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catches!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test harness actually caught this! The widgets test binding has some code that guards against async stuff escaping outside of the test. For whatever reason, it didn't trigger in DDC, but running in dart2wasm triggered the async guard.
| /// Returns true if the application is using CanvasKit or Skwasm. | ||
| /// | ||
| /// Only to be used for web. | ||
| bool get isSkiaWeb => isCanvasKit || isSkwasm; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is bloating the PR quite a bit (I suppose everywhere we check isCanvasKit now we check isSkiaWeb?)
I wonder if this would be much simpler if:
isCanvasKit => capabilities.isCanvasKit || capabilities.isSkwasm;
And
isSkwasm => capabilities.isSkwasm;
To separate the global "canvaskit" from the skwasm-specific cases?
I mean, the capabilities of the renderer are similar, aren't they?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Essentially I'm doing a rename of the variable to be more accurate. I don't think we should have a variable called isCanvasKit that is true when the renderer is skwasm, that's just confusing. Hence, we have three separate explicit variables. Minimizing the number of lines changed in this particular PR is a non-goal, I'd rather the code be more clear.
Co-authored-by: David Iglesias <[email protected]>
ditman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If CI is happy, I don't have more to say!
flutter/flutter@4967a94...97cd47a 2024-04-10 [email protected] Roll Flutter Engine from eaf73cd39cf8 to cee489a4e275 (2 revisions) (flutter/flutter#146541) 2024-04-10 [email protected] Roll Flutter Engine from e4e274898efc to eaf73cd39cf8 (6 revisions) (flutter/flutter#146538) 2024-04-09 [email protected] Correct doc for AnimationMin (flutter/flutter#146531) 2024-04-09 [email protected] Roll Flutter Engine from 5dca50d3e268 to e4e274898efc (2 revisions) (flutter/flutter#146527) 2024-04-09 49699333+dependabot[bot]@users.noreply.github.com Bump codecov/codecov-action from 4.2.0 to 4.3.0 (flutter/flutter#146528) 2024-04-09 [email protected] Fix InputDecorator label position ignore visual density (flutter/flutter#146488) 2024-04-09 [email protected] Roll Flutter Engine from 5a824e22deb2 to 5dca50d3e268 (10 revisions) (flutter/flutter#146524) 2024-04-09 [email protected] Support mdns when attaching to proxied devices. (flutter/flutter#146021) 2024-04-09 [email protected] Fix skwasm tests (flutter/flutter#145570) 2024-04-09 [email protected] Roll pub packages (flutter/flutter#146515) 2024-04-09 [email protected] Roll Packages from 6b4d8b6 to 17f55d3 (6 revisions) (flutter/flutter#146508) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Skwasm tests are now running as `bringup: true` in postsubmit, but failing. Let's get them fixed.
flutter/flutter@4967a94...97cd47a 2024-04-10 [email protected] Roll Flutter Engine from eaf73cd39cf8 to cee489a4e275 (2 revisions) (flutter/flutter#146541) 2024-04-10 [email protected] Roll Flutter Engine from e4e274898efc to eaf73cd39cf8 (6 revisions) (flutter/flutter#146538) 2024-04-09 [email protected] Correct doc for AnimationMin (flutter/flutter#146531) 2024-04-09 [email protected] Roll Flutter Engine from 5dca50d3e268 to e4e274898efc (2 revisions) (flutter/flutter#146527) 2024-04-09 49699333+dependabot[bot]@users.noreply.github.com Bump codecov/codecov-action from 4.2.0 to 4.3.0 (flutter/flutter#146528) 2024-04-09 [email protected] Fix InputDecorator label position ignore visual density (flutter/flutter#146488) 2024-04-09 [email protected] Roll Flutter Engine from 5a824e22deb2 to 5dca50d3e268 (10 revisions) (flutter/flutter#146524) 2024-04-09 [email protected] Support mdns when attaching to proxied devices. (flutter/flutter#146021) 2024-04-09 [email protected] Fix skwasm tests (flutter/flutter#145570) 2024-04-09 [email protected] Roll pub packages (flutter/flutter#146515) 2024-04-09 [email protected] Roll Packages from 6b4d8b6 to 17f55d3 (6 revisions) (flutter/flutter#146508) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
| /// in tests with [debugDefaultTargetPlatformOverride]. | ||
| /// * [dart:io.Platform], a way to find out the browser's platform that is not | ||
| /// overridable in tests. | ||
| const bool kIsWasm = kIsWeb && bool.fromEnvironment('dart.library.ffi'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dart-lang/sdk@6b71aa1 adds a proper environment variable to detect WASM - is there a difference?
EDIT: Having tested it out, the Dart env var always seems to be false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dart version will only work on Dart SDK version 3.5.0-185.0.dev and above.
I'm guessing that would be a better way to do this, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, tested on .3 (included with latest Flutter beta) (I'm pretty sure at least), but didn't seem to work properly. Maybe I was doing something wrong though? Or there's an issue with its implementation in Dart?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dart dart --version for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't right now, but I'm 99% sure it was that version. I've been tracking that commit (I didn't realise this constant existed) and waiting for it to arrive, and I know for a fact I did a flutter upgrade. So it should be .3 and that should be what's on the Flutter beta atm.
I can try again tomorrow.
Skwasm tests are now running as
bringup: truein postsubmit, but failing. Let's get them fixed.