Files
sdk/runtime/tests/vm/dart/spawnuri_snapshot_test.dart
T
Ryan Macnak 9cb5d8e5be [standalone] Fix Isolate.spawnUri to work with AOT snapshots.
Fixes missing initialization of dart:_builtin during AOT.

Change-Id: If9f24f3658b91f490fc8215f2e9343bd437b2744
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156050
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-08-04 19:00:18 +00:00

35 lines
980 B
Dart

// Copyright (c) 2020, 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.
// Check spawnUri accepts any program format that `dart` accepts. Currently this
// is source, kernel, AppJIT (blob container) and AppAOT (ELF).
import "dart:isolate";
import "dart:io";
import "package:expect/expect.dart";
int fib(int n) {
if (n <= 1) return 1;
return fib(n - 1) + fib(n - 2);
}
main(List<String> args, [dynamic sendPort]) {
if (sendPort == null) {
print("Parent start");
var port = new RawReceivePort();
port.handler = (result) {
Expect.equals(14930352, result);
port.close();
print("Parent end");
};
print("Spawn ${Platform.script}");
Isolate.spawnUri(Platform.script, <String>[], port.sendPort);
} else {
print("Child start");
sendPort.send(fib(35));
print("Child end");
}
}