Skip to content

Commit 44f8583

Browse files
nshahanCommit Bot
authored and
Commit Bot
committed
[ddc] Migrate modular test suite runners to null safety
- Migrate the test runner suites to null safety. - Cleanup old "non-nullable" experiment flags - Force null safety mode in the two suites: - modular_suite.dart: weak null safety - modular_suite_nnbd.dart: sound null safety NOTE: in both cases the source code is treated as null safe code. There are no tests written in a legacy dart version. Change-Id: I19ec25f7b5abc712971771a193c02ebd5283b987 Fixes: dart-lang/sdk#43096 Issue: dart-lang/sdk#46617 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244500 Reviewed-by: Sigmund Cherem <[email protected]> Commit-Queue: Nicholas Shahan <[email protected]>
1 parent b62b76b commit 44f8583

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

pkg/dev_compiler/test/modular_suite.dart

+6-10
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// @dart = 2.9
6-
75
/// Test the modular compilation pipeline of ddc.
86
///
97
/// This is a shell that runs multiple tests, one per folder under `data/`.
@@ -18,9 +16,9 @@ import 'package:modular_test/src/suite.dart';
1816
String packageConfigJsonPath = '.dart_tool/package_config.json';
1917
Uri sdkRoot = Platform.script.resolve('../../../');
2018
Uri packageConfigUri = sdkRoot.resolve(packageConfigJsonPath);
21-
Options _options;
22-
String _dartdevcScript;
23-
String _kernelWorkerScript;
19+
late Options _options;
20+
late String _dartdevcScript;
21+
late String _kernelWorkerScript;
2422

2523
void main(List<String> args) async {
2624
_options = Options.parse(args);
@@ -89,8 +87,7 @@ class SourceToSummaryDillStep implements IOModularStep {
8987
extraArgs = [
9088
'--libraries-file',
9189
'$rootScheme:///sdk/lib/libraries.json',
92-
'--enable-experiment',
93-
'non-nullable',
90+
'--no-sound-null-safety',
9491
];
9592
assert(transitiveDependencies.isEmpty);
9693
} else {
@@ -175,8 +172,7 @@ class DDCStep implements IOModularStep {
175172
'--compile-sdk',
176173
'--libraries-file',
177174
'$rootScheme:///sdk/lib/libraries.json',
178-
'--enable-experiment',
179-
'non-nullable',
175+
'--no-sound-null-safety',
180176
];
181177
assert(transitiveDependencies.isEmpty);
182178
} else {
@@ -319,7 +315,7 @@ String get _d8executable {
319315

320316
String _sourceToImportUri(Module module, String rootScheme, Uri relativeUri) {
321317
if (module.isPackage) {
322-
var basePath = module.packageBase.path;
318+
var basePath = module.packageBase!.path;
323319
var packageRelativePath = basePath == './'
324320
? relativeUri.path
325321
: relativeUri.path.substring(basePath.length);

pkg/dev_compiler/test/modular_suite_nnbd.dart

+6-14
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// @dart = 2.9
6-
75
/// Test the modular compilation pipeline of ddc.
86
///
97
/// This is a shell that runs multiple tests, one per folder under `data/`.
@@ -18,9 +16,9 @@ import 'package:modular_test/src/suite.dart';
1816
String packageConfigJsonPath = '.dart_tool/package_config.json';
1917
Uri sdkRoot = Platform.script.resolve('../../../');
2018
Uri packageConfigUri = sdkRoot.resolve(packageConfigJsonPath);
21-
Options _options;
22-
String _dartdevcScript;
23-
String _kernelWorkerScript;
19+
late Options _options;
20+
late String _dartdevcScript;
21+
late String _kernelWorkerScript;
2422

2523
void main(List<String> args) async {
2624
_options = Options.parse(args);
@@ -120,10 +118,7 @@ class SourceToSummaryDillStep implements IOModularStep {
120118
.where((m) => !m.isSdk)
121119
.expand((m) => ['--input-summary', '${toUri(m, dillId)}']),
122120
...sources.expand((String uri) => ['--source', uri]),
123-
// TODO(40266) After unfork of dart:_runtime only need experiment when
124-
// compiling SDK. For now always use the Null Safety experiment.
125-
'--enable-experiment',
126-
'non-nullable',
121+
'--sound-null-safety',
127122
...flags.expand((String flag) => ['--enable-experiment', flag]),
128123
];
129124

@@ -206,10 +201,7 @@ class DDCStep implements IOModularStep {
206201
rootScheme,
207202
...sources,
208203
...extraArgs,
209-
// TODO(40266) After unfork of dart:_runtime only need experiment when
210-
// compiling SDK. For now always use the Null Safety experiment.
211-
'--enable-experiment',
212-
'non-nullable',
204+
'--sound-null-safety',
213205
for (String flag in flags) '--enable-experiment=$flag',
214206
...transitiveDependencies
215207
.where((m) => !m.isSdk)
@@ -323,7 +315,7 @@ String get _d8executable {
323315

324316
String _sourceToImportUri(Module module, String rootScheme, Uri relativeUri) {
325317
if (module.isPackage) {
326-
var basePath = module.packageBase.path;
318+
var basePath = module.packageBase!.path;
327319
var packageRelativePath = basePath == './'
328320
? relativeUri.path
329321
: relativeUri.path.substring(basePath.length);

0 commit comments

Comments
 (0)