[testing] Simplify test.py arguments for null safety testing
test.py invocations that specify a null safety mode will now work without tool specific options. For instance, `test.py --nnbd=strong -cdartkp -mrelease` will now add the `non-nullable` experiment flag as well as the pass `--sound-null-safety` to the relevant subcommands. Fixes https://github.com/dart-lang/sdk/issues/42370 Change-Id: I1ae5bf569cc77ed6f26411c171c2cafe0a12eaff Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164160 Reviewed-by: Bob Nystrom <rnystrom@google.com> Commit-Queue: Alexander Thomas <athom@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
d966206c6d
commit
c34eef4fd8
@@ -25,12 +25,30 @@ List<String> _replaceDartFiles(List<String> list, String replacement) {
|
||||
/// list allows the result of calling this to be spread into another list.
|
||||
List<String> _experimentsArgument(
|
||||
TestConfiguration configuration, TestFile testFile) {
|
||||
if (configuration.experiments.isEmpty && testFile.experiments.isEmpty) {
|
||||
var experiments = {
|
||||
...configuration.experiments,
|
||||
...testFile.experiments,
|
||||
if (configuration.nnbdMode != NnbdMode.legacy)
|
||||
'non-nullable',
|
||||
};
|
||||
if (experiments.isEmpty) {
|
||||
return const [];
|
||||
}
|
||||
|
||||
var experiments = {...configuration.experiments, ...testFile.experiments};
|
||||
return ["--enable-experiment=${experiments.join(',')}"];
|
||||
return ['--enable-experiment=${experiments.join(',')}'];
|
||||
}
|
||||
|
||||
List<String> _nnbdModeArgument(TestConfiguration configuration) {
|
||||
switch (configuration.nnbdMode) {
|
||||
case NnbdMode.legacy:
|
||||
return [];
|
||||
case NnbdMode.strong:
|
||||
return ['--sound-null-safety'];
|
||||
case NnbdMode.weak:
|
||||
return ['--no-sound-null-safety'];
|
||||
}
|
||||
|
||||
throw 'unreachable';
|
||||
}
|
||||
|
||||
/// Grouping of a command with its expected result.
|
||||
@@ -175,6 +193,7 @@ class NoneCompilerConfiguration extends CompilerConfiguration {
|
||||
else if (_configuration.hotReloadRollback)
|
||||
'--hot-reload-rollback-test-mode',
|
||||
...vmOptions,
|
||||
..._nnbdModeArgument(_configuration),
|
||||
...testFile.sharedOptions,
|
||||
..._configuration.sharedOptions,
|
||||
..._experimentsArgument(_configuration, testFile),
|
||||
@@ -426,13 +445,18 @@ class Dart2jsCompilerConfiguration extends Dart2xCompilerConfiguration {
|
||||
..._configuration.sharedOptions,
|
||||
..._experimentsArgument(_configuration, testFile),
|
||||
...testFile.dart2jsOptions,
|
||||
..._nnbdModeArgument(_configuration),
|
||||
...args
|
||||
];
|
||||
}
|
||||
|
||||
CommandArtifact computeCompilationArtifact(String tempDir,
|
||||
List<String> arguments, Map<String, String> environmentOverrides) {
|
||||
var compilerArguments = [...arguments, ..._configuration.dart2jsOptions];
|
||||
var compilerArguments = [
|
||||
...arguments,
|
||||
..._configuration.dart2jsOptions,
|
||||
..._nnbdModeArgument(_configuration),
|
||||
];
|
||||
|
||||
// TODO(athom): input filename extraction is copied from DDC. Maybe this
|
||||
// should be passed to computeCompilationArtifact, instead?
|
||||
@@ -729,9 +753,14 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
|
||||
static const String ndkPath = "third_party/android_tools/ndk";
|
||||
String get abiTriple => _isArm || _isArmX64
|
||||
? "arm-linux-androideabi"
|
||||
: _isArm64 ? "aarch64-linux-android" : null;
|
||||
String get host =>
|
||||
Platform.isLinux ? "linux" : Platform.isMacOS ? "darwin" : null;
|
||||
: _isArm64
|
||||
? "aarch64-linux-android"
|
||||
: null;
|
||||
String get host => Platform.isLinux
|
||||
? "linux"
|
||||
: Platform.isMacOS
|
||||
? "darwin"
|
||||
: null;
|
||||
|
||||
Command computeAssembleCommand(String tempDir, List arguments,
|
||||
Map<String, String> environmentOverrides) {
|
||||
@@ -1104,6 +1133,7 @@ abstract class VMKernelCompilerMixin {
|
||||
arguments.contains('--enable-asserts') ||
|
||||
arguments.contains('--enable_asserts'))
|
||||
'--enable-asserts',
|
||||
..._nnbdModeArgument(_configuration),
|
||||
..._configuration.genKernelOptions,
|
||||
];
|
||||
|
||||
|
||||
+5
-114
@@ -398,10 +398,7 @@
|
||||
"enable-asserts": true,
|
||||
"mode": "release",
|
||||
"runtime": "vm",
|
||||
"timeout": 240,
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
]
|
||||
"timeout": 240
|
||||
}
|
||||
},
|
||||
"analyzer-unittest-asserts-(debug|product|release)-(linux|mac|win)": {
|
||||
@@ -516,12 +513,6 @@
|
||||
"dart2js-weak-(linux|mac|win)-x64-d8": {
|
||||
"options": {
|
||||
"builder-tag": "dart2js-weak",
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
],
|
||||
"dart2js-options": [
|
||||
"--no-sound-null-safety"
|
||||
],
|
||||
"use-sdk": true
|
||||
}
|
||||
},
|
||||
@@ -576,11 +567,7 @@
|
||||
"dart2js-hostasserts-weak-(linux|win)-x64-(d8|chrome)": {
|
||||
"options": {
|
||||
"builder-tag": "dart2js-weak",
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
],
|
||||
"dart2js-options": [
|
||||
"--no-sound-null-safety",
|
||||
"--libraries-spec=sdk/lib/libraries.json",
|
||||
"--platform-binaries=out/ReleaseX64/"
|
||||
],
|
||||
@@ -591,11 +578,7 @@
|
||||
"dart2js-hostasserts-weak-mac-x64-(d8|chrome)": {
|
||||
"options": {
|
||||
"builder-tag": "dart2js-weak",
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
],
|
||||
"dart2js-options": [
|
||||
"--no-sound-null-safety",
|
||||
"--libraries-spec=sdk/lib/libraries.json",
|
||||
"--platform-binaries=xcodebuild/ReleaseX64/"
|
||||
],
|
||||
@@ -606,11 +589,7 @@
|
||||
"dart2js-hostasserts-strong-(linux|win)-x64-(d8|chrome)": {
|
||||
"options": {
|
||||
"builder-tag": "dart2js-strong",
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
],
|
||||
"dart2js-options": [
|
||||
"--sound-null-safety",
|
||||
"--libraries-spec=sdk/lib/libraries.json",
|
||||
"--platform-binaries=out/ReleaseX64/"
|
||||
],
|
||||
@@ -621,11 +600,7 @@
|
||||
"dart2js-hostasserts-strong-mac-x64-(d8|chrome)": {
|
||||
"options": {
|
||||
"builder-tag": "dart2js-strong",
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
],
|
||||
"dart2js-options": [
|
||||
"--sound-null-safety",
|
||||
"--libraries-spec=sdk/lib/libraries.json",
|
||||
"--platform-binaries=xcodebuild/ReleaseX64/"
|
||||
],
|
||||
@@ -710,115 +685,49 @@
|
||||
},
|
||||
"dartkp-weak-asserts-(linux|mac)-(debug|product|release)-x64": {
|
||||
"options": {
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
],
|
||||
"gen-kernel-options": [
|
||||
"--no-sound-null-safety"
|
||||
],
|
||||
"enable-asserts": true,
|
||||
"vm-options": [
|
||||
"--no-sound-null-safety"
|
||||
],
|
||||
"builder-tag": "vm_nnbd"
|
||||
}
|
||||
},
|
||||
"dartkp-weak-asserts-(linux|mac)-(debug|product|release)-simarm64": {
|
||||
"options": {
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
],
|
||||
"gen-kernel-options": [
|
||||
"--no-sound-null-safety"
|
||||
],
|
||||
"enable-asserts": true,
|
||||
"use-elf": true,
|
||||
"vm-options": [
|
||||
"--no-sound-null-safety"
|
||||
],
|
||||
"builder-tag": "vm_nnbd"
|
||||
}
|
||||
},
|
||||
"dartkp-weak-asserts-win-(debug|product|release)-(simarm64|x64)": {
|
||||
"options": {
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
],
|
||||
"gen-kernel-options": [
|
||||
"--no-sound-null-safety"
|
||||
],
|
||||
"enable-asserts": true,
|
||||
"use-elf": true,
|
||||
"vm-options": [
|
||||
"--no-sound-null-safety"
|
||||
],
|
||||
"builder-tag": "vm_nnbd"
|
||||
}
|
||||
},
|
||||
"dartk-weak-asserts-(linux|mac|win)-(debug|product|release)-x64": {
|
||||
"options": {
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
],
|
||||
"enable-asserts": true,
|
||||
"vm-options": [
|
||||
"--no-sound-null-safety"
|
||||
],
|
||||
"builder-tag": "vm_nnbd"
|
||||
}
|
||||
},
|
||||
"dartk-strong-(linux|mac|win)-(debug|product|release)-x64": {
|
||||
"options": {
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
],
|
||||
"vm-options": [
|
||||
"--sound-null-safety"
|
||||
],
|
||||
"builder-tag": "vm_nnbd"
|
||||
}
|
||||
},
|
||||
"dartkp-strong-(linux|mac)-(debug|product|release)-x64": {
|
||||
"options": {
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
],
|
||||
"gen-kernel-options": [
|
||||
"--sound-null-safety"
|
||||
],
|
||||
"vm-options": [
|
||||
"--sound-null-safety"
|
||||
],
|
||||
"builder-tag": "vm_nnbd"
|
||||
}
|
||||
},
|
||||
"dartkp-strong-(linux|mac)-(debug|product|release)-simarm64": {
|
||||
"options": {
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
],
|
||||
"gen-kernel-options": [
|
||||
"--sound-null-safety"
|
||||
],
|
||||
"use-elf": true,
|
||||
"vm-options": [
|
||||
"--sound-null-safety"
|
||||
],
|
||||
"builder-tag": "vm_nnbd"
|
||||
}
|
||||
},
|
||||
"dartkp-strong-win-(debug|product|release)-(simarm64|x64)": {
|
||||
"options": {
|
||||
"use-elf": true,
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
],
|
||||
"gen-kernel-options": [
|
||||
"--sound-null-safety"
|
||||
],
|
||||
"vm-options": [
|
||||
"--sound-null-safety"
|
||||
],
|
||||
"builder-tag": "vm_nnbd"
|
||||
}
|
||||
},
|
||||
@@ -868,9 +777,6 @@
|
||||
"options": {
|
||||
"checked": true,
|
||||
"use-sdk": true,
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
],
|
||||
"enable-asserts": true
|
||||
}
|
||||
},
|
||||
@@ -878,9 +784,6 @@
|
||||
"options": {
|
||||
"checked": true,
|
||||
"use-sdk": true,
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
],
|
||||
"enable-asserts": true
|
||||
}
|
||||
},
|
||||
@@ -891,18 +794,12 @@
|
||||
},
|
||||
"cfe-weak-(linux|mac|win)": {
|
||||
"options": {
|
||||
"compiler": "fasta",
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
]
|
||||
"compiler": "fasta"
|
||||
}
|
||||
},
|
||||
"cfe-strong-(linux|mac|win)": {
|
||||
"options": {
|
||||
"compiler": "fasta",
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
]
|
||||
"compiler": "fasta"
|
||||
}
|
||||
},
|
||||
"analyzer-(linux|mac|win)": {
|
||||
@@ -922,20 +819,14 @@
|
||||
"options": {
|
||||
"compiler": "dart2analyzer",
|
||||
"enable-asserts": true,
|
||||
"use-sdk": true,
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
]
|
||||
"use-sdk": true
|
||||
}
|
||||
},
|
||||
"analyzer-asserts-weak-(linux|mac|win)": {
|
||||
"options": {
|
||||
"compiler": "dart2analyzer",
|
||||
"enable-asserts": true,
|
||||
"use-sdk": true,
|
||||
"enable-experiment": [
|
||||
"non-nullable"
|
||||
]
|
||||
"use-sdk": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user