Skip to content

Commit 5663697

Browse files
rmacnak-googleCommit Queue
authored andcommitted
[test_runner] Remove nnbd mode options.
In particular, this means the VM tests stop getting invoked with the now-invalid --sound-null-safety flag. Change-Id: Ia8f5a59e0bf1fd7094508fdc4bb146ebf3034148 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431360 Reviewed-by: Bob Nystrom <[email protected]> Reviewed-by: Kallen Tu <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent 8711f55 commit 5663697

File tree

84 files changed

+13
-1796
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+13
-1796
lines changed

pkg/test_runner/lib/src/compiler_configuration.dart

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,6 @@ List<String> _experimentsArgument(
3434
return ['--enable-experiment=${experiments.join(',')}'];
3535
}
3636

37-
List<String> _nnbdModeArgument(TestConfiguration configuration) {
38-
switch (configuration.nnbdMode) {
39-
case NnbdMode.legacy:
40-
return [];
41-
case NnbdMode.strong:
42-
return ['--sound-null-safety'];
43-
case NnbdMode.weak:
44-
return ['--no-sound-null-safety'];
45-
}
46-
47-
throw 'unreachable';
48-
}
49-
5037
/// Grouping of a command with its expected result.
5138
class CommandArtifact {
5239
final List<Command> commands;
@@ -193,7 +180,6 @@ class NoneCompilerConfiguration extends CompilerConfiguration {
193180
else if (_configuration.hotReloadRollback)
194181
'--hot-reload-rollback-test-mode',
195182
...vmOptions,
196-
..._nnbdModeArgument(_configuration),
197183
...testFile.sharedOptions,
198184
..._configuration.sharedOptions,
199185
..._experimentsArgument(_configuration, testFile),
@@ -249,7 +235,6 @@ class VMKernelCompilerConfiguration extends CompilerConfiguration
249235
..._configuration.sharedOptions,
250236
..._experimentsArgument(_configuration, testFile),
251237
...vmOptions,
252-
..._nnbdModeArgument(_configuration),
253238
...args
254239
];
255240
}
@@ -275,7 +260,6 @@ class VMKernelCompilerConfiguration extends CompilerConfiguration
275260
else if (_configuration.hotReloadRollback)
276261
'--hot-reload-rollback-test-mode',
277262
...vmOptions,
278-
..._nnbdModeArgument(_configuration),
279263
...testFile.sharedOptions,
280264
..._configuration.sharedOptions,
281265
..._experimentsArgument(_configuration, testFile),
@@ -985,7 +969,6 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
985969
'--no-sim-use-hardfp',
986970
],
987971
if (_configuration.isMinified) '--obfuscate',
988-
..._nnbdModeArgument(_configuration),
989972
if (arguments.contains('--print-flow-graph-optimized'))
990973
'--redirect-isolate-log-to=$tempDir/out.il',
991974
if (arguments.contains('--print-flow-graph-optimized') &&
@@ -1192,7 +1175,6 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
11921175
return [
11931176
if (_enableAsserts) '--enable_asserts',
11941177
...vmOptions,
1195-
..._nnbdModeArgument(_configuration),
11961178
...testFile.sharedOptions,
11971179
..._configuration.sharedOptions,
11981180
..._experimentsArgument(_configuration, testFile),
@@ -1254,7 +1236,6 @@ class AppJitCompilerConfiguration extends CompilerConfiguration {
12541236
return [
12551237
if (_enableAsserts) '--enable_asserts',
12561238
...vmOptions,
1257-
..._nnbdModeArgument(_configuration),
12581239
...testFile.sharedOptions,
12591240
..._configuration.sharedOptions,
12601241
..._experimentsArgument(_configuration, testFile),
@@ -1273,7 +1254,6 @@ class AppJitCompilerConfiguration extends CompilerConfiguration {
12731254
return [
12741255
if (_enableAsserts) '--enable_asserts',
12751256
...vmOptions,
1276-
..._nnbdModeArgument(_configuration),
12771257
...testFile.sharedOptions,
12781258
..._configuration.sharedOptions,
12791259
..._experimentsArgument(_configuration, testFile),
@@ -1427,7 +1407,6 @@ abstract mixin class VMKernelCompilerMixin {
14271407
arguments.contains('--enable-asserts') ||
14281408
arguments.contains('--enable_asserts'))
14291409
'--enable-asserts',
1430-
..._nnbdModeArgument(_configuration),
14311410
..._configuration.genKernelOptions,
14321411
];
14331412

pkg/test_runner/lib/src/configuration.dart

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ class TestConfiguration {
109109
Mode get mode => configuration.mode;
110110
Runtime get runtime => configuration.runtime;
111111
System get system => configuration.system;
112-
NnbdMode get nnbdMode => configuration.nnbdMode;
113112
Sanitizer get sanitizer => configuration.sanitizer;
114113

115114
// Boolean getters
@@ -408,23 +407,15 @@ class TestConfiguration {
408407

409408
/// The set of [Feature]s supported by this configuration.
410409
Set<Feature> get supportedFeatures {
411-
// The analyzer should parse all tests that don't require legacy support.
410+
// The analyzer should handle all tests.
412411
if (compiler == Compiler.dart2analyzer) {
413-
return {...Feature.all.where((f) => !Feature.legacy.contains(f))};
412+
return {...Feature.all};
414413
}
415414

416415
var isDart2jsProduction = dart2jsOptions.contains('-O3');
417416
var isOptimizedDart2Wasm = dart2wasmOptions.contains('-O1');
418417
var isJsCompiler = compiler == Compiler.dart2js || compiler == Compiler.ddc;
419418
return {
420-
// The supported NNBD features depending on the `nnbdMode`.
421-
if (NnbdMode.legacy == configuration.nnbdMode)
422-
Feature.nnbdLegacy
423-
else
424-
Feature.nnbd,
425-
if (NnbdMode.weak == configuration.nnbdMode) Feature.nnbdWeak,
426-
if (NnbdMode.strong == configuration.nnbdMode) Feature.nnbdStrong,
427-
428419
// The configurations with the following builder tags and configurations
429420
// with the `minified` flag set to `true` will obfuscate `Type.toString`
430421
// strings.

pkg/test_runner/lib/src/environment.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ final _variables = {
2626
"jscl": _Variable.bool((c) => c.runtime.isJSCommandLine),
2727
"minified": _Variable.bool((c) => c.isMinified),
2828
"mode": _Variable((c) => c.mode.name, Mode.names),
29-
"nnbd": _Variable((TestConfiguration c) => c.nnbdMode.name, NnbdMode.names),
3029
"qemu": _Variable.bool((c) => c.useQemu),
3130
"runtime": _Variable(_runtimeName, _runtimeNames),
3231
"sanitizer": _Variable((c) => c.sanitizer.name, Sanitizer.names),

pkg/test_runner/lib/src/feature.dart

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,6 @@ class Feature {
3636
/// Supports native number semantics.
3737
static const nativeNumbers = Feature._("native-numbers");
3838

39-
/// Opted out of NNBD and still using the legacy semantics.
40-
static const nnbdLegacy = Feature._("nnbd-legacy");
41-
42-
/// Opted in to NNBD features.
43-
///
44-
/// Note that this does not imply either strong or weak checking. A test that
45-
/// only requires "nnbd" should run in both weak and strong checking modes.
46-
static const nnbd = Feature._("nnbd");
47-
48-
/// Weak checking of NNBD features.
49-
static const nnbdWeak = Feature._("nnbd-weak");
50-
51-
/// Full strong checking of NNBD features.
52-
static const nnbdStrong = Feature._("nnbd-strong");
53-
5439
/// Expects [Type.toString] to show the original type name and original
5540
/// names in function type named parameters.
5641
static const readableTypeStrings = Feature._("readable-type-strings");
@@ -61,16 +46,9 @@ class Feature {
6146
checkedParameters,
6247
jsNumbers,
6348
nativeNumbers,
64-
nnbdLegacy,
65-
nnbd,
66-
nnbdWeak,
67-
nnbdStrong,
6849
readableTypeStrings,
6950
];
7051

71-
/// All modes that should be tested on a platform that support legacy code.
72-
static const legacy = [nnbdLegacy, nnbdWeak];
73-
7452
final String name;
7553

7654
const Feature._(this.name);

pkg/test_runner/lib/src/options.dart

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,6 @@ test options, specifying how tests should be run.''')
250250
hide: true, help: 'Path to safari browser executable.')
251251
..addFlag('use-sdk',
252252
aliases: ['use_sdk'], help: 'Use compiler or runtime from the SDK.')
253-
..addOption('nnbd',
254-
allowed: NnbdMode.names,
255-
defaultsTo: NnbdMode.strong.name,
256-
help: 'Which set of non-nullable type features to use.')
257253
..addOption('output-directory',
258254
aliases: ['output_directory'],
259255
defaultsTo: "logs",
@@ -408,7 +404,6 @@ has been specified on the command line.''')
408404
'compiler',
409405
'runtime',
410406
'timeout',
411-
'nnbd',
412407
'sanitizer',
413408
'enable-asserts',
414409
'use-cfe',
@@ -628,14 +623,13 @@ has been specified on the command line.''')
628623
}
629624

630625
var progress = Progress.find(data["progress"] as String);
631-
var nnbdMode = NnbdMode.find(data["nnbd"] as String);
632626

633627
void addConfiguration(Configuration innerConfiguration,
634628
[String? namedConfiguration]) {
635629
var configuration = TestConfiguration(
636630
configuration: innerConfiguration,
637631
progress: progress,
638-
selectors: _expandSelectors(data, innerConfiguration.nnbdMode),
632+
selectors: _expandSelectors(data),
639633
build: data["build"] as bool,
640634
testList: data["test-list-contents"] as List<String>?,
641635
repeat: int.parse(data["repeat"] as String),
@@ -784,7 +778,6 @@ has been specified on the command line.''')
784778
mode,
785779
runtime,
786780
system,
787-
nnbdMode: nnbdMode,
788781
sanitizer: sanitizer,
789782
timeout: timeout,
790783
enableAsserts: data['enable-asserts'] as bool,
@@ -819,7 +812,7 @@ has been specified on the command line.''')
819812
///
820813
/// If no selectors are explicitly given, uses the default suite patterns.
821814
Map<String, RegExp> _expandSelectors(
822-
Map<String, dynamic> configuration, NnbdMode nnbdMode) {
815+
Map<String, dynamic> configuration) {
823816
var selectors = configuration['selectors'] as List<String>? ?? [];
824817

825818
if (selectors.isEmpty || configuration['default-suites'] as bool) {
@@ -904,7 +897,7 @@ class OptionParseException implements Exception {
904897
/// given filter options.
905898
///
906899
/// If any of the options `--system`, `--arch`, `--mode`, `--compiler`,
907-
/// `--nnbd`, or `--runtime` (or their abbreviations) are passed, then only
900+
/// or `--runtime` (or their abbreviations) are passed, then only
908901
/// configurations matching those are shown.
909902
void findConfigurations(Map<String, dynamic> options) {
910903
var testMatrix = TestMatrix.fromPath('tools/bots/test_matrix.json');
@@ -935,11 +928,6 @@ void findConfigurations(Map<String, dynamic> options) {
935928
var compilers = [...(options['compiler'] as List<String>).map(Compiler.find)];
936929
var runtimes = [...(options['runtime'] as List<String>).map(Runtime.find)];
937930

938-
NnbdMode? nnbdMode;
939-
if (options.containsKey('nnbd')) {
940-
nnbdMode = NnbdMode.find(options['nnbd'] as String);
941-
}
942-
943931
var names = SplayTreeSet<String>();
944932
for (var configuration in testMatrix.configurations) {
945933
if (system != null && configuration.system != system) continue;
@@ -954,7 +942,6 @@ void findConfigurations(Map<String, dynamic> options) {
954942
if (runtimes.isNotEmpty && !runtimes.contains(configuration.runtime)) {
955943
continue;
956944
}
957-
if (nnbdMode != null && configuration.nnbdMode != nnbdMode) continue;
958945

959946
names.add(configuration.name);
960947
}
@@ -965,7 +952,6 @@ void findConfigurations(Map<String, dynamic> options) {
965952
if (modes.isNotEmpty) "mode=$modes",
966953
if (compilers.isNotEmpty) "compiler=$compilers",
967954
if (runtimes.isNotEmpty) "runtime=$runtimes",
968-
if (nnbdMode != null) "nnbd=$nnbdMode",
969955
];
970956

971957
if (filters.isEmpty) {

pkg/test_runner/lib/src/test_suite.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ class VMTestSuite extends TestSuite {
349349
if (expectations.contains(Expectation.crash)) '--suppress-core-dump',
350350
if (experiments.isNotEmpty)
351351
'--enable-experiment=${experiments.join(",")}',
352-
if (configuration.nnbdMode == NnbdMode.strong) '--sound-null-safety',
353352
...configuration.standardOptions,
354353
...configuration.vmOptions,
355354
test.name

pkg/test_runner/test/options_test.dart

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void main() {
1818
void testDefaults() {
1919
// TODO(rnystrom): Test other options.
2020
var configuration = parseConfiguration([]);
21-
Expect.equals(NnbdMode.strong, configuration.nnbdMode);
21+
Expect.equals(Progress.line, configuration.progress);
2222
}
2323

2424
void testOptions() {
@@ -28,15 +28,12 @@ void testOptions() {
2828
Expect.equals(Mode.debug, configurations[0].mode);
2929
Expect.equals(Mode.release, configurations[1].mode);
3030

31-
var configuration = parseConfiguration(['--nnbd=weak']);
32-
Expect.equals(NnbdMode.weak, configuration.nnbdMode);
33-
3431
// Filter invalid configurations when not passing a named configuration.
3532
configurations = parseConfigurations(['--arch=simarm', '--system=android']);
3633
Expect.isEmpty(configurations);
3734

3835
// Special handling for *-options.
39-
configuration = parseConfiguration([
36+
var configuration = parseConfiguration([
4037
'--dart2js-options=a b c',
4138
'--vm-options=d e f',
4239
'--shared-options=g h i'
@@ -90,25 +87,15 @@ void testValidation() {
9087
expectValidationError(['--progress=compact,silent'],
9188
'"compact,silent" is not an allowed value for option "--progress".');
9289

93-
expectValidationError(['--nnbd=unknown'],
94-
'"unknown" is not an allowed value for option "--nnbd".');
95-
// Don't allow multiple.
96-
expectValidationError(['--nnbd=weak,strong'],
97-
'"weak,strong" is not an allowed value for option "--nnbd".');
98-
9990
// Don't allow invalid named configurations.
10091
expectValidationError(['-ninvalid-vm-android-simarm'],
10192
'The named configuration "invalid-vm-android-simarm" is invalid.');
10293
}
10394

10495
void testSelectors() {
105-
// Default null safe suites.
106-
for (var arguments in [
107-
<String>[],
108-
['--nnbd=strong'],
109-
['-nvm-strong']
110-
]) {
111-
var configuration = parseConfiguration(arguments);
96+
// Default suites.
97+
{
98+
final configuration = parseConfiguration([]);
11299
Expect.setEquals({
113100
'samples',
114101
'standalone',
@@ -119,7 +106,7 @@ void testSelectors() {
119106
'lib',
120107
'kernel',
121108
'ffi',
122-
}, configuration.selectors.keys, "suites for $arguments");
109+
}, configuration.selectors.keys, "default suites");
123110
}
124111

125112
// The test runner can run individual tests by being given the

pkg/test_runner/test/test_file_test.dart

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import 'dart:io';
88

99
import 'package:expect/expect.dart';
10-
import 'package:test_runner/src/feature.dart';
1110
import 'package:test_runner/src/path.dart';
1211
import 'package:test_runner/src/static_error.dart';
1312
import 'package:test_runner/src/test_file.dart';
@@ -112,15 +111,13 @@ void testParseOtherOptions() {
112111
/\/ ddcOptions=ddc options
113112
/\/ OtherResources=other resources
114113
/\/ SharedObjects=shared objects
115-
/\/ Requirements=nnbd nnbd-strong
116114
""");
117115
Expect.listEquals(["dart", "options"], file.dartOptions);
118116
Expect.listEquals(["shared", "options"], file.sharedOptions);
119117
Expect.listEquals(["dart2js", "options"], file.dart2jsOptions);
120118
Expect.listEquals(["dart2wasm", "options"], file.dart2wasmOptions);
121119
Expect.listEquals(["ddc", "options"], file.ddcOptions);
122120
Expect.listEquals(["other", "resources"], file.otherResources);
123-
Expect.listEquals([Feature.nnbd, Feature.nnbdStrong], file.requirements);
124121

125122
// Disallows multiple lines for some options.
126123
expectParseThrows("""
@@ -143,10 +140,6 @@ void testParseOtherOptions() {
143140
/\/ ddcOptions=first
144141
/\/ ddcOptions=second
145142
""");
146-
expectParseThrows("""
147-
/\/ Requirements=nnbd
148-
/\/ Requirements=nnbd-strong
149-
""");
150143

151144
// Merges multiple lines for others.
152145
file = createTestFile(source: """

pkg/test_runner/test/test_matrix.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
"options": {
88
"compiler": "dartkp"
99
}
10-
},
11-
"vm-legacy": {},
12-
"vm-strong": {}
10+
}
1311
}
14-
}
12+
}

0 commit comments

Comments
 (0)