Files
sdk/tests/lib_2/isolate/issue_21398_parent_isolate2_test.dart
T
Alexander Aprelev 6b3abe0a98 [vm/concurrency] Add --experimental_enable_isolate_groups_jit flag, make --enable_isolate_groups AOT only.
Issue b/177800357.

TEST=existing test suite
Change-Id: Id6b113932ab7014b8fa6c105845c5c490b60f5e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181320
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-27 17:11:29 +00:00

51 lines
1.7 KiB
Dart

// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// VMOptions=--enable-isolate-groups --experimental-enable-isolate-groups-jit
// VMOptions=--no-enable-isolate-groups
import 'dart:isolate';
import "package:expect/expect.dart";
import 'package:async_helper/async_helper.dart';
import "deferred_loaded_lib.dart" deferred as lib;
// In this test case we send an object created from a deferred library
// that is loaded in the child isolate but not the parent isolate. The
// parent isolate does not know about the type of this object and throws
// an unhandled exception.
funcChild(args) {
var replyPort = args[0];
// Deferred load a library, create an object from that library and send
// it over to the parent isolate which has not yet loaded that library.
lib.loadLibrary().then((_) {
replyPort.send(new lib.FromChildIsolate());
});
}
void helperFunction() {
var receivePort = new ReceivePort();
asyncStart();
// Spawn an isolate using spawnFunction.
Isolate.spawn(funcChild, [receivePort.sendPort]).then((isolate) {
receivePort.listen((msg) {
// We don't expect to receive any valid messages.
Expect.fail("We don't expect to receive any valid messages");
receivePort.close();
asyncEnd();
}, onError: (e) {
// We don't expect to receive any error messages, per spec listen
// does not receive an error object.
Expect.fail("We don't expect to receive any error messages");
receivePort.close();
asyncEnd();
});
});
}
main() {
helperFunction(); //# 01: runtime error
}