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 * testrunner is a program to run Dart unit tests. Unlike $DART/tools/test.dart, | 7 * testrunner is a program to run Dart unit tests. Unlike $DART/tools/test.dart, |
8 * this program is intended for 3rd parties to be able to run unit tests in | 8 * this program is intended for 3rd parties to be able to run unit tests in |
9 * a batched fashion. As such, it adds some features and removes others. Some | 9 * a batched fashion. As such, it adds some features and removes others. Some |
10 * of the removed features are: | 10 * of the removed features are: |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 * create or update the layout files (and implicitly pass the tests). | 64 * create or update the layout files (and implicitly pass the tests). |
65 */ | 65 */ |
66 | 66 |
67 // TODO - layout tests that use PNGs rather than DRT text render dumps. | 67 // TODO - layout tests that use PNGs rather than DRT text render dumps. |
68 #library('testrunner'); | 68 #library('testrunner'); |
69 #import('dart:io'); | 69 #import('dart:io'); |
70 #import('dart:isolate'); | 70 #import('dart:isolate'); |
71 #import('dart:math'); | 71 #import('dart:math'); |
72 #import('../../pkg/args/lib/args.dart'); | 72 #import('../../pkg/args/lib/args.dart'); |
73 | 73 |
| 74 #source('client_server_task.dart'); |
74 #source('configuration.dart'); | 75 #source('configuration.dart'); |
75 #source('dart_task.dart'); | |
76 #source('dart_wrap_task.dart'); | 76 #source('dart_wrap_task.dart'); |
77 #source('dart2js_task.dart'); | 77 #source('dart2js_task.dart'); |
78 #source('delete_task.dart'); | 78 #source('delete_task.dart'); |
79 #source('drt_task.dart'); | |
80 #source('html_wrap_task.dart'); | 79 #source('html_wrap_task.dart'); |
81 #source('macros.dart'); | 80 #source('macros.dart'); |
82 #source('options.dart'); | 81 #source('options.dart'); |
83 #source('pipeline_runner.dart'); | 82 #source('pipeline_runner.dart'); |
84 #source('pipeline_task.dart'); | 83 #source('pipeline_task.dart'); |
85 #source('run_process_task.dart'); | 84 #source('run_process_task.dart'); |
86 #source('utils.dart'); | 85 #source('utils.dart'); |
87 | 86 |
88 /** The set of [PipelineRunner]s to execute. */ | 87 /** The set of [PipelineRunner]s to execute. */ |
89 List _tasks; | 88 List _tasks; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // by these two templates. | 166 // by these two templates. |
168 var HTMLFile = | 167 var HTMLFile = |
169 '${Macros.directory}$pathSep${Macros.filenameNoExtension}.html'; | 168 '${Macros.directory}$pathSep${Macros.filenameNoExtension}.html'; |
170 var CSSFile = | 169 var CSSFile = |
171 '${Macros.directory}$pathSep${Macros.filenameNoExtension}.css'; | 170 '${Macros.directory}$pathSep${Macros.filenameNoExtension}.css'; |
172 pipeline.add(new HtmlWrapTask(Macros.fullFilePath, | 171 pipeline.add(new HtmlWrapTask(Macros.fullFilePath, |
173 HTMLFile, tempHTMLFile, CSSFile, tempCSSFile)); | 172 HTMLFile, tempHTMLFile, CSSFile, tempCSSFile)); |
174 } | 173 } |
175 | 174 |
176 // Add the execution step. | 175 // Add the execution step. |
| 176 var command; |
| 177 var flags; |
| 178 var task; |
177 if (runtime == 'vm' || config.layoutPixel || config.layoutText) { | 179 if (runtime == 'vm' || config.layoutPixel || config.layoutText) { |
| 180 command = config.dartPath; |
178 if (checkedMode) { | 181 if (checkedMode) { |
179 pipeline.add(new DartTask.checked(tempDartFile)); | 182 flags = ['--enable_asserts', '--enable_type_checks', tempDartFile]; |
180 } else { | 183 } else { |
181 pipeline.add(new DartTask(tempDartFile)); | 184 flags = [tempDartFile]; |
182 } | 185 } |
183 } else { | 186 } else { |
184 pipeline.add(new DrtTask(Macros.fullFilePath, tempHTMLFile)); | 187 command = config.drtPath; |
| 188 flags = ['--no-timeout', tempHTMLFile]; |
185 } | 189 } |
| 190 if (config.runServer) { |
| 191 task = new RunClientServerTask(command, flags, config.timeout); |
| 192 } else { |
| 193 task = new RunProcessTask(command, flags, config.timeout); |
| 194 } |
| 195 pipeline.add(task); |
186 return pipeline; | 196 return pipeline; |
187 } | 197 } |
188 | 198 |
189 /** | 199 /** |
190 * Given a [List] of [testFiles], either print the list or create | 200 * Given a [List] of [testFiles], either print the list or create |
191 * and execute pipelines for the files. | 201 * and execute pipelines for the files. |
192 */ | 202 */ |
193 void processTests(List pipelineTemplate, List testFiles) { | 203 void processTests(List pipelineTemplate, List testFiles) { |
194 _outStream = getStream(config.outputStream); | 204 _outStream = getStream(config.outputStream); |
195 _logStream = getStream(config.logStream); | 205 _logStream = getStream(config.logStream); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 } | 301 } |
292 buildFileList(dirs, | 302 buildFileList(dirs, |
293 new RegExp(options['test-file-pattern']), options['recurse'], | 303 new RegExp(options['test-file-pattern']), options['recurse'], |
294 (f) => processTests(pipelineTemplate, f)); | 304 (f) => processTests(pipelineTemplate, f)); |
295 } | 305 } |
296 } | 306 } |
297 } | 307 } |
298 } | 308 } |
299 | 309 |
300 | 310 |
OLD | NEW |