mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 14:32:49 +00:00
df75a619c8
VM hot reload are run via: 1) We first emit a dill for every generation ahead of time (full dill on gen 0, incremental deltas subsequently). 2) We start a VM process at generation 0. 3) The VM process runs until it hits a `hotReload` command. It then uses the VM service protocol to connect to itself and reload the next generation. 4) The VM exits when the next generation isn't found. * Adds config files to reload tests that allow runtime filtering. * Implements VM-side hot reloading * Adds several VM-specific hot reload tests Change-Id: I1c6ad5c4eed426a0189c1b4af31297c9c1dba717 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359200 Reviewed-by: Nicholas Shahan <nshahan@google.com> Commit-Queue: Mark Zhou <markzipan@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com>
28 lines
901 B
Dart
28 lines
901 B
Dart
// Copyright (c) 2024, 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.
|
|
|
|
import 'package:expect/expect.dart';
|
|
import 'package:reload_test/reload_test_utils.dart';
|
|
|
|
var value = "unused";
|
|
|
|
Future<void> main() async {
|
|
// Declare an unreferenced lazy static field.
|
|
Expect.equals(0, hotReloadGeneration);
|
|
await hotReload();
|
|
|
|
// The lazy static field changes value but remains unread.
|
|
Expect.equals(1, hotReloadGeneration);
|
|
await hotReload();
|
|
|
|
// The lazy static is now read and contains the updated value.
|
|
Expect.equals(2, hotReloadGeneration);
|
|
Expect.equals("before", value);
|
|
await hotReload();
|
|
|
|
// The lazy static is updated and read but retains the old value.
|
|
Expect.equals(3, hotReloadGeneration);
|
|
Expect.equals("before", value);
|
|
}
|