| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /// Runs the tests in a batch on the various configurations used on the bots. | 5 /// Runs the tests in a batch on the various configurations used on the bots. |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:args/args.dart'; | 10 import 'package:args/args.dart'; |
| 11 import 'package:path/path.dart' as p; | 11 import 'package:path/path.dart' as p; |
| 12 | 12 |
| 13 import 'package:migration/src/fork.dart'; | 13 import 'package:migration/src/fork.dart'; |
| 14 import 'package:migration/src/log.dart'; | 14 import 'package:migration/src/log.dart'; |
| 15 | 15 |
| 16 const appJit = "--compiler=app_jit"; | 16 const appJit = "--compiler=app_jit"; |
| 17 const dart2js = "--compiler=dart2js"; | 17 const dart2js = "--compiler=dart2js"; |
| 18 const dartdevc = "--compiler=dartdevc"; | 18 const dartdevc = "--compiler=dartdevc"; |
| 19 const noCompiler = "--compiler=none"; | 19 const noCompiler = "--compiler=none"; |
| 20 const precompiler = "--compiler=precompiler"; | 20 const precompiler = "--compiler=precompiler"; |
| 21 const analyzer = "--compiler=dart2analyzer"; | 21 const analyzer = "--compiler=dart2analyzer"; |
| 22 const dartk = "--compiler=dartk"; | 22 const dartk = "--compiler=dartk"; |
| 23 | 23 |
| 24 const chrome = "--runtime=chrome"; | 24 const chrome = "--runtime=chrome"; |
| 25 const precompiled = "--runtime=dart_precompiled"; | 25 const precompiled = "--runtime=dart_precompiled"; |
| 26 const noRuntime = "--runtime=none"; | 26 const noRuntime = "--runtime=none"; |
| 27 const vm = "--runtime=vm"; | 27 const vm = "--runtime=vm"; |
| 28 const d8 = "--runtime=d8"; |
| 28 const jsshell = "--runtime=jsshell"; | 29 const jsshell = "--runtime=jsshell"; |
| 29 | 30 |
| 30 const checked = "--checked"; | 31 const checked = "--checked"; |
| 31 const dart2jsBatch = "--dart2js-batch"; | 32 const dart2jsBatch = "--dart2js-batch"; |
| 32 const fastStartup = "--fast-startup"; | 33 const fastStartup = "--fast-startup"; |
| 33 const useSdk = "--use-sdk"; | 34 const useSdk = "--use-sdk"; |
| 34 const releaseMode = "--mode=release"; | 35 const releaseMode = "--mode=release"; |
| 35 const productMode = "--mode=product"; | 36 const productMode = "--mode=product"; |
| 36 const strong = "--strong"; | 37 const strong = "--strong"; |
| 37 | 38 |
| 38 /// Maps configuration names to a corresponding set of test.dart command line | 39 /// Maps configuration names to a corresponding set of test.dart command line |
| 39 /// arguments. | 40 /// arguments. |
| 40 /// | 41 /// |
| 41 /// Each configuration name starts with the name of a column on the buildbot | 42 /// Each configuration name starts with the name of a column on the buildbot |
| 42 /// waterfall (except for "dartjs-linux" which is just called "dart2js" here) | 43 /// waterfall (except for "dartjs-linux" which is just called "dart2js" here) |
| 43 /// possibly followed by some modifier for a specific bot or annotated step on | 44 /// possibly followed by some modifier for a specific bot or annotated step on |
| 44 /// a bot. The configs here are ordered the same order as the waterfall. | 45 /// a bot. The configs here are ordered the same order as the waterfall. |
| 45 final allConfigs = { | 46 final allConfigs = { |
| 46 "vm": [noCompiler, vm], | 47 "vm": [noCompiler, vm], |
| 47 "vm-checked": [noCompiler, vm, checked], | 48 "vm-checked": [noCompiler, vm, checked], |
| 48 "vm-app": [appJit, vm], | 49 "vm-app": [appJit, vm], |
| 49 "vm-app-product": [productMode, appJit, vm], | 50 "vm-app-product": [productMode, appJit, vm], |
| 50 "vm-kernel": [dartk, releaseMode, vm], | 51 "vm-kernel": [dartk, releaseMode, vm], |
| 51 "vm-precomp": [precompiler, precompiled], | 52 "vm-precomp": [precompiler, precompiled], |
| 52 "vm-product": [productMode, noCompiler, vm], | 53 "vm-product": [productMode, noCompiler, vm], |
| 53 // TODO(rnystrom): Add dart2js-d8-hostchecked, dart2js-d8-minified, or | 54 // TODO(rnystrom): Add dart2js-d8-hostchecked, dart2js-d8-minified, or |
| 54 // dart2js-jsshell? | 55 // dart2js-jsshell? |
| 55 "analyzer": [analyzer, noRuntime, useSdk], | 56 "analyzer": [analyzer, noRuntime, useSdk], |
| 56 "analyzer-checked": [analyzer, noRuntime, checked, useSdk], | 57 "analyzer-checked": [analyzer, noRuntime, checked, useSdk], |
| 57 "analyzer-strong": [analyzer, noRuntime, checked, strong, useSdk], | 58 "analyzer-checked-strong": [analyzer, noRuntime, checked, strong, useSdk], |
| 59 "analyzer-strong": [analyzer, noRuntime, strong, useSdk], |
| 58 "dart2js": [dart2js, chrome, useSdk, dart2jsBatch], | 60 "dart2js": [dart2js, chrome, useSdk, dart2jsBatch], |
| 61 "dart2js-d8-checked": [dart2js, d8, checked, fastStartup, useSdk, dart2jsBatch
], |
| 59 "dart2js-jsshell": [dart2js, jsshell, fastStartup, useSdk, dart2jsBatch], | 62 "dart2js-jsshell": [dart2js, jsshell, fastStartup, useSdk, dart2jsBatch], |
| 60 // TODO(rnystrom): Is it worth running dart2js on Firefox too? | 63 // TODO(rnystrom): Is it worth running dart2js on Firefox too? |
| 61 "dartdevc": [dartdevc, chrome, useSdk, strong], | 64 "dartdevc": [dartdevc, chrome, useSdk, strong], |
| 62 }; | 65 }; |
| 63 | 66 |
| 64 final buildSteps = [ | 67 final buildSteps = [ |
| 65 // The SDK, which also builds the VM. | 68 // The SDK, which also builds the VM. |
| 66 ["--mode=release", "create_sdk"], | 69 ["--mode=release", "create_sdk"], |
| 67 // The kernel service. | 70 // The kernel service. |
| 68 ["--mode=release", "kernel-service"], | 71 ["--mode=release", "kernel-service"], |
| (...skipping 11 matching lines...) Expand all Loading... |
| 80 argParser.addOption("config", | 83 argParser.addOption("config", |
| 81 abbr: "c", allowMultiple: true, help: "Which configurations to run."); | 84 abbr: "c", allowMultiple: true, help: "Which configurations to run."); |
| 82 argParser.addFlag("help"); | 85 argParser.addFlag("help"); |
| 83 | 86 |
| 84 var argResults = argParser.parse(arguments); | 87 var argResults = argParser.parse(arguments); |
| 85 if (argResults["help"] as bool) { | 88 if (argResults["help"] as bool) { |
| 86 usage(argParser); | 89 usage(argParser); |
| 87 return; | 90 return; |
| 88 } | 91 } |
| 89 | 92 |
| 90 if (argResults.rest.length != 2) { | 93 var remainingArgs = []..addAll(argResults.rest); |
| 94 |
| 95 if (remainingArgs.length == 1) { |
| 96 remainingArgs.add(remainingArgs.first); |
| 97 } |
| 98 |
| 99 if (remainingArgs.length != 2) { |
| 91 usage(argParser); | 100 usage(argParser); |
| 92 exit(1); | 101 exit(1); |
| 93 } | 102 } |
| 94 | 103 |
| 95 var build = argResults["build"] as bool; | 104 var build = argResults["build"] as bool; |
| 96 var configs = argResults["config"] as List<String>; | 105 var configs = argResults["config"] as List<String>; |
| 97 if (configs.isEmpty) configs = allConfigs.keys.toList(); | 106 if (configs.isEmpty) configs = allConfigs.keys.toList(); |
| 98 | 107 |
| 99 var tests = scanTests(); | 108 var tests = scanTests(); |
| 100 | 109 |
| 101 var startIndex = findFork(tests, argResults.rest[0]); | 110 var startIndex = findFork(tests, remainingArgs[0]); |
| 102 var endIndex = findFork(tests, argResults.rest[1]); | 111 var endIndex = findFork(tests, remainingArgs[1]); |
| 103 | 112 |
| 104 if (startIndex == null || endIndex == null) exit(1); | 113 if (startIndex == null || endIndex == null) exit(1); |
| 105 | 114 |
| 106 tests = tests.sublist(startIndex, endIndex + 1); | 115 tests = tests.sublist(startIndex, endIndex + 1); |
| 107 | 116 |
| 108 if (tests.isEmpty) { | 117 if (tests.isEmpty) { |
| 109 print("No tests in range."); | 118 print("No tests in range."); |
| 110 return; | 119 return; |
| 111 } | 120 } |
| 112 | 121 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 var s = failed == 1 ? "" : "s"; | 182 var s = failed == 1 ? "" : "s"; |
| 174 print("${red("FAILED")} ${bold(failed.length)} configuration$s:"); | 183 print("${red("FAILED")} ${bold(failed.length)} configuration$s:"); |
| 175 for (var config in failed) { | 184 for (var config in failed) { |
| 176 print("- ${bold(config)}"); | 185 print("- ${bold(config)}"); |
| 177 } | 186 } |
| 178 } | 187 } |
| 179 } | 188 } |
| 180 | 189 |
| 181 void usage(ArgParser parser) { | 190 void usage(ArgParser parser) { |
| 182 print("Usage: dart run_tests.dart [--build] [--configs=...] " | 191 print("Usage: dart run_tests.dart [--build] [--configs=...] " |
| 183 "<first file> <last file>"); | 192 "<first file> [last file]"); |
| 184 print("\n"); | 193 print("\n"); |
| 185 print("Example:"); | 194 print("Example:"); |
| 186 print("\n"); | 195 print("\n"); |
| 187 print(" \$ dart run_tests.dart map_to_string queue"); | 196 print(" \$ dart run_tests.dart map_to_string queue"); |
| 188 print("\n"); | 197 print("\n"); |
| 189 print(parser.usage); | 198 print(parser.usage); |
| 190 } | 199 } |
| 191 | 200 |
| 192 Future<int> run(String executable, List<String> arguments) async { | 201 Future<int> run(String executable, List<String> arguments) async { |
| 193 var process = await Process.start(executable, arguments); | 202 var process = await Process.start(executable, arguments); |
| 194 process.stdout.listen((bytes) { | 203 process.stdout.listen((bytes) { |
| 195 stdout.add(bytes); | 204 stdout.add(bytes); |
| 196 }); | 205 }); |
| 197 | 206 |
| 198 process.stderr.listen((bytes) { | 207 process.stderr.listen((bytes) { |
| 199 stderr.add(bytes); | 208 stderr.add(bytes); |
| 200 }); | 209 }); |
| 201 | 210 |
| 202 return await process.exitCode; | 211 return await process.exitCode; |
| 203 } | 212 } |
| OLD | NEW |