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) 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']); | 259 var response = new ReceivePort(); |
| 260 | 260 spawnUri(config['pipeline'], [], response) |
| 261 .then((_) => return response.first) | |
| 262 .then((s) { | |
| 261 // Get the names of the source and target test files and containing | 263 // Get the names of the source and target test files and containing |
|
Lasse Reichstein Nielsen
2013/10/25 09:42:49
Indentation seems wrong. It should be two characte
floitsch
2013/10/25 13:11:01
Done.
| |
| 262 // directories. | 264 // directories. |
| 263 var testPath = new Path(testfile); | 265 var testPath = new Path(testfile); |
| 264 var sourcePath = testPath.directoryPath; | 266 var sourcePath = testPath.directoryPath; |
| 265 var sourceDir = sourcePath.toNativePath(); | 267 var sourceDir = sourcePath.toNativePath(); |
| 266 | 268 |
| 267 var targetPath = new Path(config["tempdir"]); | 269 var targetPath = new Path(config["tempdir"]); |
| 268 var normalizedTarget = testPath.directoryPath.toNativePath() | 270 var normalizedTarget = testPath.directoryPath.toNativePath() |
| 269 .replaceAll(Platform.pathSeparator, '_') | 271 .replaceAll(Platform.pathSeparator, '_') |
| 270 .replaceAll(':', '_'); | 272 .replaceAll(':', '_'); |
| 271 targetPath = targetPath.append("${normalizedTarget}_${config['runtime']}"); | 273 targetPath = targetPath.append("${normalizedTarget}_${config['runtime']}"); |
| 272 var targetDir = targetPath.toNativePath(); | 274 var targetDir = targetPath.toNativePath(); |
| 273 | 275 |
| 274 config['targetDir'] = targetDir; | 276 config['targetDir'] = targetDir; |
| 275 // If this is a new target dir, we need to redo the pub check. | 277 // If this is a new target dir, we need to redo the pub check. |
| 276 var f = null; | 278 var f = null; |
| 277 if (targetDir != _testDir) { | 279 if (targetDir != _testDir) { |
| 278 f = doPubConfig(sourcePath, sourceDir, targetPath, targetDir, | 280 f = doPubConfig(sourcePath, sourceDir, targetPath, targetDir, |
| 279 config['pub'], config['runtime']); | 281 config['pub'], config['runtime']); |
| 280 _testDir = targetDir; | 282 _testDir = targetDir; |
| 281 } | 283 } |
| 282 if (f == null) { | 284 if (f == null) { |
| 283 s.send(config, port.toSendPort()); | 285 s.send([config, port.sendPort]); |
| 284 } else { | 286 } else { |
| 285 f.then((_) { | 287 f.then((_) { |
| 286 s.send(config, port.toSendPort()); | 288 s.send([config, port.sendPort]); |
| 287 }); | 289 }); |
| 288 break; // Don't do any more until pub is done. | 290 break; // Don't do any more until pub is done. |
| 289 } | 291 } |
| 290 } | 292 }); |
| 291 } | 293 } |
| 292 | 294 |
| 293 /** | 295 /** |
| 294 * Our tests are configured so that critical messages have a '###' prefix. | 296 * Our tests are configured so that critical messages have a '###' prefix. |
| 295 * [writelog] takes the output from a pipeline execution and writes it to | 297 * [writelog] takes the output from a pipeline execution and writes it to |
| 296 * our output sinks. It will strip the '###' if necessary on critical | 298 * our output sinks. It will strip the '###' if necessary on critical |
| 297 * messages; other messages will only be written if verbose output was | 299 * messages; other messages will only be written if verbose output was |
| 298 * specified. | 300 * specified. |
| 299 */ | 301 */ |
| 300 void writelog(List messages, IOSink out, IOSink log, | 302 void writelog(List messages, IOSink out, IOSink log, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 if (dirs.length == 0) { | 419 if (dirs.length == 0) { |
| 418 dirs.add('.'); // Use current working directory as default. | 420 dirs.add('.'); // Use current working directory as default. |
| 419 } | 421 } |
| 420 var f = buildFileList(dirs, | 422 var f = buildFileList(dirs, |
| 421 new RegExp(config['test-file-pattern']), config['recurse']); | 423 new RegExp(config['test-file-pattern']), config['recurse']); |
| 422 if (config['sort']) f.sort(); | 424 if (config['sort']) f.sort(); |
| 423 processTests(config, f); | 425 processTests(config, f); |
| 424 } | 426 } |
| 425 } | 427 } |
| 426 } | 428 } |
| OLD | NEW |