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) 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:async"; |
28 import "dart:io"; | 28 import "dart:io"; |
| 29 import "testing/dart/http_server.dart"; |
| 30 import "testing/dart/record_and_replay.dart"; |
| 31 import "testing/dart/test_options.dart"; |
| 32 import "testing/dart/test_progress.dart"; |
29 import "testing/dart/test_runner.dart"; | 33 import "testing/dart/test_runner.dart"; |
30 import "testing/dart/test_options.dart"; | |
31 import "testing/dart/test_suite.dart"; | 34 import "testing/dart/test_suite.dart"; |
32 import "testing/dart/test_progress.dart"; | |
33 import "testing/dart/http_server.dart"; | |
34 import "testing/dart/utils.dart"; | 35 import "testing/dart/utils.dart"; |
35 | 36 |
36 import "../compiler/tests/dartc/test_config.dart"; | 37 import "../compiler/tests/dartc/test_config.dart"; |
37 import "../runtime/tests/vm/test_config.dart"; | 38 import "../runtime/tests/vm/test_config.dart"; |
38 import "../samples/tests/dartc/test_config.dart"; | 39 import "../samples/tests/dartc/test_config.dart"; |
39 import "../tests/co19/test_config.dart"; | 40 import "../tests/co19/test_config.dart"; |
40 import "../tests/lib/analyzer/test_config.dart"; | 41 import "../tests/lib/analyzer/test_config.dart"; |
41 | 42 |
42 /** | 43 /** |
43 * The directories that contain test suites which follow the conventions | 44 * The directories that contain test suites which follow the conventions |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 var maxProcesses = firstConf['tasks']; | 81 var maxProcesses = firstConf['tasks']; |
81 var progressIndicator = firstConf['progress']; | 82 var progressIndicator = firstConf['progress']; |
82 // TODO(kustermann): Remove this option once the buildbots don't use it | 83 // TODO(kustermann): Remove this option once the buildbots don't use it |
83 // anymore. | 84 // anymore. |
84 var failureSummary = firstConf['failure-summary']; | 85 var failureSummary = firstConf['failure-summary']; |
85 BuildbotProgressIndicator.stepName = firstConf['step_name']; | 86 BuildbotProgressIndicator.stepName = firstConf['step_name']; |
86 var verbose = firstConf['verbose']; | 87 var verbose = firstConf['verbose']; |
87 var printTiming = firstConf['time']; | 88 var printTiming = firstConf['time']; |
88 var listTests = firstConf['list']; | 89 var listTests = firstConf['list']; |
89 | 90 |
| 91 var recordingPath = firstConf['record_to_file']; |
| 92 var recordingOutputPath = firstConf['replay_from_file']; |
| 93 |
| 94 if (recordingPath != null && recordingOutputPath != null) { |
| 95 print("Fatal: Can't have the '--record_to_file' and '--replay_from_file'" |
| 96 "at the same time. Exiting ..."); |
| 97 exit(1); |
| 98 } |
| 99 |
| 100 var testCaseRecorder; |
| 101 if (recordingPath != null) { |
| 102 testCaseRecorder = new TestCaseRecorder(new Path(recordingPath)); |
| 103 } |
| 104 |
| 105 var testCaseOutputArchive; |
| 106 if (recordingOutputPath != null) { |
| 107 testCaseOutputArchive = new TestCaseOutputArchive(); |
| 108 testCaseOutputArchive.loadFromPath(new Path(recordingOutputPath)); |
| 109 } |
| 110 |
| 111 |
90 if (!firstConf['append_logs']) { | 112 if (!firstConf['append_logs']) { |
91 var file = new File(TestUtils.flakyFileName()); | 113 var file = new File(TestUtils.flakyFileName()); |
92 if (file.existsSync()) { | 114 if (file.existsSync()) { |
93 file.deleteSync(); | 115 file.deleteSync(); |
94 } | 116 } |
95 } | 117 } |
96 | 118 |
97 DebugLogger.init(firstConf['write_debug_log'] ? | 119 DebugLogger.init(firstConf['write_debug_log'] ? |
98 TestUtils.debugLogfile() : null, append: firstConf['append_logs']); | 120 TestUtils.debugLogfile() : null, append: firstConf['append_logs']); |
99 | 121 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 startTime, | 231 startTime, |
210 formatter)); | 232 formatter)); |
211 if (printTiming) { | 233 if (printTiming) { |
212 eventListener.add(new TimingPrinter(startTime)); | 234 eventListener.add(new TimingPrinter(startTime)); |
213 } | 235 } |
214 eventListener.add(new SkippedCompilationsPrinter()); | 236 eventListener.add(new SkippedCompilationsPrinter()); |
215 eventListener.add(new LeftOverTempDirPrinter()); | 237 eventListener.add(new LeftOverTempDirPrinter()); |
216 } | 238 } |
217 eventListener.add(new ExitCodeSetter()); | 239 eventListener.add(new ExitCodeSetter()); |
218 | 240 |
| 241 |
219 void startProcessQueue() { | 242 void startProcessQueue() { |
220 // Start process queue. | 243 // Start process queue. |
221 new ProcessQueue(maxProcesses, | 244 new ProcessQueue(maxProcesses, |
222 maxBrowserProcesses, | 245 maxBrowserProcesses, |
223 startTime, | 246 startTime, |
224 testSuites, | 247 testSuites, |
225 eventListener, | 248 eventListener, |
226 allTestsFinished, | 249 allTestsFinished, |
227 verbose, | 250 verbose, |
228 listTests); | 251 listTests, |
| 252 testCaseRecorder, |
| 253 testCaseOutputArchive); |
229 } | 254 } |
230 | 255 |
231 // Start all the HTTP servers required before starting the process queue. | 256 // Start all the HTTP servers required before starting the process queue. |
232 if (serverFutures.isEmpty) { | 257 if (serverFutures.isEmpty) { |
233 startProcessQueue(); | 258 startProcessQueue(); |
234 } else { | 259 } else { |
235 Future.wait(serverFutures).then((_) => startProcessQueue()); | 260 Future.wait(serverFutures).then((_) => startProcessQueue()); |
236 } | 261 } |
237 } | 262 } |
238 | 263 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 void main() { | 302 void main() { |
278 deleteTemporaryDartDirectories().then((_) { | 303 deleteTemporaryDartDirectories().then((_) { |
279 var optionsParser = new TestOptionsParser(); | 304 var optionsParser = new TestOptionsParser(); |
280 var configurations = optionsParser.parse(new Options().arguments); | 305 var configurations = optionsParser.parse(new Options().arguments); |
281 if (configurations != null && configurations.length > 0) { | 306 if (configurations != null && configurations.length > 0) { |
282 testConfigurations(configurations); | 307 testConfigurations(configurations); |
283 } | 308 } |
284 }); | 309 }); |
285 } | 310 } |
286 | 311 |
OLD | NEW |