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) 2013, 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 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 new Path('tests/lib'), | 64 new Path('tests/lib'), |
| 65 new Path('tests/standalone'), | 65 new Path('tests/standalone'), |
| 66 new Path('tests/utils'), | 66 new Path('tests/utils'), |
| 67 new Path('utils/tests/css'), | 67 new Path('utils/tests/css'), |
| 68 new Path('utils/tests/peg'), | 68 new Path('utils/tests/peg'), |
| 69 new Path('utils/tests/pub'), | 69 new Path('utils/tests/pub'), |
| 70 new Path('sdk/lib/_internal/dartdoc'), | 70 new Path('sdk/lib/_internal/dartdoc'), |
| 71 ]; | 71 ]; |
| 72 | 72 |
| 73 main() { | 73 main() { |
| 74 var startTime = new Date.now(); | 74 var startTime = new DateTime.now(); |
| 75 var optionsParser = new TestOptionsParser(); | 75 var optionsParser = new TestOptionsParser(); |
| 76 List<Map> configurations = optionsParser.parse(new Options().arguments); | 76 List<Map> configurations = optionsParser.parse(new Options().arguments); |
| 77 if (configurations == null || configurations.length == 0) return; | 77 if (configurations == null || configurations.length == 0) return; |
| 78 | 78 |
| 79 // Extract global options from first configuration. | 79 // Extract global options from first configuration. |
| 80 var firstConf = configurations[0]; | 80 var firstConf = configurations[0]; |
| 81 Map<String, RegExp> selectors = firstConf['selectors']; | 81 Map<String, RegExp> selectors = firstConf['selectors']; |
| 82 var maxProcesses = firstConf['tasks']; | 82 var maxProcesses = firstConf['tasks']; |
| 83 var progressIndicator = firstConf['progress']; | 83 var progressIndicator = firstConf['progress']; |
| 84 BuildbotProgressIndicator.stepName = firstConf['step_name']; | 84 BuildbotProgressIndicator.stepName = firstConf['step_name']; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 98 TestUtils.debugLogfile() : null, append: firstConf['append_logs']); | 98 TestUtils.debugLogfile() : null, append: firstConf['append_logs']); |
| 99 | 99 |
| 100 // Print the configurations being run by this execution of | 100 // Print the configurations being run by this execution of |
| 101 // 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 |
| 102 // is used. This is only needed because of the junit tests. | 102 // is used. This is only needed because of the junit tests. |
| 103 if (progressIndicator != 'silent') { | 103 if (progressIndicator != 'silent') { |
| 104 List output_words = configurations.length > 1 ? | 104 List output_words = configurations.length > 1 ? |
| 105 ['Test configurations:'] : ['Test configuration:']; | 105 ['Test configurations:'] : ['Test configuration:']; |
| 106 for (Map conf in configurations) { | 106 for (Map conf in configurations) { |
| 107 List settings = ['compiler', 'runtime', 'mode', 'arch'] | 107 List settings = ['compiler', 'runtime', 'mode', 'arch'] |
| 108 .mappedBy((name) => conf[name]).toList(); | 108 .map((name) => conf[name]).toList(); |
| 109 if (conf['checked']) settings.add('checked'); | 109 if (conf['checked']) settings.add('checked'); |
| 110 output_words.add(settings.join('_')); | 110 output_words.add(settings.join('_')); |
| 111 } | 111 } |
| 112 print(output_words.join(' ')); | 112 print(output_words.join(' ')); |
| 113 } | 113 } |
| 114 | 114 |
| 115 var runningBrowserTests = configurations.any((config) { | 115 var runningBrowserTests = configurations.any((config) { |
| 116 return TestUtils.isBrowserRuntime(config['runtime']); | 116 return TestUtils.isBrowserRuntime(config['runtime']); |
| 117 }); | 117 }); |
| 118 | 118 |
| 119 List<TestingServers> servers = []; | |
|
kustermann
2013/03/13 13:37:56
Why not make it a "List<Future> serverFutures", st
Søren Gjesse
2013/03/13 15:17:18
Done.
| |
| 119 var testSuites = new List<TestSuite>(); | 120 var testSuites = new List<TestSuite>(); |
| 120 var maxBrowserProcesses = maxProcesses; | 121 var maxBrowserProcesses = maxProcesses; |
| 121 for (var conf in configurations) { | 122 for (var conf in configurations) { |
| 122 if (!listTests && runningBrowserTests) { | 123 if (!listTests && runningBrowserTests) { |
| 123 // Start global http servers that serve the entire dart repo. | 124 // Start global http servers that serve the entire dart repo. |
| 124 // The http server is available on window.location.port, and a second | 125 // The http server is available on window.location.port, and a second |
| 125 // server for cross-domain tests can be found by calling | 126 // server for cross-domain tests can be found by calling |
| 126 // getCrossOriginPortNumber(). | 127 // getCrossOriginPortNumber(). |
| 127 var servers = new TestingServers(new Path(TestUtils.buildDir(conf)), | 128 servers.add(new TestingServers(new Path(TestUtils.buildDir(conf)), |
| 128 useContentSecurityPolicy); | 129 useContentSecurityPolicy)); |
| 129 servers.startServers('127.0.0.1'); | 130 conf['_servers_'] = servers.last; |
| 130 conf['_servers_'] = servers; | |
| 131 } | 131 } |
| 132 | 132 |
| 133 // There should not be more than one InternetExplorerDriver instance | 133 // There should not be more than one InternetExplorerDriver instance |
| 134 // running at a time. For details, see | 134 // running at a time. For details, see |
| 135 // http://code.google.com/p/selenium/wiki/InternetExplorerDriver. | 135 // http://code.google.com/p/selenium/wiki/InternetExplorerDriver. |
| 136 if (conf['runtime'].startsWith('ie')) { | 136 if (conf['runtime'].startsWith('ie')) { |
| 137 maxBrowserProcesses = 1; | 137 maxBrowserProcesses = 1; |
| 138 } | 138 } |
| 139 | 139 |
| 140 for (String key in selectors.keys) { | 140 for (String key in selectors.keys) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 startTime, | 196 startTime, |
| 197 formatter)); | 197 formatter)); |
| 198 if (printTiming) { | 198 if (printTiming) { |
| 199 eventListener.add(new TimingPrinter(startTime)); | 199 eventListener.add(new TimingPrinter(startTime)); |
| 200 } | 200 } |
| 201 eventListener.add(new SkippedCompilationsPrinter()); | 201 eventListener.add(new SkippedCompilationsPrinter()); |
| 202 eventListener.add(new LeftOverTempDirPrinter()); | 202 eventListener.add(new LeftOverTempDirPrinter()); |
| 203 } | 203 } |
| 204 eventListener.add(new ExitCodeSetter()); | 204 eventListener.add(new ExitCodeSetter()); |
| 205 | 205 |
| 206 // Start process queue. | 206 void startProcessQueue() { |
| 207 new ProcessQueue(maxProcesses, | 207 // Start process queue. |
| 208 maxBrowserProcesses, | 208 new ProcessQueue(maxProcesses, |
| 209 startTime, | 209 maxBrowserProcesses, |
| 210 testSuites, | 210 startTime, |
| 211 eventListener, | 211 testSuites, |
| 212 allTestsFinished, | 212 eventListener, |
| 213 verbose, | 213 allTestsFinished, |
| 214 listTests); | 214 verbose, |
| 215 listTests); | |
| 216 } | |
| 217 | |
| 218 void startTesting(List<TestingServers> servers) { | |
| 219 // Start all the HTTP servers required before starting the process queue. | |
| 220 if (servers.isEmpty) { | |
| 221 startProcessQueue(); | |
| 222 } else { | |
| 223 TestingServers server = servers.removeLast(); | |
| 224 server.startServers('127.0.0.1').then((_) { | |
| 225 startTesting(servers); | |
| 226 }); | |
| 227 } | |
| 228 } | |
| 229 | |
| 230 startTesting(servers); | |
| 215 } | 231 } |
| OLD | NEW |