| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
| 6 * Tool for running co19 tests. Used when updating co19. | 6 * Tool for running co19 tests. Used when updating co19. |
| 7 * | 7 * |
| 8 * Currently, this tool is merely a convenience around multiple | 8 * Currently, this tool is merely a convenience around multiple |
| 9 * invocations of test.dart. Long term, we hope to evolve this into a | 9 * invocations of test.dart. Long term, we hope to evolve this into a |
| 10 * script that can automate most of the tasks necessary when updating | 10 * script that can automate most of the tasks necessary when updating |
| 11 * co19. | 11 * co19. |
| 12 * | 12 * |
| 13 * Usage: | 13 * Usage: |
| 14 * [: ./tools/testing/bin/$OS/dart tools/testing/dart/co19_test.dart :] | 14 * [: ./tools/testing/bin/$OS/dart tools/testing/dart/co19_test.dart :] |
| 15 */ | 15 */ |
| 16 | 16 |
| 17 library co19_test; | 17 library co19_test; |
| 18 | 18 |
| 19 import "dart:io"; | 19 import "dart:io"; |
| 20 import "test_runner.dart"; | 20 import "test_runner.dart"; |
| 21 import "test_options.dart"; | 21 import "test_options.dart"; |
| 22 import "test_suite.dart"; | 22 import "test_suite.dart"; |
| 23 import "test_progress.dart"; | 23 import "test_progress.dart"; |
| 24 import "../../test.dart" as test_dart; |
| 24 | 25 |
| 25 import "../../../tests/co19/test_config.dart"; | 26 import "../../../tests/co19/test_config.dart"; |
| 26 | 27 |
| 27 const List<String> COMMON_ARGUMENTS = const <String>['--report']; | 28 const List<String> COMMON_ARGUMENTS = const <String>['--report']; |
| 28 | 29 |
| 29 const List<List<String>> COMMAND_LINES = const <List<String>>[ | 30 const List<List<String>> COMMAND_LINES = const <List<String>>[ |
| 30 const <String>['-mrelease,debug', '-rvm', '-cnone'], | 31 const <String>['-mrelease,debug', '-rvm', '-cnone'], |
| 31 const <String>['-mrelease,debug', '-rvm', '-cnone', '--checked'], | 32 const <String>['-mrelease,debug', '-rvm', '-cnone', '--checked'], |
| 32 const <String>['-mrelease', '-rnone', '-cdartc'], | 33 const <String>['-mrelease', '-rnone', '-cdartc'], |
| 33 const <String>['-mrelease', '-rvm', '-cdart2dart'], | 34 const <String>['-mrelease', '-rvm', '-cdart2dart'], |
| 34 const <String>['-mrelease', '-rd8', '-cdart2js', '--use-sdk'], | 35 const <String>['-mrelease', '-rd8', '-cdart2js', '--use-sdk'], |
| 35 const <String>['-mrelease', '-rd8', '-cdart2js', '--use-sdk', '--checked']]; | 36 const <String>['-mrelease', '-rd8', '-cdart2js', '--use-sdk', '--checked']]; |
| 36 | 37 |
| 37 void main() { | 38 void main() { |
| 38 Options options = new Options(); | 39 Options options = new Options(); |
| 39 File scriptFile = new File(options.script); | 40 File scriptFile = new File(options.script); |
| 40 Path scriptPath = | 41 Path scriptPath = |
| 41 new Path(scriptFile.fullPathSync()) | 42 new Path(scriptFile.fullPathSync()) |
| 42 .directoryPath.directoryPath.directoryPath.append('test.dart'); | 43 .directoryPath.directoryPath.directoryPath.append('test.dart'); |
| 43 TestUtils.testScriptPath = scriptPath.toNativePath(); | 44 TestUtils.testScriptPath = scriptPath.toNativePath(); |
| 44 var startTime = new DateTime.now(); | |
| 45 var optionsParser = new TestOptionsParser(); | 45 var optionsParser = new TestOptionsParser(); |
| 46 List<Map> configurations = <Map>[]; | 46 List<Map> configurations = <Map>[]; |
| 47 for (var commandLine in COMMAND_LINES) { | 47 for (var commandLine in COMMAND_LINES) { |
| 48 List arguments = <String>[]; | 48 List arguments = <String>[]; |
| 49 arguments.addAll(COMMON_ARGUMENTS); | 49 arguments.addAll(COMMON_ARGUMENTS); |
| 50 arguments.addAll(options.arguments); | 50 arguments.addAll(options.arguments); |
| 51 arguments.addAll(commandLine); | 51 arguments.addAll(commandLine); |
| 52 arguments.add('co19'); | 52 arguments.add('co19'); |
| 53 arguments.add('--progress=diff'); |
| 53 configurations.addAll(optionsParser.parse(arguments)); | 54 configurations.addAll(optionsParser.parse(arguments)); |
| 54 } | 55 } |
| 55 if (configurations == null || configurations.isEmpty) return; | |
| 56 | 56 |
| 57 var firstConfiguration = configurations[0]; | 57 if (configurations != null || configurations.length > 0) { |
| 58 Map<String, RegExp> selectors = firstConfiguration['selectors']; | 58 test_dart.testConfigurations(configurations); |
| 59 var maxProcesses = firstConfiguration['tasks']; | 59 } |
| 60 var verbose = firstConfiguration['verbose']; | 60 } |
| 61 var listTests = firstConfiguration['list']; | |
| 62 | 61 |
| 63 var configurationIterator = configurations.iterator; | |
| 64 void enqueueConfiguration(ProcessQueue queue) { | |
| 65 if (!configurationIterator.moveNext()) return; | |
| 66 var configuration = configurationIterator.current; | |
| 67 for (String selector in selectors.keys) { | |
| 68 if (selector == 'co19') { | |
| 69 queue.addTestSuite(new Co19TestSuite(configuration)); | |
| 70 } else { | |
| 71 throw 'Error: unexpected selector: "$selector".'; | |
| 72 } | |
| 73 } | |
| 74 } | |
| 75 | |
| 76 // Start process queue. | |
| 77 var queue = new ProcessQueue(maxProcesses, | |
| 78 'diff', | |
| 79 startTime, | |
| 80 false, | |
| 81 enqueueConfiguration, | |
| 82 () {}, | |
| 83 verbose, | |
| 84 listTests); | |
| 85 } | |
| OLD | NEW |