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
Remove test framework dependence on dart:isolate #33067
Comments
Do we actually need to block the isolate? If there is still work to be done, the isolate should not exit. If there is no work to be done, exiting without printing the "async test done" message would be is a perfectly good way to fail the test, instead of hanging. I tried removing the port from |
I would interpret this bug as: "address our testing needs that hides the dependency on isolates". I.e., if we don't need to block the isolate to do the above, then that's not a requirement. |
precisely, that's basically what I am going after.
I'm not 100% sure, but my understanding is that we do need it. I'm not sure what scenarios trigger this but my understanding is that without blocking the VM might exit too early. That might be due to external callbacks that the VM doesn't have a way to know if they have pending work, or some other reason I don't know of. Adding some people that might know the answer: @a-siva @mkustermann @peter-ahe-google |
One of the reason for this functionality is: It provides an ability to test low level implementation details. For example to test the implementation of Another reason is that a lot of our tests, in particular corelib/io/... tests, were not "allowed" to use other packages, e.g. IIRC, For dart2js we have introduced the Personally, I'm not a particular fan of introducing more special Maybe @peter-ahe-google can provide his view on this as well? |
@sigmundch suggests a feature would could call "keep-live" (it generalizes what we doing with @vsmenon suggests that we don't need this feature because the VM should just not exit if it has more work to do. Unfortunately, that's the behavior we're trying to verify is working. So we need a way to write tests of this feature. We need to remember that we're testing the features of the platform (a service for developers working on the Dart SDK), not providing a testing framework for Dart (a service for developers using Dart). The above two mentioned suggestions suffer from the same problem: they aren't fail-safe (if they fail they may cause harm as we won't notice they're broken and other things might break). This is why we added the We've spend many hours debugging problems that turned out to be code not being run because an async program exited prematurely. This is why we care so much about this. Here's an alternative solution:
foo_test.dart:
Notice that the line indicated by |
The tests using Apart from that, it seems to be exactly what The first call to If the program terminates before that, it's a failure, which is what we want. There is no need to keep the isolate alive and get a time-out, early termination is also an error. Are there any other uses of |
@lrhn we've gotten push-back on printing those messages. I think the wrapping could solve that as it enables us to use different features for each runtime or compiler. |
Just clarifying the title for this bug - i.e., the dart stable blocker. Is @lrhn 's CL sufficient to fix that? Do we need a separate bug to discuss blocking the VM and / or printing? |
@vsmenon @lrhn When looking at the test.dart code, it seems like like |
@mkustermann yes. Lasse's CL is certainly enough to close this issue. |
Fantastic! Thanks everyone for all the input and detailed discussion! |
Addresses issue #33067. Bug: http://dartbug.com/33067 Change-Id: Id9e60e930a8f289a51063f609e13fb998f6907c3 Reviewed-on: https://dart-review.googlesource.com/55662 Commit-Queue: Lasse R.H. Nielsen <lrn@google.com> Reviewed-by: Vijay Menon <vsm@google.com>
@lrhn 's CL landed, so I think we can close. |
Context:
dart:isolate
on web compilers (ddc, dart2js)ReceivePort
is used heavily on our tests to ensure the VM doesn't exist on before all async callbacks have been executed. This is mainly done byasync_helper
hereCan we add an explicit API to address our testing needs that hides the dependency on isolates? That may allows us to make it a compile-time error to import
dart:isolate
on the web. In particular, would it work to add two new external methodswaitForAsync()
andnotifyAsyncDone()
for this purpose? Not sure where they should go (an existing publicdart:*
library? indart:_internal
by making an exclusion that async_helper can use it (like we do for pkg/dart_internal today), a newdart:_testing
library?)@lrhn @a-siva @vsmenon - thoughts?
The text was updated successfully, but these errors were encountered: