Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: tools/test.dart

Issue 12431020: Reapply "Update the test runner to use the new dart:io API" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/release/version.dart ('k') | tools/test-runtime.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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";
27 import "dart:io"; 28 import "dart:io";
28 import "testing/dart/test_runner.dart"; 29 import "testing/dart/test_runner.dart";
29 import "testing/dart/test_options.dart"; 30 import "testing/dart/test_options.dart";
30 import "testing/dart/test_suite.dart"; 31 import "testing/dart/test_suite.dart";
31 import "testing/dart/test_progress.dart"; 32 import "testing/dart/test_progress.dart";
32 import "testing/dart/http_server.dart"; 33 import "testing/dart/http_server.dart";
33 import "testing/dart/utils.dart"; 34 import "testing/dart/utils.dart";
34 35
35 import "../compiler/tests/dartc/test_config.dart"; 36 import "../compiler/tests/dartc/test_config.dart";
36 import "../runtime/tests/vm/test_config.dart"; 37 import "../runtime/tests/vm/test_config.dart";
(...skipping 27 matching lines...) Expand all
64 new Path('tests/lib'), 65 new Path('tests/lib'),
65 new Path('tests/standalone'), 66 new Path('tests/standalone'),
66 new Path('tests/utils'), 67 new Path('tests/utils'),
67 new Path('utils/tests/css'), 68 new Path('utils/tests/css'),
68 new Path('utils/tests/peg'), 69 new Path('utils/tests/peg'),
69 new Path('utils/tests/pub'), 70 new Path('utils/tests/pub'),
70 new Path('sdk/lib/_internal/dartdoc'), 71 new Path('sdk/lib/_internal/dartdoc'),
71 ]; 72 ];
72 73
73 main() { 74 main() {
74 var startTime = new Date.now(); 75 var startTime = new DateTime.now();
75 var optionsParser = new TestOptionsParser(); 76 var optionsParser = new TestOptionsParser();
76 List<Map> configurations = optionsParser.parse(new Options().arguments); 77 List<Map> configurations = optionsParser.parse(new Options().arguments);
77 if (configurations == null || configurations.length == 0) return; 78 if (configurations == null || configurations.length == 0) return;
78 79
79 // Extract global options from first configuration. 80 // Extract global options from first configuration.
80 var firstConf = configurations[0]; 81 var firstConf = configurations[0];
81 Map<String, RegExp> selectors = firstConf['selectors']; 82 Map<String, RegExp> selectors = firstConf['selectors'];
82 var maxProcesses = firstConf['tasks']; 83 var maxProcesses = firstConf['tasks'];
83 var progressIndicator = firstConf['progress']; 84 var progressIndicator = firstConf['progress'];
84 BuildbotProgressIndicator.stepName = firstConf['step_name']; 85 BuildbotProgressIndicator.stepName = firstConf['step_name'];
(...skipping 13 matching lines...) Expand all
98 TestUtils.debugLogfile() : null, append: firstConf['append_logs']); 99 TestUtils.debugLogfile() : null, append: firstConf['append_logs']);
99 100
100 // Print the configurations being run by this execution of 101 // Print the configurations being run by this execution of
101 // test.dart. However, don't do it if the silent progress indicator 102 // test.dart. However, don't do it if the silent progress indicator
102 // is used. This is only needed because of the junit tests. 103 // is used. This is only needed because of the junit tests.
103 if (progressIndicator != 'silent') { 104 if (progressIndicator != 'silent') {
104 List output_words = configurations.length > 1 ? 105 List output_words = configurations.length > 1 ?
105 ['Test configurations:'] : ['Test configuration:']; 106 ['Test configurations:'] : ['Test configuration:'];
106 for (Map conf in configurations) { 107 for (Map conf in configurations) {
107 List settings = ['compiler', 'runtime', 'mode', 'arch'] 108 List settings = ['compiler', 'runtime', 'mode', 'arch']
108 .mappedBy((name) => conf[name]).toList(); 109 .map((name) => conf[name]).toList();
109 if (conf['checked']) settings.add('checked'); 110 if (conf['checked']) settings.add('checked');
110 output_words.add(settings.join('_')); 111 output_words.add(settings.join('_'));
111 } 112 }
112 print(output_words.join(' ')); 113 print(output_words.join(' '));
113 } 114 }
114 115
115 var runningBrowserTests = configurations.any((config) { 116 var runningBrowserTests = configurations.any((config) {
116 return TestUtils.isBrowserRuntime(config['runtime']); 117 return TestUtils.isBrowserRuntime(config['runtime']);
117 }); 118 });
118 119
120 List<Future> serverFutures = [];
119 var testSuites = new List<TestSuite>(); 121 var testSuites = new List<TestSuite>();
120 var maxBrowserProcesses = maxProcesses; 122 var maxBrowserProcesses = maxProcesses;
121 for (var conf in configurations) { 123 for (var conf in configurations) {
122 if (!listTests && runningBrowserTests) { 124 if (!listTests && runningBrowserTests) {
123 // Start global http servers that serve the entire dart repo. 125 // Start global http servers that serve the entire dart repo.
124 // The http server is available on window.location.port, and a second 126 // The http server is available on window.location.port, and a second
125 // server for cross-domain tests can be found by calling 127 // server for cross-domain tests can be found by calling
126 // getCrossOriginPortNumber(). 128 // getCrossOriginPortNumber().
127 var servers = new TestingServers(new Path(TestUtils.buildDir(conf)), 129 var servers = new TestingServers(new Path(TestUtils.buildDir(conf)),
128 useContentSecurityPolicy); 130 useContentSecurityPolicy);
129 servers.startServers('127.0.0.1'); 131 serverFutures.add(servers.startServers('127.0.0.1'));
130 conf['_servers_'] = servers; 132 conf['_servers_'] = servers;
131 } 133 }
132 134
133 // There should not be more than one InternetExplorerDriver instance 135 // There should not be more than one InternetExplorerDriver instance
134 // running at a time. For details, see 136 // running at a time. For details, see
135 // http://code.google.com/p/selenium/wiki/InternetExplorerDriver. 137 // http://code.google.com/p/selenium/wiki/InternetExplorerDriver.
136 if (conf['runtime'].startsWith('ie')) { 138 if (conf['runtime'].startsWith('ie')) {
137 maxBrowserProcesses = 1; 139 maxBrowserProcesses = 1;
138 } 140 }
139 141
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 startTime, 198 startTime,
197 formatter)); 199 formatter));
198 if (printTiming) { 200 if (printTiming) {
199 eventListener.add(new TimingPrinter(startTime)); 201 eventListener.add(new TimingPrinter(startTime));
200 } 202 }
201 eventListener.add(new SkippedCompilationsPrinter()); 203 eventListener.add(new SkippedCompilationsPrinter());
202 eventListener.add(new LeftOverTempDirPrinter()); 204 eventListener.add(new LeftOverTempDirPrinter());
203 } 205 }
204 eventListener.add(new ExitCodeSetter()); 206 eventListener.add(new ExitCodeSetter());
205 207
206 // Start process queue. 208 void startProcessQueue() {
207 new ProcessQueue(maxProcesses, 209 // Start process queue.
208 maxBrowserProcesses, 210 new ProcessQueue(maxProcesses,
209 startTime, 211 maxBrowserProcesses,
210 testSuites, 212 startTime,
211 eventListener, 213 testSuites,
212 allTestsFinished, 214 eventListener,
213 verbose, 215 allTestsFinished,
214 listTests); 216 verbose,
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 }
215 } 226 }
OLDNEW
« no previous file with comments | « tools/release/version.dart ('k') | tools/test-runtime.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698