cd20b29917
d8 tests weren't executing code after a hot restart due to several factors: 1) subsequent calls to `main` after a hot restart weren't being added to an event loop. 2) periodic timers, which use `setInterval` weren't updated to check for the hot restart generation. 3) d8's simulated timers run synchronously, which interacts poorly with our async implementation. Periodic timers never cede to the async task that handles changing hot restart generation, so they would run forever whenever an error was thrown. Changes: * Added a helper to d8.js that cancels all timers. * d8 now cancels all timers if an async main registers an error (via a handler on main). * `setInterval` is now implemented. * The embedder now accepts a publicly modifiable config object. `capturedMainHandler` and `mainErrorCallback` can be set via this object. Change-Id: I523752ea69e8fd1f1ec0f6f585a484b670534cfc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421680 Commit-Queue: Mark Zhou <markzipan@google.com> Reviewed-by: Srujan Gaddam <srujzs@google.com> Reviewed-by: Nicholas Shahan <nshahan@google.com>
Testing Framework for Hot Reload/Restart Tests for DDC
This package contains utilities to test multiple generations of files in order to validate hot reload and hot restart.
Test File Conventions
- Different generations of files have a generation number after the file name
e.g.
file_name.1.dartis the generation 1-version of the file. - If a generation file is intended to be rejected, it should contain
.rejectin the file name. Theconfig.jsonfile should contain a key"expectedErrors"with its value being a map of generation number string to the error string. - If a generation does a hot restart instead of a reload, it should contain
.restartin every file name in the same generation. - It is an error to specify both
.rejectand.restart.