Skip to content

Conversation

@eyebrowsoffire
Copy link
Contributor

Skwasm tests are now running as bringup: true in postsubmit, but failing. Let's get them fixed.

@github-actions github-actions bot added tool Affects the "flutter" command-line tool. See also t: labels. framework flutter/packages/flutter repository. See also f: labels. a: tests "flutter test", flutter_test, or one of our tests a: text input Entering text in a text field or keyboard related problems f: material design flutter/packages/flutter/material repository. f: scrolling Viewports, list views, slivers, etc. f: cupertino flutter/packages/flutter/cupertino repository f: routes Navigator, Router, and related APIs. labels Mar 21, 2024
@github-actions github-actions bot removed the f: routes Navigator, Router, and related APIs. label Mar 29, 2024
@eyebrowsoffire eyebrowsoffire marked this pull request as ready for review April 8, 2024 18:46
@flutter-dashboard
Copy link

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 package:flutter.

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

@flutter-dashboard flutter-dashboard bot added the will affect goldens Changes to golden files label Apr 8, 2024
@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

For more guidance, visit Writing a golden file test for package:flutter.

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

Copy link
Member

@ditman ditman left a 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')
Copy link
Member

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?

Copy link
Member

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 :) )

Copy link
Contributor Author

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',
Copy link
Member

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)

Copy link
Contributor Author

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));
Copy link
Member

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)

Copy link
Contributor Author

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();
Copy link
Member

Choose a reason for hiding this comment

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

Good catches!

Copy link
Contributor Author

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.

Comment on lines +18 to +21
/// Returns true if the application is using CanvasKit or Skwasm.
///
/// Only to be used for web.
bool get isSkiaWeb => isCanvasKit || isSkwasm;
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

@ditman ditman left a 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!

@eyebrowsoffire eyebrowsoffire added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 9, 2024
@auto-submit auto-submit bot merged commit 51e70fa into flutter:master Apr 9, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 10, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 10, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Apr 10, 2024
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
gilnobrega pushed a commit to gilnobrega/flutter that referenced this pull request Apr 22, 2024
Skwasm tests are now running as `bringup: true` in postsubmit, but failing. Let's get them fixed.
TecHaxter pushed a commit to TecHaxter/flutter_packages that referenced this pull request May 22, 2024
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');
Copy link
Contributor

@JaffaKetchup JaffaKetchup Jun 8, 2024

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?

Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Contributor

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

Copy link
Contributor

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.

@eyebrowsoffire eyebrowsoffire deleted the fix_skwasm_tests branch December 12, 2025 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: tests "flutter test", flutter_test, or one of our tests a: text input Entering text in a text field or keyboard related problems autosubmit Merge PR when tree becomes green via auto submit App f: cupertino flutter/packages/flutter/cupertino repository f: material design flutter/packages/flutter/material repository. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. tool Affects the "flutter" command-line tool. See also t: labels. will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants