Skip to content

Conversation

@knopp
Copy link
Member

@knopp knopp commented May 21, 2024

Fixes #148687

Adds support for running the hot restart and reload integration test on iOS simulator.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label May 21, 2024
@knopp knopp force-pushed the native_asset_integration_test_simulator branch 2 times, most recently from 93cd0b9 to 297c0eb Compare May 21, 2024 09:53
@knopp knopp changed the title Run native assets integration tests on iOS simulator [iOS] fix hot reload with native assets May 21, 2024
@knopp knopp changed the title [iOS] fix hot reload with native assets [iOS] fix hot restart with native assets May 21, 2024
@knopp
Copy link
Member Author

knopp commented May 21, 2024

@dcharkes, I think this should work, but the tree is currently broken and the integration tests are currently failing for unrelated reason.

@knopp knopp force-pushed the native_asset_integration_test_simulator branch from 29571ba to 8cef4c2 Compare May 21, 2024 16:21
@knopp
Copy link
Member Author

knopp commented May 21, 2024

@dcharkes, it seems that the hot reload test (with the fix) passes successfully on simulator on CI:

21:26 +72 ~1: test/integration.shard/isolated/native_assets_test.dart: flutter run hot reload and hot restart with native assets 873FC224-4044-471E-9CFA-9739B82F3105 debug

@knopp knopp requested a review from dcharkes May 21, 2024 17:08
@knopp knopp force-pushed the native_asset_integration_test_simulator branch from 8cef4c2 to 6552cec Compare May 22, 2024 11:24
Copy link
Contributor

@dcharkes dcharkes left a comment

Choose a reason for hiding this comment

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

Great!

Before merging, could you check the existing device lab test? That already spin up a simulator.

Copy link
Contributor

Choose a reason for hiding this comment

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

We have all this logic already in the device lab tests.

https://github.com/flutter/flutter/blob/e6fa8655819e9b92740911b49e8215efc6e52dab/dev/devicelab/bin/tasks/native_assets_ios_simulator.dart

$ cd <...>/flutter/dev/devicelab && dart bin/test_runner.dart test -t native_assets_ios_simulator

Would you be able to check why the existing hot integration test was not failing on the ios simulator?

(I don't feel strongly opposed to adding the logic also here, but since we already have it in the device lab tests it feels a bit like unnecessary code duplication.)

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the problem is that when hot restart happens this is in the logs

Performing hot restart...
Restarted application in 325ms.

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following ArgumentError was thrown building _FocusInheritedScope:

The test only checks for Restarted application, which is there, so it assumes it passed, the exception is printed after. I think this is handled bit differently in the integration tests that's why those catch the issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is present in the integration test

expect(stdout, isNot(contains('EXCEPTION CAUGHT BY WIDGETS LIBRARY')));

Probably should be added to device lab tool

Copy link
Member Author

Choose a reason for hiding this comment

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

But even if I detect the exception and return TaskResult.failure the task still exits with success for some reason.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dcharkes, this should fix the device lab test: eb6b04c

Should I remove the simulator from integration tests?

Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't mind having it there, it's easier to run locally than the devicelab test.

However, I believe we shouldn't be using infinite resources on CI. And the test coverage should be similar between the integration test with the simulator and the devicelab test with the simulator.

cc @jmagman @vashworth What's our policy on how much testing resources we use? And what's the policy on where simulator tests should run? (Integration suite vs device lab. I'm added the simulator to the device lab based on existing device lab tests that run the simulator.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for diving into this @knopp! ❤️

Copy link
Member Author

Choose a reason for hiding this comment

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

The 4/4 shard already takes long time to complete (in fact it did timeout in previous run and I had to restart it). I think maybe it's a good idea to remove it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that test runs long already. We don't want to introduce flakes due to timeouts. Let's remove it from this PR.

That means that this PR will just be a test fix and a fix 👍

@knopp knopp force-pushed the native_asset_integration_test_simulator branch 2 times, most recently from 343cf29 to eb6b04c Compare May 23, 2024 08:32
Copy link
Contributor

Choose a reason for hiding this comment

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

Please also fix dev/devicelab/bin/tasks/native_assets_ios.dart

Copy link
Member Author

Choose a reason for hiding this comment

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

That one seems fine? I looked at it and it seems to propagate the result of createNativeAssetsTest correctly.

Copy link
Contributor

@dcharkes dcharkes left a comment

Choose a reason for hiding this comment

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

LGTM with simulator removed again from integration test.

@knopp
Copy link
Member Author

knopp commented May 23, 2024

@dcharkes flutter run hot reload and hot restart with native assets macos debug failed:

34:35 +84 ~1 -2: test/integration.shard/isolated/native_assets_test.dart: flutter run hot reload and hot restart with native assets macos debug [E]
  Expected: not contains 'Invalid argument(s): Couldn\'t resolve native function \'sum\''
    Actual: 'warning: Run script build phase \'Run Script\' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target \'Flutter Assemble\' from project \'Runner\')\n'
              'Performing hot reload...                                        \n'
              'The Flutter DevTools debugger and profiler on macOS is available at: http://127.0.0.1:9106?uri=http://127.0.0.1:53308/xYohxuqAUcQ=/\n'
              'Reloaded 0 libraries in 520ms (compile: 8 ms, reload: 0 ms, reassemble: 492 ms).\n'
              '\n'
              'Performing hot restart...                                       \n'
              'Restarted application in 5,343ms.\n'
              '\n'
              'Performing hot reload...                                        \n'
              '\n'
              '══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════\n'
              'The following ArgumentError was thrown building _FocusInheritedScope:\n'
              'Invalid argument(s): Couldn\'t resolve native function \'sum\' in\n'
              '\'package:package_with_native_assets/package_with_native_assets_bindings_generated.dart\' : Failed to\n'
              'load dynamic library \'package_with_native_assets1.framework/package_with_native_assets1\': Failed to\n'
              'load dynamic library \'package_with_native_assets1.framework/package_with_native_assets1\':\n'
              'dlopen(package_with_native_assets1.framework/package_with_native_assets1, 0x0001): tried:\n'
              '\'package_with_native_assets1.framework/package_with_native_assets1\' (no such file),\n'
              '\'/System/Volumes/Preboot/Cryptexes/OSpackage_with_native_assets1.framework/package_with_native_assets1\'\n'
              '(no such file),\n'
              

I don't think it is related to this PR. I'm going to restart the test to see if it passes, but I think it might be flaky?

@knopp knopp force-pushed the native_asset_integration_test_simulator branch from edf78f0 to 8eca905 Compare May 23, 2024 14:29
@knopp knopp merged commit 02d5286 into flutter:master May 23, 2024
@knopp knopp deleted the native_asset_integration_test_simulator branch May 23, 2024 16:30
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 23, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 23, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request May 23, 2024
flutter/flutter@73bf206...8d955cd

2024-05-23 [email protected] Update `FocusManager` platform check to include iOS (flutter/flutter#148612)
2024-05-23 [email protected] [iOS] fix hot restart with native assets (flutter/flutter#148752)
2024-05-23 [email protected] Roll Flutter Engine from b8b82454e302 to 964f087f288c (8 revisions) (flutter/flutter#148943)
2024-05-23 [email protected] Fix DecoratedSliver sample code to reflect the description (flutter/flutter#148621)
2024-05-23 [email protected] Test raw autocomplete api examples (flutter/flutter#148234)
2024-05-23 [email protected] Add test for scaffold.0.dart and scaffold.2.dart (flutter/flutter#148166)
2024-05-23 [email protected] Add tests for restorable_value.0.dart API example. (flutter/flutter#148676)
2024-05-23 [email protected] Roll Flutter Engine from 8b094fbb94d8 to b8b82454e302 (6 revisions) (flutter/flutter#148919)
2024-05-22 [email protected] Allow `RenderObject.getTransformTo` to take an arbitrary RenderObject in the same tree (flutter/flutter#148897)
2024-05-22 [email protected] 3.22.1 changelog updates (flutter/flutter#148895)
2024-05-22 [email protected] Add frame number and widget location map service extension (flutter/flutter#148702)
2024-05-22 [email protected] Remove an assert with false positives (flutter/flutter#148795)
2024-05-22 [email protected] Revert "Fix the second TextFormField to trigger onTapOutside" (flutter/flutter#148909)
2024-05-22 [email protected] [wiki migration] Remaining pages under docs/about/ (flutter/flutter#148782)
2024-05-22 [email protected] Roll Flutter Engine from b6971cdf14f8 to 8b094fbb94d8 (3 revisions) (flutter/flutter#148883)
2024-05-22 [email protected] Fix the second TextFormField to trigger onTapOutside (flutter/flutter#148206)
2024-05-22 [email protected] Try removing robolectric from `integration_test` tests (flutter/flutter#148803)
2024-05-22 [email protected] Prevent test folder deletion on running `flutter create --empty` on an existing app project (flutter/flutter#147160)
2024-05-22 [email protected] [wiki migration] Tool team pages (flutter/flutter#148779)
2024-05-22 [email protected] Roll Flutter Engine from c89defa55801 to b6971cdf14f8 (6 revisions) (flutter/flutter#148819)
2024-05-22 [email protected] [native_assets] Add support for link hooks (flutter/flutter#148474)
2024-05-22 [email protected] Roll Packages from ba19b24 to 6525441 (12 revisions) (flutter/flutter#148864)
2024-05-22 [email protected] Update tokens to 4.0.0 (flutter/flutter#148789)
2024-05-22 [email protected] Move Linux web_long_running_tests_2_5 to bringup (flutter/flutter#148854)

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],[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
victorsanni pushed a commit to victorsanni/flutter that referenced this pull request May 31, 2024
Fixes flutter#148687

Adds support for running the hot restart and reload integration test on
iOS simulator.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] 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].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
[Data Driven Fixes]:
https://github.com/flutter/flutter/wiki/Data-driven-Fixes
CillianMyles pushed a commit to superlistapp/flutter that referenced this pull request Jun 7, 2024
Fixes flutter#148687

Adds support for running the hot restart and reload integration test on
iOS simulator.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] 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].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
[Data Driven Fixes]:
https://github.com/flutter/flutter/wiki/Data-driven-Fixes
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] Hot restart fails with native assets

2 participants