| OLD | NEW |
| 1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
| 2 // Copyright (c) 2013, 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 dart2js compiler | 11 * 2. the dart2js compiler |
| 12 * 3. the dartc static analyzer | 12 * 3. the dartc static analyzer |
| 13 * 4. the dart core library | 13 * 4. the dart core library |
| 14 * 5. other standard dart libraries (DOM bindings, ui libraries, | 14 * 5. other standard dart libraries (DOM bindings, ui libraries, |
| 15 * io libraries etc.) | 15 * io libraries etc.) |
| 16 * | 16 * |
| 17 * This script is normally invoked by test.py. (test.py finds the dart vm | 17 * This script is normally invoked by test.py. (test.py finds the dart vm |
| 18 * and passses along all command line arguments to this script.) | 18 * and passses along all command line arguments to this script.) |
| 19 * | 19 * |
| 20 * The command line args of this script are documented in | 20 * The command line args of this script are documented in |
| 21 * "tools/testing/test_options.dart". | 21 * "tools/testing/test_options.dart". |
| 22 * | 22 * |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 library test; | 25 library test; |
| 26 | 26 |
| 27 import "dart:async"; | |
| 28 import "dart:io"; | 27 import "dart:io"; |
| 29 import "testing/dart/test_runner.dart"; | 28 import "testing/dart/test_runner.dart"; |
| 30 import "testing/dart/test_options.dart"; | 29 import "testing/dart/test_options.dart"; |
| 31 import "testing/dart/test_suite.dart"; | 30 import "testing/dart/test_suite.dart"; |
| 32 import "testing/dart/test_progress.dart"; | 31 import "testing/dart/test_progress.dart"; |
| 33 import "testing/dart/http_server.dart"; | 32 import "testing/dart/http_server.dart"; |
| 34 import "testing/dart/utils.dart"; | 33 import "testing/dart/utils.dart"; |
| 35 | 34 |
| 36 import "../compiler/tests/dartc/test_config.dart"; | 35 import "../compiler/tests/dartc/test_config.dart"; |
| 37 import "../runtime/tests/vm/test_config.dart"; | 36 import "../runtime/tests/vm/test_config.dart"; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 65 new Path('tests/lib'), | 64 new Path('tests/lib'), |
| 66 new Path('tests/standalone'), | 65 new Path('tests/standalone'), |
| 67 new Path('tests/utils'), | 66 new Path('tests/utils'), |
| 68 new Path('utils/tests/css'), | 67 new Path('utils/tests/css'), |
| 69 new Path('utils/tests/peg'), | 68 new Path('utils/tests/peg'), |
| 70 new Path('utils/tests/pub'), | 69 new Path('utils/tests/pub'), |
| 71 new Path('sdk/lib/_internal/dartdoc'), | 70 new Path('sdk/lib/_internal/dartdoc'), |
| 72 ]; | 71 ]; |
| 73 | 72 |
| 74 main() { | 73 main() { |
| 75 var startTime = new DateTime.now(); | 74 var startTime = new Date.now(); |
| 76 var optionsParser = new TestOptionsParser(); | 75 var optionsParser = new TestOptionsParser(); |
| 77 List<Map> configurations = optionsParser.parse(new Options().arguments); | 76 List<Map> configurations = optionsParser.parse(new Options().arguments); |
| 78 if (configurations == null || configurations.length == 0) return; | 77 if (configurations == null || configurations.length == 0) return; |
| 79 | 78 |
| 80 // Extract global options from first configuration. | 79 // Extract global options from first configuration. |
| 81 var firstConf = configurations[0]; | 80 var firstConf = configurations[0]; |
| 82 Map<String, RegExp> selectors = firstConf['selectors']; | 81 Map<String, RegExp> selectors = firstConf['selectors']; |
| 83 var maxProcesses = firstConf['tasks']; | 82 var maxProcesses = firstConf['tasks']; |
| 84 var progressIndicator = firstConf['progress']; | 83 var progressIndicator = firstConf['progress']; |
| 85 BuildbotProgressIndicator.stepName = firstConf['step_name']; | 84 BuildbotProgressIndicator.stepName = firstConf['step_name']; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 99 TestUtils.debugLogfile() : null, append: firstConf['append_logs']); | 98 TestUtils.debugLogfile() : null, append: firstConf['append_logs']); |
| 100 | 99 |
| 101 // Print the configurations being run by this execution of | 100 // Print the configurations being run by this execution of |
| 102 // test.dart. However, don't do it if the silent progress indicator | 101 // test.dart. However, don't do it if the silent progress indicator |
| 103 // is used. This is only needed because of the junit tests. | 102 // is used. This is only needed because of the junit tests. |
| 104 if (progressIndicator != 'silent') { | 103 if (progressIndicator != 'silent') { |
| 105 List output_words = configurations.length > 1 ? | 104 List output_words = configurations.length > 1 ? |
| 106 ['Test configurations:'] : ['Test configuration:']; | 105 ['Test configurations:'] : ['Test configuration:']; |
| 107 for (Map conf in configurations) { | 106 for (Map conf in configurations) { |
| 108 List settings = ['compiler', 'runtime', 'mode', 'arch'] | 107 List settings = ['compiler', 'runtime', 'mode', 'arch'] |
| 109 .map((name) => conf[name]).toList(); | 108 .mappedBy((name) => conf[name]).toList(); |
| 110 if (conf['checked']) settings.add('checked'); | 109 if (conf['checked']) settings.add('checked'); |
| 111 output_words.add(settings.join('_')); | 110 output_words.add(settings.join('_')); |
| 112 } | 111 } |
| 113 print(output_words.join(' ')); | 112 print(output_words.join(' ')); |
| 114 } | 113 } |
| 115 | 114 |
| 116 var runningBrowserTests = configurations.any((config) { | 115 var runningBrowserTests = configurations.any((config) { |
| 117 return TestUtils.isBrowserRuntime(config['runtime']); | 116 return TestUtils.isBrowserRuntime(config['runtime']); |
| 118 }); | 117 }); |
| 119 | 118 |
| 120 List<Future> serverFutures = []; | |
| 121 var testSuites = new List<TestSuite>(); | 119 var testSuites = new List<TestSuite>(); |
| 122 var maxBrowserProcesses = maxProcesses; | 120 var maxBrowserProcesses = maxProcesses; |
| 123 for (var conf in configurations) { | 121 for (var conf in configurations) { |
| 124 if (!listTests && runningBrowserTests) { | 122 if (!listTests && runningBrowserTests) { |
| 125 // Start global http servers that serve the entire dart repo. | 123 // Start global http servers that serve the entire dart repo. |
| 126 // The http server is available on window.location.port, and a second | 124 // The http server is available on window.location.port, and a second |
| 127 // server for cross-domain tests can be found by calling | 125 // server for cross-domain tests can be found by calling |
| 128 // getCrossOriginPortNumber(). | 126 // getCrossOriginPortNumber(). |
| 129 var servers = new TestingServers(new Path(TestUtils.buildDir(conf)), | 127 var servers = new TestingServers(new Path(TestUtils.buildDir(conf)), |
| 130 useContentSecurityPolicy); | 128 useContentSecurityPolicy); |
| 131 serverFutures.add(servers.startServers('127.0.0.1')); | 129 servers.startServers('127.0.0.1'); |
| 132 conf['_servers_'] = servers; | 130 conf['_servers_'] = servers; |
| 133 } | 131 } |
| 134 | 132 |
| 135 // There should not be more than one InternetExplorerDriver instance | 133 // There should not be more than one InternetExplorerDriver instance |
| 136 // running at a time. For details, see | 134 // running at a time. For details, see |
| 137 // http://code.google.com/p/selenium/wiki/InternetExplorerDriver. | 135 // http://code.google.com/p/selenium/wiki/InternetExplorerDriver. |
| 138 if (conf['runtime'].startsWith('ie')) { | 136 if (conf['runtime'].startsWith('ie')) { |
| 139 maxBrowserProcesses = 1; | 137 maxBrowserProcesses = 1; |
| 140 } | 138 } |
| 141 | 139 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 startTime, | 196 startTime, |
| 199 formatter)); | 197 formatter)); |
| 200 if (printTiming) { | 198 if (printTiming) { |
| 201 eventListener.add(new TimingPrinter(startTime)); | 199 eventListener.add(new TimingPrinter(startTime)); |
| 202 } | 200 } |
| 203 eventListener.add(new SkippedCompilationsPrinter()); | 201 eventListener.add(new SkippedCompilationsPrinter()); |
| 204 eventListener.add(new LeftOverTempDirPrinter()); | 202 eventListener.add(new LeftOverTempDirPrinter()); |
| 205 } | 203 } |
| 206 eventListener.add(new ExitCodeSetter()); | 204 eventListener.add(new ExitCodeSetter()); |
| 207 | 205 |
| 208 void startProcessQueue() { | 206 // Start process queue. |
| 209 // Start process queue. | 207 new ProcessQueue(maxProcesses, |
| 210 new ProcessQueue(maxProcesses, | 208 maxBrowserProcesses, |
| 211 maxBrowserProcesses, | 209 startTime, |
| 212 startTime, | 210 testSuites, |
| 213 testSuites, | 211 eventListener, |
| 214 eventListener, | 212 allTestsFinished, |
| 215 allTestsFinished, | 213 verbose, |
| 216 verbose, | 214 listTests); |
| 217 listTests); | |
| 218 } | |
| 219 | |
| 220 // Start all the HTTP servers required before starting the process queue. | |
| 221 if (serverFutures.isEmpty) { | |
| 222 startProcessQueue(); | |
| 223 } else { | |
| 224 Future.wait(serverFutures).then((_) => startProcessQueue()); | |
| 225 } | |
| 226 } | 215 } |
| OLD | NEW |