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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 port.close(); | 249 port.close(); |
250 --_numTasks; | 250 --_numTasks; |
251 if (exitCode == 0 || !config['stop-on-failure']) { | 251 if (exitCode == 0 || !config['stop-on-failure']) { |
252 spawnTasks(config, testFiles); | 252 spawnTasks(config, testFiles); |
253 } | 253 } |
254 if (_numTasks == 0) { | 254 if (_numTasks == 0) { |
255 // No outstanding tasks; we're all done. | 255 // No outstanding tasks; we're all done. |
256 // We could later print a summary report here. | 256 // We could later print a summary report here. |
257 } | 257 } |
258 }); | 258 }); |
259 SendPort s = spawnUri(config['pipeline']); | |
260 | |
261 // Get the names of the source and target test files and containing | 259 // Get the names of the source and target test files and containing |
262 // directories. | 260 // directories. |
263 var testPath = new Path(testfile); | 261 var testPath = new Path(testfile); |
264 var sourcePath = testPath.directoryPath; | 262 var sourcePath = testPath.directoryPath; |
265 var sourceDir = sourcePath.toNativePath(); | 263 var sourceDir = sourcePath.toNativePath(); |
266 | 264 |
267 var targetPath = new Path(config["tempdir"]); | 265 var targetPath = new Path(config["tempdir"]); |
268 var normalizedTarget = testPath.directoryPath.toNativePath() | 266 var normalizedTarget = testPath.directoryPath.toNativePath() |
269 .replaceAll(Platform.pathSeparator, '_') | 267 .replaceAll(Platform.pathSeparator, '_') |
270 .replaceAll(':', '_'); | 268 .replaceAll(':', '_'); |
271 targetPath = targetPath.append("${normalizedTarget}_${config['runtime']}"); | 269 targetPath = targetPath.append("${normalizedTarget}_${config['runtime']}"); |
272 var targetDir = targetPath.toNativePath(); | 270 var targetDir = targetPath.toNativePath(); |
273 | 271 |
274 config['targetDir'] = targetDir; | 272 config['targetDir'] = targetDir; |
275 // If this is a new target dir, we need to redo the pub check. | 273 // If this is a new target dir, we need to redo the pub check. |
276 var f = null; | 274 var f = null; |
277 if (targetDir != _testDir) { | 275 if (targetDir != _testDir) { |
278 f = doPubConfig(sourcePath, sourceDir, targetPath, targetDir, | 276 f = doPubConfig(sourcePath, sourceDir, targetPath, targetDir, |
279 config['pub'], config['runtime']); | 277 config['pub'], config['runtime']); |
280 _testDir = targetDir; | 278 _testDir = targetDir; |
281 } | 279 } |
282 if (f == null) { | 280 var response = new ReceivePort(); |
283 s.send(config, port.toSendPort()); | 281 spawnUri(config['pipeline'], [], response) |
284 } else { | 282 .then((_) => f) |
285 f.then((_) { | 283 .then((_) => response.first) |
286 s.send(config, port.toSendPort()); | 284 .then((s) { s.send([config, port.sendPort]); }); |
287 }); | 285 if (f != null) break; // Don't do any more until pub is done. |
288 break; // Don't do any more until pub is done. | |
289 } | |
290 } | 286 } |
291 } | 287 } |
292 | 288 |
293 /** | 289 /** |
294 * Our tests are configured so that critical messages have a '###' prefix. | 290 * Our tests are configured so that critical messages have a '###' prefix. |
295 * [writelog] takes the output from a pipeline execution and writes it to | 291 * [writelog] takes the output from a pipeline execution and writes it to |
296 * our output sinks. It will strip the '###' if necessary on critical | 292 * our output sinks. It will strip the '###' if necessary on critical |
297 * messages; other messages will only be written if verbose output was | 293 * messages; other messages will only be written if verbose output was |
298 * specified. | 294 * specified. |
299 */ | 295 */ |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 if (dirs.length == 0) { | 413 if (dirs.length == 0) { |
418 dirs.add('.'); // Use current working directory as default. | 414 dirs.add('.'); // Use current working directory as default. |
419 } | 415 } |
420 var f = buildFileList(dirs, | 416 var f = buildFileList(dirs, |
421 new RegExp(config['test-file-pattern']), config['recurse']); | 417 new RegExp(config['test-file-pattern']), config['recurse']); |
422 if (config['sort']) f.sort(); | 418 if (config['sort']) f.sort(); |
423 processTests(config, f); | 419 processTests(config, f); |
424 } | 420 } |
425 } | 421 } |
426 } | 422 } |
OLD | NEW |