[analysis_server] Move test/integration to integration_test

This was mostly a rename/move of the folder (and the analysis server updated all references), but I also had to:

- add `integration_test/analysis_options.yaml` to import from `../test` to get the same lint ignores
- update paths of exclusions in `verify_sorted_test.dart`

By moving all of the tests that start the server out-of-process out of test, we can:

1. Use "dart test" to just run the faster tests ("dart test test") and get functionality of the pkg:test runner (for example running tests concurrently and JSON output)
2. Allow VS Code to spawn different debug sessions for the "test" and "integration_test" folder, which means we can use a `preLaunchTask` to trigger compilation of the analysis server from source whenever running integration tests (avoiding having to compile manually, or run from source in a way that compiles a new server for each test suite)

Change-Id: I37cc03dc32d08c5b51a2eab79f6338bb079b32ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434801
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Danny Tuppeny
2025-06-17 12:54:41 -07:00
committed by Commit Queue
parent 69e98d3b21
commit b0d4ab8ef9
98 changed files with 42 additions and 47 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ To run all analysis server tests:
To run just the analysis server integration tests:
```
./tools/test.py -mrelease pkg/analysis_server/test/integration/
./tools/test.py -mrelease pkg/analysis_server/integration_test/
```
To run a single test:
@@ -9,8 +9,8 @@ import 'dart:math' show max, sqrt;
import 'package:logging/logging.dart';
import 'package:path/path.dart';
import '../../test/integration/support/integration_test_methods.dart';
import '../../test/integration/support/integration_tests.dart';
import '../../integration_test/support/integration_test_methods.dart';
import '../../integration_test/support/integration_tests.dart';
import 'operation.dart';
/// [Driver] launches and manages an instance of analysis server,
@@ -12,8 +12,8 @@ import 'package:analysis_server/src/protocol_server.dart';
import 'package:analyzer/instrumentation/instrumentation.dart';
import 'package:test/test.dart';
import '../../test/integration/lsp_server/integration_tests.dart';
import '../../test/integration/support/integration_tests.dart';
import '../../integration_test/lsp_server/integration_tests.dart';
import '../../integration_test/support/integration_tests.dart';
import '../../test/lsp/server_abstract.dart' show ClientCapabilitiesHelperMixin;
/// A server protocol-agnostic interface to the memory test, allowing the same
@@ -0,0 +1,2 @@
# Use the same analysis options as the main test folder.
include: ../test/analysis_options.yaml
@@ -8,8 +8,8 @@ import 'package:analyzer_plugin/src/utilities/string_utilities.dart';
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
import '../../tool/spec/api.dart';
import '../../tool/spec/from_html.dart';
import '../tool/spec/api.dart';
import '../tool/spec/from_html.dart';
/// Define tests to fail if there's no mention in the coverage file.
void main() {
@@ -28,9 +28,7 @@ void main() {
pathPrefix = path.join('pkg', 'analysis_server');
}
coverageFile = File(
path.join(pathPrefix, 'test', 'integration', 'coverage.md'),
);
coverageFile = File(path.join(pathPrefix, 'integration_test', 'coverage.md'));
var lines = coverageFile.readAsLinesSync();
// ## server domain
@@ -87,12 +85,7 @@ void main() {
request.method,
).map((s) => s.toLowerCase()).join('_');
var testName = path.join(domain.name, '${fileName}_test.dart');
var testPath = path.join(
pathPrefix,
'test',
'integration',
testName,
);
var testPath = path.join(pathPrefix, 'integration_test', testName);
// Test that if checked, a test file exists; if not checked, no such
// file exists.
@@ -4,7 +4,7 @@
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../../shared/shared_dtd_tests.dart';
import '../../test/shared/shared_dtd_tests.dart';
import '../lsp/abstract_lsp_over_legacy.dart';
void main() {
@@ -12,8 +12,8 @@ import 'package:analyzer_plugin/src/utilities/client_uri_converter.dart';
import 'package:path/path.dart';
import 'package:test/test.dart';
import '../../lsp/request_helpers_mixin.dart';
import '../../lsp/server_abstract.dart';
import '../../test/lsp/request_helpers_mixin.dart';
import '../../test/lsp/server_abstract.dart';
import '../support/integration_tests.dart';
abstract class AbstractLspOverLegacyTest
@@ -10,8 +10,8 @@ import 'package:analyzer/src/test_utilities/test_code_format.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../../tool/lsp_spec/matchers.dart';
import '../../utils/test_code_extensions.dart';
import '../../test/tool/lsp_spec/matchers.dart';
import '../../test/utils/test_code_extensions.dart';
import '../support/integration_tests.dart';
import 'abstract_lsp_over_legacy.dart';
@@ -6,7 +6,7 @@ import 'package:analyzer/src/test_utilities/test_code_format.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../../utils/test_code_extensions.dart';
import '../../test/utils/test_code_extensions.dart';
import 'integration_tests.dart';
void main() {
@@ -6,7 +6,7 @@ import 'dart:async';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../../shared/shared_dtd_tests.dart';
import '../../test/shared/shared_dtd_tests.dart';
import 'integration_tests.dart';
void main() {
@@ -15,10 +15,10 @@ import 'package:analyzer_plugin/src/utilities/client_uri_converter.dart';
import 'package:meta/meta.dart';
import 'package:path/path.dart' as path;
import '../../constants.dart';
import '../../lsp/request_helpers_mixin.dart';
import '../../lsp/server_abstract.dart';
import '../../support/sdk_paths.dart';
import '../../test/constants.dart';
import '../../test/lsp/request_helpers_mixin.dart';
import '../../test/lsp/server_abstract.dart';
import '../../test/support/sdk_paths.dart';
abstract class AbstractLspAnalysisServerIntegrationTest
with
@@ -14,10 +14,10 @@ import 'package:language_server_protocol/protocol_generated.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../../analysis_server_base.dart';
import '../../lsp/code_actions_refactor_test.dart';
import '../../utils/message_scheduler_test_view.dart';
import '../../utils/test_code_extensions.dart';
import '../../test/analysis_server_base.dart';
import '../../test/lsp/code_actions_refactor_test.dart';
import '../../test/utils/message_scheduler_test_view.dart';
import '../../test/utils/test_code_extensions.dart';
void main() {
defineReflectiveSuite(() {
@@ -18,9 +18,9 @@ import 'package:meta/meta.dart';
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
import '../../constants.dart';
import '../../support/configuration_files.dart';
import '../../support/sdk_paths.dart';
import '../../test/constants.dart';
import '../../test/support/configuration_files.dart';
import '../../test/support/sdk_paths.dart';
import 'integration_test_methods.dart';
import 'protocol_matchers.dart';
@@ -7,7 +7,7 @@ import 'dart:async';
import 'package:stream_channel/stream_channel.dart';
import 'package:web_socket_channel/web_socket_channel.dart';
import '../../constants.dart';
import '../../test/constants.dart';
/// Creates a [StreamChannel] for a connection to a WebSocket at [wsUri] that
/// prints all communication if [debugPrintCommunication] is `true`.
@@ -47,7 +47,7 @@ import 'package:yaml/yaml.dart';
// it and re-enable it everywhere.
// Not private to enable testing.
// NB: If you set this to `false` remember to disable the
// `test/integration/serve/blaze_changes_test.dart`.
// `integration_test/serve/blaze_changes_test.dart`.
var experimentalEnableBlazeWatching = true;
/// Class that maintains a mapping from included/excluded paths to a set of
@@ -263,7 +263,7 @@ f() {
Future<void> test_fieldType() async {
// This test mirrors test_navigation() from
// test/integration/analysis/get_navigation_test.dart
// integration_test/analysis/get_navigation_test.dart
var text = r'''
class Foo {}
@@ -11,8 +11,8 @@ import 'package:dtd/dtd.dart';
import 'package:json_rpc_2/json_rpc_2.dart';
import 'package:test/test.dart';
import '../integration/support/dart_tooling_daemon.dart';
import '../integration/support/web_sockets.dart';
import '../../integration_test/support/dart_tooling_daemon.dart';
import '../../integration_test/support/web_sockets.dart';
import '../lsp/request_helpers_mixin.dart';
import '../tool/lsp_spec/matchers.dart';
import '../utils/lsp_protocol_extensions.dart';
@@ -8,8 +8,8 @@ import 'dart:math';
import 'package:path/path.dart';
import '../integration/support/integration_test_methods.dart';
import '../integration/support/integration_tests.dart';
import '../../integration_test/support/integration_test_methods.dart';
import '../../integration_test/support/integration_tests.dart';
/// Instances of the class [TimingResult] represent the timing information
/// gathered while executing a given timing test.
@@ -80,8 +80,8 @@ void buildTestsForAnalysisServer() {
// remove these exclusions.
'lib/protocol/protocol_constants.dart',
'lib/protocol/protocol_generated.dart',
'test/integration/support/integration_test_methods.dart',
'test/integration/support/protocol_matchers.dart',
'integration_test/support/integration_test_methods.dart',
'integration_test/support/protocol_matchers.dart',
// The following are not generated, but can't be sorted because they contain
// ignore comments in the directives, which sorting deletes.
'lib/src/services/kythe/schema.dart',
@@ -14,7 +14,7 @@ import 'from_html.dart';
import 'to_html.dart';
final GeneratedFile target = GeneratedFile(
'test/integration/support/integration_test_methods.dart',
'integration_test/support/integration_test_methods.dart',
(String pkgPath) async {
var visitor = CodegenInttestMethodsVisitor(
path.basename(pkgPath),
@@ -13,7 +13,7 @@ import 'implied_types.dart';
import 'to_html.dart';
final GeneratedFile target = GeneratedFile(
'test/integration/support/protocol_matchers.dart',
'integration_test/support/protocol_matchers.dart',
(String pkgPath) async {
var visitor = CodegenMatchersVisitor(readApi(pkgPath));
return visitor.collectCode(visitor.visitApi);
+2 -2
View File
@@ -8,10 +8,10 @@
#
# - ../../doc/api.html: The human-readable API spec.
#
# - ../../test/integration/protocol_matchers.dart: matchers to be used by
# - ../../integration_test/protocol_matchers.dart: matchers to be used by
# integration tests.
#
# - ../../test/integration/integration_test_methods.dart: convenience methods
# - ../../integration_test/integration_test_methods.dart: convenience methods
# to be used by integration tests.
set -e