[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:
Alexander Aprelev 2021-10-15 02:30:10 +00:00 committed by commit-bot@chromium.org
parent 7154635d4d
commit 9129c7303c
2 changed files with 26 additions and 12 deletions

View file

@ -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'), [], [
[1, 2],
port.sendPort
]);
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;
});
}

View file

@ -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'), [], [
[1, 2],
port.sendPort
]);
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;
});
}