mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 09:58:32 +00:00
[gardening] Fix spawn_uri_nested_vm_test so main isolates waits for child isolates before exiting.
Fixes https://github.com/dart-lang/sdk/issues/28192 TEST=spawn_uri_nested_vm_test Change-Id: I5ad55a52e45a722d49c99797794115950cf7fb9f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216925 Commit-Queue: Siva Annamalai <asiva@google.com> Reviewed-by: Siva Annamalai <asiva@google.com>
This commit is contained in:
parent
7154635d4d
commit
9129c7303c
|
@ -12,12 +12,19 @@ import 'dart:isolate';
|
|||
import 'package:async_helper/async_minitest.dart';
|
||||
|
||||
main() {
|
||||
test('isolate fromUri - nested send and reply', () {
|
||||
ReceivePort port = new ReceivePort();
|
||||
Isolate.spawnUri(Uri.parse('spawn_uri_nested_child1_vm_isolate.dart'), [], [
|
||||
test('isolate fromUri - nested send and reply', () async {
|
||||
final port = ReceivePort();
|
||||
final exitPort = ReceivePort();
|
||||
Isolate.spawnUri(
|
||||
Uri.parse('spawn_uri_nested_child1_vm_isolate.dart'),
|
||||
[],
|
||||
[
|
||||
[1, 2],
|
||||
port.sendPort
|
||||
]);
|
||||
],
|
||||
onExit: exitPort.sendPort);
|
||||
port.first.then(expectAsync((result) => print(result)));
|
||||
// ensure main isolate doesn't exit before child isolate exits
|
||||
await exitPort.first;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -14,12 +14,19 @@ import 'dart:isolate';
|
|||
import 'package:async_helper/async_minitest.dart';
|
||||
|
||||
main() {
|
||||
test('isolate fromUri - nested send and reply', () {
|
||||
ReceivePort port = new ReceivePort();
|
||||
Isolate.spawnUri(Uri.parse('spawn_uri_nested_child1_vm_isolate.dart'), [], [
|
||||
test('isolate fromUri - nested send and reply', () async {
|
||||
final port = ReceivePort();
|
||||
final exitPort = ReceivePort();
|
||||
Isolate.spawnUri(
|
||||
Uri.parse('spawn_uri_nested_child1_vm_isolate.dart'),
|
||||
[],
|
||||
[
|
||||
[1, 2],
|
||||
port.sendPort
|
||||
]);
|
||||
],
|
||||
onExit: exitPort.sendPort);
|
||||
port.first.then(expectAsync((result) => print(result)));
|
||||
// ensure main isolate doesn't exit before child isolate exits
|
||||
await exitPort.first;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue