The TEST_SERVER_SNAPSHOT env variable could previously be set to the string "false" to indicate not running the tests using the server snapshot (in which case, we'll instead compile the snapshot to a temp location and then use that).
This worked well for running the tests via `test_all.dart` where all tests run in a single isolate and share a single compilation. However it doesn't work well through `dart test` (which the VS Code test runner will use so we can get the results in JSON and populate the test tree) because each test runs in its own isolate and therefore still triggered compilation for every test.
This expands the `TEST_SERVER_SNAPSHOT` env variable to also support passing another string, which is a path. If provided, this path is used as the snapshot instead (with no compilation).
With a small amount of configuration for Dart-Code (which will be documented and/or committed into the `.vscode/` folder here), this will allow Dart-Code to compile the snapshot when running integration tests, and then trigger `dart test` with the env var set, meaning all integration tests across all isolates will share the same compilation.
The goal is to be able to make changes to the server and seamlessly run the integration tests from the editor without having to remember to run any external compilation (and for the integration tests to not take 17 minutes).
Change-Id: Ia2ef13da8d9a4debe9fa2c8016ef021f6abed8b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434800
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
When running analysis server tests from source, we now (since a recent change) pre-compile the server to avoid compilation on every test.
If the first test run was `test\integration\analysis\get_errors_non_standard_sdk_test.dart` we would try to compile with the non-standard (and incomplete) SDK created by the test, and fail because of https://github.com/dart-lang/sdk/issues/52752. This changes to always use the real SDK that we're running with for the compilation instead.
Change-Id: I1028c24ecb18f9caa465b579866d07a72c1dc02b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433822
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
When working on the analysis server, you can set the `TEST_SERVER_SNAPSHOT` env var to `false` to spawn the server from source (`bin/server.dart`) instead of running the snapshot, which allows easily running the integration tests (which spawn the server in a separate process) from the IDE without having to run (and wait for) builds.
However running from source like this can be quite slow because every test that spawns the server results in it being compiled on-the-fly. This change instead uses `dart compile` to compile the server from source to a temp file the first time we return the path, and then subsequently returns the same path.
On my Windows PC, this reduces the time to run the integration tests (with the env variable set) from 17min to 2min.
Change-Id: I612d1a978d22d214dc086962d8c9eb2e7dfe8239
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434080
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Both LSP and legacy server tests had their own implementation of writing package_config files. This combines them by moving the LSP `ConfigurationFilesMixin` mixin to its own file and updating the legacy test classes to use it.
This removes a little duplication and avoids adding more for the temporary packages required for Macros that's currently only in the LSP version (but required for some upcoming LSP-over-Legacy tests).
Change-Id: Iaa4055c544df4cdd5a0f140b0c6171ff1a406946
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347081
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>