Change test script to prefer a named configuration when possible.

The VM requires some special options that are only provided by the test
matrix when running using a named config, so try to use a named
configuration when possible.

Change-Id: Ie725cbcfea5b02a35885b0601dc0c78f81e3917e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142940
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
Robert Nystrom 2020-04-09 00:24:46 +00:00 committed by commit-bot@chromium.org
parent a7e3c5507f
commit ed0f2ae768

View file

@ -20,10 +20,18 @@ const compilerNames = {
"vm": "dartk",
};
const configurations = {
"analyzer": "analyzer-asserts-strong-linux",
"cfe": "cfe-strong-linux",
"dart2js": "dart2js-weak-linux-x64-d8",
"ddc": "dartdevk-strong-linux-release-chrome",
"vm": "dartk-strong-linux-release-x64",
};
void main(List<String> arguments) async {
var testDir = "";
var isLegacy = false;
var compilers = <String>[];
var compiler = "ddc";
var argParser = ArgParser();
argParser.addFlag("legacy",
@ -31,13 +39,11 @@ void main(List<String> arguments) async {
negatable: false,
callback: (flag) => isLegacy = flag);
argParser.addMultiOption("compiler",
argParser.addOption("configuration",
abbr: "c",
help: "Which Dart implementations to run the tests on.",
help: "Which Dart implementation to run the tests on.",
allowed: ["analyzer", "cfe", "dart2js", "ddc", "vm"],
callback: (implementations) {
compilers.addAll(implementations.map((name) => compilerNames[name]));
});
callback: (option) => compiler = option as String);
if (arguments.contains("--help")) {
showUsage(argParser);
@ -61,15 +67,29 @@ void main(List<String> arguments) async {
if (!isLegacy) testDir = toNnbdPath(testDir);
var testArgs = [
"--mode=release",
if (!isLegacy) ...[
"--enable-experiment=non-nullable",
"--nnbd=strong",
],
"--compiler=${compilers.join(',')}",
testDir,
];
// DDC doesn't have a Mac bot so when running DDC tests on a Mac, use a manual
// configuration. Otherwise, use the right named configuration.
List<String> testArgs;
if (Platform.isLinux || compiler != "ddc") {
var configuration = configurations[compiler];
if (!Platform.isLinux) {
// TODO(rnystrom): We'll probably never need to run this script on
// Windows, but if we do... do that.
configuration = configuration.replaceAll("linux", "mac");
}
testArgs = ["-n$configuration", testDir];
} else {
testArgs = [
"--mode=release",
if (!isLegacy) ...[
"--enable-experiment=non-nullable",
"--nnbd=strong",
],
"--compiler=${compilerNames[compiler]}",
testDir,
];
}
print("Running tools/test.py ${testArgs.join(' ')}");
await runProcessAsync("tools/test.py", testArgs);