-
Notifications
You must be signed in to change notification settings - Fork 86
Plumbing flags required for running tests with the DDC module system. #2295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
61f964b
e17f872
6a01aad
2e4d0a2
188a5ae
c055748
cc66e55
e37da6b
dcbea77
40ac194
83d5feb
6d5bcfe
2cff2ce
84ee640
77bd6eb
43e6446
69fa508
7330d99
b30a41f
5b9854e
c606696
dafca8a
819bcf5
42c674e
f4ae7e2
4f143c9
ac28b96
e4c7df0
dbcb892
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| // Copyright (c) 2023, 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. | ||
|
|
||
| export 'src/utilities/ddc_names.dart'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,22 +2,24 @@ | |
| // 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 'dart:async'; | ||
| import 'dart:convert'; | ||
| import 'dart:io'; | ||
|
|
||
| import 'package:build_daemon/client.dart'; | ||
| import 'package:build_daemon/data/build_status.dart'; | ||
| import 'package:build_daemon/data/build_target.dart'; | ||
| import 'package:dwds/asset_reader.dart'; | ||
| import 'package:dwds/expression_compiler.dart'; | ||
| import 'package:dwds/src/connections/app_connection.dart'; | ||
| import 'package:dwds/src/connections/debug_connection.dart'; | ||
| import 'package:dwds/src/debugging/webkit_debugger.dart'; | ||
| import 'package:dwds/src/loaders/build_runner_require.dart'; | ||
| import 'package:dwds/src/loaders/frontend_server_legacy.dart'; | ||
| import 'package:dwds/src/loaders/frontend_server_require.dart'; | ||
| import 'package:dwds/src/loaders/require.dart'; | ||
| import 'package:dwds/src/loaders/strategy.dart'; | ||
| import 'package:dwds/src/readers/proxy_server_asset_reader.dart'; | ||
| import 'package:dwds/src/services/chrome_proxy_service.dart'; | ||
| import 'package:dwds/src/services/expression_compiler.dart'; | ||
| import 'package:dwds/src/services/expression_compiler_service.dart'; | ||
| import 'package:dwds/src/utilities/dart_uri.dart'; | ||
| import 'package:dwds/src/utilities/server.dart'; | ||
|
|
@@ -204,7 +206,7 @@ class TestContext { | |
| ExpressionCompiler? expressionCompiler; | ||
| AssetReader assetReader; | ||
| Stream<BuildResults> buildResults; | ||
| RequireStrategy requireStrategy; | ||
| LoadStrategy loadStrategy; | ||
| String basePath = ''; | ||
| String filePathToServe = project.filePathToServe; | ||
|
|
||
|
|
@@ -268,7 +270,7 @@ class TestContext { | |
| expressionCompiler = ddcService; | ||
| } | ||
|
|
||
| requireStrategy = BuildRunnerRequireStrategyProvider( | ||
| loadStrategy = BuildRunnerRequireStrategyProvider( | ||
| assetHandler, | ||
| testSettings.reloadConfiguration, | ||
| assetReader, | ||
|
|
@@ -301,6 +303,7 @@ class TestContext { | |
| nullSafety: project.nullSafety, | ||
| experiments: buildSettings.experiments, | ||
| canaryFeatures: buildSettings.canaryFeatures, | ||
| moduleFormat: testSettings.moduleFormat, | ||
| ); | ||
|
|
||
| _webRunner = ResidentWebRunner( | ||
|
|
@@ -332,14 +335,24 @@ class TestContext { | |
| basePath = webRunner.devFS.assetServer.basePath; | ||
| assetReader = webRunner.devFS.assetServer; | ||
| _assetHandler = webRunner.devFS.assetServer.handleRequest; | ||
| requireStrategy = FrontendServerRequireStrategyProvider( | ||
| testSettings.reloadConfiguration, | ||
| assetReader, | ||
| packageUriMapper, | ||
| () async => {}, | ||
| buildSettings, | ||
| ).strategy; | ||
|
|
||
| loadStrategy = switch (testSettings.moduleFormat) { | ||
Markzipan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ModuleFormat.amd => FrontendServerRequireStrategyProvider( | ||
| testSettings.reloadConfiguration, | ||
| assetReader, | ||
| packageUriMapper, | ||
| () async => {}, | ||
| buildSettings, | ||
| ).strategy, | ||
| ModuleFormat.ddc => FrontendServerLegacyStrategyProvider( | ||
| testSettings.reloadConfiguration, | ||
| assetReader, | ||
| packageUriMapper, | ||
| () async => {}, | ||
| buildSettings, | ||
| ).strategy, | ||
| _ => throw Exception( | ||
| 'Unsupported DDC module format ${testSettings.moduleFormat.name}.') | ||
| }; | ||
| buildResults = const Stream<BuildResults>.empty(); | ||
| } | ||
| break; | ||
|
|
@@ -380,6 +393,10 @@ class TestContext { | |
| ), | ||
| ); | ||
| } | ||
|
|
||
| // The debugger tab must be enabled and connected before certain | ||
| // listeners in DWDS run. | ||
| final tabConnectionCompleter = Completer(); | ||
| final connection = ChromeConnection('localhost', debugPort); | ||
|
|
||
| _testServer = await TestServer.start( | ||
|
|
@@ -389,11 +406,12 @@ class TestContext { | |
| port: port, | ||
| assetHandler: assetHandler, | ||
| assetReader: assetReader, | ||
| strategy: requireStrategy, | ||
| strategy: loadStrategy, | ||
| target: project.directoryToServe, | ||
| buildResults: buildResults, | ||
| chromeConnection: () async => connection, | ||
| autoRun: testSettings.autoRun, | ||
| completeBeforeHandlingConnections: tabConnectionCompleter.future, | ||
|
||
| ); | ||
|
|
||
| _appUrl = basePath.isEmpty | ||
|
|
@@ -406,7 +424,9 @@ class TestContext { | |
| if (tab != null) { | ||
| _tabConnection = await tab.connect(); | ||
| await tabConnection.runtime.enable(); | ||
| await tabConnection.debugger.enable(); | ||
| await tabConnection.debugger | ||
| .enable() | ||
| .then((_) => tabConnectionCompleter.complete()); | ||
| } else { | ||
| throw StateError('Unable to connect to tab.'); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // Copyright (c) 2023, 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. | ||
|
|
||
| @Tags(['daily']) | ||
| @TestOn('vm') | ||
| @Timeout(Duration(minutes: 5)) | ||
|
|
||
| import 'dart:io'; | ||
|
|
||
| import 'package:dwds/expression_compiler.dart'; | ||
| import 'package:test/test.dart'; | ||
| import 'package:test_common/test_sdk_configuration.dart'; | ||
|
|
||
| import 'evaluate_common.dart'; | ||
| import 'fixtures/context.dart'; | ||
| import 'fixtures/project.dart'; | ||
|
|
||
| void main() async { | ||
| // Enable verbose logging for debugging. | ||
| final debug = false; | ||
|
|
||
| final provider = TestSdkConfigurationProvider( | ||
| verbose: debug, | ||
| ddcModuleFormat: ModuleFormat.ddc, | ||
| ); | ||
| tearDownAll(provider.dispose); | ||
|
|
||
| for (var useDebuggerModuleNames in [false, true]) { | ||
| group('Debugger module names: $useDebuggerModuleNames |', () { | ||
| final nullSafety = NullSafety.sound; | ||
| group('${nullSafety.name} null safety | DDC module system |', () { | ||
| for (var indexBaseMode in IndexBaseMode.values) { | ||
| group( | ||
| 'with ${indexBaseMode.name} |', | ||
| () { | ||
| testAll( | ||
| provider: provider, | ||
| compilationMode: CompilationMode.frontendServer, | ||
| indexBaseMode: indexBaseMode, | ||
| nullSafety: nullSafety, | ||
| useDebuggerModuleNames: useDebuggerModuleNames, | ||
| debug: debug, | ||
| ); | ||
| }, | ||
| // https://github.com/dart-lang/sdk/issues/49277 | ||
| skip: indexBaseMode == IndexBaseMode.base && Platform.isWindows, | ||
| ); | ||
| } | ||
| }); | ||
| }); | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.