-
Notifications
You must be signed in to change notification settings - Fork 6k
Properly throw Dart error from PluginUtilities.getCallbackHandle FFI #36032
Conversation
|
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 (don't just cc him here, he won't see it! He's on Discord!). 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. |
A test needs to run in AOT to optimize out functions, in JIT mode all functions will be there. |
|
I found that even in host_release test, it wasn't getting optimized out. Might it be required to do full APK / Xcode build to get all the optimizing? |
|
We only ever run unit tests in debug mode, so it is not possible to unit test a change that fixes a release mode issue. That said, is it possible to reproduce the same error by using a bogus ID? |
|
On the engine we run tests in release mode |
|
@moffatman can you add the test case to |
|
@dnfield Added the broken test. I believe all the tests are compiled as "kernel" which is not the same as aot, even in release mode? |
|
@jonahwilliams Bogus ID will just return a null callback, it won't hit the same error case. |
| }); | ||
|
|
||
| test('PluginUtilities Callback Handles in Isolate', () async { | ||
| ReceivePort port = ReceivePort(); |
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 think we should skip this test like this:
if (!const bool.fromEnvironment('dart.vm.product')) {
return;
}
I'd expec tthis test to pass for the host_release tests...
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.
That value is false even in host_release
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.
That's unfortunate.
I don't think we should try to add more dart dfines for this.
Perhaps the right option here would be to move this file to a different directory and update run_tests.py so that it only picks this file if doing the host_release build.
First, I would recommend verifying that this test does in fact pass on host_release.
Alternatively, you could write this as a shell_unittest and there you could check whether FLUTTER_RUNTIME_MODE is release or not in the C++ part of the test.
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.
(also, if it's easier to discuss this happy to talk more on discord or over a vc)
|
Ping @dnfield |
e5a6551 to
47eb50f
Compare
dnfield
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.
LGTM
47eb50f to
adb924d
Compare
Restore dart error propagation which was missing since refactoring for FFI.
Not sure how to test this as the engine dart tests seem to not perform the level of optimizations required to reproduce my failure case (handle to optimized-out function).
Fixes #111243
Pre-launch Checklist
writing and running engine tests.
///).