Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
| 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 /** | 6 /** |
| 7 * This file is the entrypoint of the dart test suite. This suite is used | 7 * This file is the entrypoint of the dart test suite. This suite is used |
| 8 * to test: | 8 * to test: |
| 9 * | 9 * |
| 10 * 1. the dart vm | 10 * 1. the dart vm |
| 11 * 2. the frog compiler (compiles dart to js) | 11 * 2. the frog compiler (compiles dart to js) |
| 12 * 3. the leg compiler (also compiles dart to js) | 12 * 3. the leg compiler (also compiles dart to js) |
| 13 * 4. the dartc static analyzer | 13 * 4. the dartc static analyzer |
| 14 * 5. the dart core library | 14 * 5. the dart core library |
| 15 * 6. other standard dart libraries (DOM bindings, ui libraries, | 15 * 6. other standard dart libraries (DOM bindings, ui libraries, |
| 16 * io libraries etc.) | 16 * io libraries etc.) |
| 17 * | 17 * |
| 18 * This script is normally invoked by test.py. (test.py finds the dart vm | 18 * This script is normally invoked by test.py. (test.py finds the dart vm |
| 19 * and passses along all command line arguments to this script.) | 19 * and passses along all command line arguments to this script.) |
| 20 * | 20 * |
| 21 * The command line args of this script are documented in | 21 * The command line args of this script are documented in |
| 22 * "tools/testing/test_options.dart". | 22 * "tools/testing/test_options.dart". |
| 23 * | 23 * |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #library("test"); | 26 #library("test"); |
| 27 | 27 |
| 28 #import("testing/dart/test_runner.dart"); | 28 #import("testing/dart/test_runner.dart"); |
| 29 #import("testing/dart/test_options.dart"); | 29 #import("testing/dart/test_options.dart"); |
| 30 #import("testing/dart/test_suite.dart"); | |
| 30 | 31 |
| 31 #import("../tests/co19/test_config.dart"); | 32 #import("../tests/co19/test_config.dart"); |
| 32 #import("../tests/corelib/test_config.dart"); | 33 #import("../tests/corelib/test_config.dart"); |
| 33 #import("../tests/isolate/test_config.dart"); | 34 #import("../tests/isolate/test_config.dart"); |
| 34 #import("../tests/language/test_config.dart"); | 35 #import("../tests/language/test_config.dart"); |
| 35 #import("../tests/standalone/test_config.dart"); | 36 #import("../tests/standalone/test_config.dart"); |
| 36 #import("../tests/utils/test_config.dart"); | 37 #import("../tests/utils/test_config.dart"); |
| 37 #import("../runtime/tests/vm/test_config.dart"); | 38 #import("../runtime/tests/vm/test_config.dart"); |
| 38 #import("../samples/tests/samples/test_config.dart"); | 39 #import("../samples/tests/samples/test_config.dart"); |
| 39 #import("../client/tests/dartc/test_config.dart"); | 40 #import("../client/tests/dartc/test_config.dart"); |
| 40 #import("../compiler/tests/dartc/test_config.dart"); | 41 #import("../compiler/tests/dartc/test_config.dart"); |
| 41 #import("../client/tests/client/test_config.dart"); | 42 #import("../client/tests/client/test_config.dart"); |
| 42 #import("../frog/tests/frog/test_config.dart"); | 43 #import("../frog/tests/frog/test_config.dart"); |
| 43 #import("../frog/tests/leg/test_config.dart"); | 44 #import("../frog/tests/leg/test_config.dart"); |
| 44 #import("../frog/tests/leg_only/test_config.dart"); | 45 #import("../frog/tests/leg_only/test_config.dart"); |
| 45 #import("../frog/tests/native/test_config.dart"); | 46 #import("../frog/tests/native/test_config.dart"); |
| 46 #import("../frog/tests/await/test_config.dart"); | 47 #import("../frog/tests/await/test_config.dart"); |
| 47 #import("../utils/tests/css/test_config.dart"); | 48 #import("../utils/tests/css/test_config.dart"); |
| 48 #import("../utils/tests/import_mapper/test_config.dart"); | 49 #import("../utils/tests/import_mapper/test_config.dart"); |
| 49 #import("../utils/tests/peg/test_config.dart"); | 50 #import("../utils/tests/peg/test_config.dart"); |
| 50 | 51 |
| 52 /** | |
| 53 * The directories that contain test suites which follow the conventions | |
| 54 * required by [DirectoryTestSuite]. Ideally, we'd move more suites to this | |
| 55 * convention because it makes it much simpler to add them to test.dart. (You | |
| 56 * basically add the directory here and you're done.) | |
| 57 */ | |
| 58 final TEST_SUITE_DIRECTORIES = const [ | |
| 59 'utils/tests/pub' | |
| 60 ]; | |
| 61 | |
| 51 main() { | 62 main() { |
| 52 var startTime = new Date.now(); | 63 var startTime = new Date.now(); |
| 53 var optionsParser = new TestOptionsParser(); | 64 var optionsParser = new TestOptionsParser(); |
| 54 List<Map> configurations = optionsParser.parse(new Options().arguments); | 65 List<Map> configurations = optionsParser.parse(new Options().arguments); |
| 55 if (configurations == null || configurations.length == 0) return; | 66 if (configurations == null || configurations.length == 0) return; |
| 56 | 67 |
| 57 // Extract global options from first configuration. | 68 // Extract global options from first configuration. |
| 58 var firstConf = configurations[0]; | 69 var firstConf = configurations[0]; |
| 59 Map<String, RegExp> selectors = firstConf['selectors']; | 70 Map<String, RegExp> selectors = firstConf['selectors']; |
| 60 var maxProcesses = firstConf['tasks']; | 71 var maxProcesses = firstConf['tasks']; |
| 61 var progressIndicator = firstConf['progress']; | 72 var progressIndicator = firstConf['progress']; |
| 62 var verbose = firstConf['verbose']; | 73 var verbose = firstConf['verbose']; |
| 63 var printTiming = firstConf['time']; | 74 var printTiming = firstConf['time']; |
| 64 var listTests = firstConf['list']; | 75 var listTests = firstConf['list']; |
| 65 var keepGeneratedTests = firstConf['keep-generated-tests']; | 76 var keepGeneratedTests = firstConf['keep-generated-tests']; |
| 66 | 77 |
| 67 // Print the configurations being run by this execution of | 78 // Print the configurations being run by this execution of |
| 68 // test.dart. However, don't do it if the silent progress indicator | 79 // test.dart. However, don't do it if the silent progress indicator |
| 69 // is used. This is only needed because of the junit tests. | 80 // is used. This is only needed because of the junit tests. |
| 70 if (progressIndicator != 'silent') { | 81 if (progressIndicator != 'silent') { |
| 71 StringBuffer sb = new StringBuffer('Test configuration'); | 82 StringBuffer sb = new StringBuffer('Test configuration'); |
| 72 sb.add(configurations.length > 1 ? 's:' : ':'); | 83 sb.add(configurations.length > 1 ? 's:' : ':'); |
| 73 for (Map conf in configurations) { | 84 for (Map conf in configurations) { |
| 74 sb.add(' ${conf["compiler"]}_${conf["runtime"]}_${conf["mode"]}_' + | 85 sb.add(' ${conf["compiler"]}_${conf["runtime"]}_${conf["mode"]}_' + |
| 75 '${conf["arch"]}'); | 86 '${conf["arch"]}'); |
| 76 if (conf['checked']) sb.add('_checked'); | 87 if (conf['checked']) sb.add('_checked'); |
| 77 } | 88 } |
| 78 print(sb); | 89 print(sb); |
| 79 } | 90 } |
| 80 | 91 |
| 81 var configurationIterator = configurations.iterator(); | 92 var configurationIterator = configurations.iterator(); |
| 82 bool enqueueConfiguration(ProcessQueue queue) { | 93 bool enqueueConfiguration(ProcessQueue queue) { |
| 83 if (!configurationIterator.hasNext()) { | 94 if (!configurationIterator.hasNext()) { |
| 84 return false; | 95 return false; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 if (selectors.containsKey('peg')) { | 148 if (selectors.containsKey('peg')) { |
| 138 queue.addTestSuite(new PegTestSuite(conf)); | 149 queue.addTestSuite(new PegTestSuite(conf)); |
| 139 } | 150 } |
| 140 if (selectors.containsKey('await')) { | 151 if (selectors.containsKey('await')) { |
| 141 queue.addTestSuite(new AwaitTestSuite(conf)); | 152 queue.addTestSuite(new AwaitTestSuite(conf)); |
| 142 } | 153 } |
| 143 if (selectors.containsKey('client')) { | 154 if (selectors.containsKey('client')) { |
| 144 queue.addTestSuite(new ClientTestSuite(conf)); | 155 queue.addTestSuite(new ClientTestSuite(conf)); |
| 145 } | 156 } |
| 146 | 157 |
| 158 for (final testSuiteDir in TEST_SUITE_DIRECTORIES) { | |
| 159 final name = testSuiteDir.substring(testSuiteDir.lastIndexOf('/') + 1); | |
| 160 if (selectors.containsKey(name)) { | |
| 161 queue.addTestSuite(new DirectoryTestSuite(conf, testSuiteDir)); | |
|
Bill Hesse
2012/03/28 23:37:30
I would rather call this StandardTestSuite, and ei
Bob Nystrom
2012/03/29 00:10:17
Great idea. Done.
| |
| 162 } | |
| 163 } | |
| 164 | |
| 147 return true; | 165 return true; |
| 148 } | 166 } |
| 149 | 167 |
| 150 // Start process queue. | 168 // Start process queue. |
| 151 var queue = new ProcessQueue(maxProcesses, | 169 var queue = new ProcessQueue(maxProcesses, |
| 152 progressIndicator, | 170 progressIndicator, |
| 153 startTime, | 171 startTime, |
| 154 printTiming, | 172 printTiming, |
| 155 enqueueConfiguration, | 173 enqueueConfiguration, |
| 156 verbose, | 174 verbose, |
| 157 listTests, | 175 listTests, |
| 158 keepGeneratedTests); | 176 keepGeneratedTests); |
| 159 } | 177 } |
| OLD | NEW |