Skip to content

Conversation

@jonahwilliams
Copy link
Contributor

If you run the tests in profile mode, this will fail due to the null check. Since we don't explicitly disallow profile mode in tests, I would prefer to keep it working - and if we decided to stop supporting it that can be an intention rather than accidental decision

@flutter-dashboard flutter-dashboard bot added the framework flutter/packages/flutter repository. See also f: labels. label Jan 12, 2022
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@jonahwilliams
Copy link
Contributor Author

@Hixie for lack of tests....

assert(() {
Map<GlobalKey, Set<Element>>? duplicates;
for (final Element element in _debugIllFatedElements!) {
for (final Element element in _debugIllFatedElements ?? <Element>{}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

const?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@Hixie
Copy link
Contributor

Hixie commented Jan 12, 2022

If you want profile builds to be testable, I strongly recommend actually testing it. Right now they only work by pure chance (and sometimes don't work because we assume e.g. that kDebugMode matches when assert() is called). The only reason they work at all right now is that Google's internal tests rely on it in a couple of places. Several times we've broken those tests by mistake. If those tests go away (and I think that's quite possible) then the next time we break it we may not notice.

@jonahwilliams
Copy link
Contributor Author

Fair enough - I think the plan might be (@dnfield ) to remove support for profile mode with asserts. I think the challenge with testing this configuration is that we may not have any tooling in flutter/flutter that supports building profile with asserts enabled. (at least not since I last looked at the tool..)

@dnfield
Copy link
Contributor

dnfield commented Jan 12, 2022

I filed #96552 to track

@jonahwilliams
Copy link
Contributor Author

I could write a devicelab test that asserts that it works, then @dnfield could later change it to assert failure.

@jonahwilliams
Copy link
Contributor Author

actually I don't need devicelab, I can use a similar hack to test_release. tests added

@jonahwilliams
Copy link
Contributor Author

Without the change to framework.dart, the test fails with:

PS C:\Users\Jonah\flutter\packages\flutter> flutter test --dart-define=dart.vm.profile=true .\test_profile\
00:05 +0: Can build widget tree in profile mode with asserts enabled
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
════════════════════════════════════════════════════════════════════════════════════════════════════
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
════════════════════════════════════════════════════════════════════════════════════════════════════
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
════════════════════════════════════════════════════════════════════════════════════════════════════
00:05 +0 -1: Can build widget tree in profile mode with asserts enabled [E]
  Test failed. See exception logs above.
  The test description was: Can build widget tree in profile mode with asserts enabled

@jonahwilliams jonahwilliams requested a review from Hixie January 14, 2022 05:01
Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

LGTM until we can have a better way to enforce what modes unit tests are run in.

@jonahwilliams
Copy link
Contributor Author

Mac_android run_release_test is hitting an infra failure, known issue?

@dnfield
Copy link
Contributor

dnfield commented Jan 14, 2022

@CaseyHillers
Copy link
Contributor

@CaseyHillers or @keyonghan might know (https://ci.chromium.org/ui/p/flutter/builders/try/Mac_android%20run_release_test/18/overview). I triggered a rerun.

I filed #96672 to the ticket queue. If you don't need Mac_android coverage, feel free to ack it and submit it to see what CI says. I'll look into getting a few extra devices added to the try pool so one device doesn't control presubmit.

@jonahwilliams
Copy link
Contributor Author

cool, thank you @CaseyHillers !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants