OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Classes and methods for executing tests. | 6 * Classes and methods for executing tests. |
7 * | 7 * |
8 * This module includes: | 8 * This module includes: |
9 * - Managing parallel execution of tests, including timeout checks. | 9 * - Managing parallel execution of tests, including timeout checks. |
10 * - Evaluating the output of each test as pass/fail/crash/timeout. | 10 * - Evaluating the output of each test as pass/fail/crash/timeout. |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 builder.addJson(_sourceDirectory); | 518 builder.addJson(_sourceDirectory); |
519 builder.addJson(_destinationDirectory); | 519 builder.addJson(_destinationDirectory); |
520 } | 520 } |
521 | 521 |
522 bool _equal(CleanDirectoryCopyCommand other) => | 522 bool _equal(CleanDirectoryCopyCommand other) => |
523 super._equal(other) && | 523 super._equal(other) && |
524 _sourceDirectory == other._sourceDirectory && | 524 _sourceDirectory == other._sourceDirectory && |
525 _destinationDirectory == other._destinationDirectory; | 525 _destinationDirectory == other._destinationDirectory; |
526 } | 526 } |
527 | 527 |
| 528 class DeleteCommand extends ScriptCommand { |
| 529 final String _filename; |
| 530 |
| 531 DeleteCommand._(this._filename) : super._('delete'); |
| 532 |
| 533 String get reproductionCommand => |
| 534 "Deleting $_filename"; |
| 535 |
| 536 Future<ScriptCommandOutputImpl> run() { |
| 537 var watch = new Stopwatch()..start(); |
| 538 |
| 539 var file = new io.File(_filename); |
| 540 |
| 541 return file.delete(recursive: true).then((io.File file) { |
| 542 return new ScriptCommandOutputImpl( |
| 543 this, Expectation.PASS, "", watch.elapsed); |
| 544 }).catchError((error) { |
| 545 return new ScriptCommandOutputImpl( |
| 546 this, Expectation.FAIL, "An error occured: $error.", watch.elapsed); |
| 547 }); |
| 548 } |
| 549 |
| 550 void _buildHashCode(HashCodeBuilder builder) { |
| 551 super._buildHashCode(builder); |
| 552 builder.addJson(_filename); |
| 553 } |
| 554 |
| 555 bool _equal(DeleteCommand other) => |
| 556 super._equal(other) && |
| 557 _filename == other._filename; |
| 558 } |
| 559 |
528 class ModifyPubspecYamlCommand extends ScriptCommand { | 560 class ModifyPubspecYamlCommand extends ScriptCommand { |
529 String _pubspecYamlFile; | 561 String _pubspecYamlFile; |
530 String _destinationFile; | 562 String _destinationFile; |
531 Map<String, Map> _dependencyOverrides; | 563 Map<String, Map> _dependencyOverrides; |
532 | 564 |
533 ModifyPubspecYamlCommand._( | 565 ModifyPubspecYamlCommand._( |
534 this._pubspecYamlFile, this._destinationFile, this._dependencyOverrides) | 566 this._pubspecYamlFile, this._destinationFile, this._dependencyOverrides) |
535 : super._("modify_pubspec") { | 567 : super._("modify_pubspec") { |
536 assert(_pubspecYamlFile.endsWith("pubspec.yaml")); | 568 assert(_pubspecYamlFile.endsWith("pubspec.yaml")); |
537 assert(_destinationFile.endsWith("pubspec.yaml")); | 569 assert(_destinationFile.endsWith("pubspec.yaml")); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 displayName, executable, arguments, environment, workingDirectory); | 813 displayName, executable, arguments, environment, workingDirectory); |
782 return _getUniqueCommand(command); | 814 return _getUniqueCommand(command); |
783 } | 815 } |
784 | 816 |
785 Command getCopyCommand(String sourceDirectory, String destinationDirectory) { | 817 Command getCopyCommand(String sourceDirectory, String destinationDirectory) { |
786 var command = | 818 var command = |
787 new CleanDirectoryCopyCommand._(sourceDirectory, destinationDirectory); | 819 new CleanDirectoryCopyCommand._(sourceDirectory, destinationDirectory); |
788 return _getUniqueCommand(command); | 820 return _getUniqueCommand(command); |
789 } | 821 } |
790 | 822 |
| 823 Command getDeleteCommand(String filename) { |
| 824 var command = new DeleteCommand._(filename); |
| 825 return _getUniqueCommand(command); |
| 826 } |
| 827 |
791 Command getPubCommand(String pubCommand, String pubExecutable, | 828 Command getPubCommand(String pubCommand, String pubExecutable, |
792 String pubspecYamlDirectory, String pubCacheDirectory) { | 829 String pubspecYamlDirectory, String pubCacheDirectory) { |
793 var command = new PubCommand._( | 830 var command = new PubCommand._( |
794 pubCommand, pubExecutable, pubspecYamlDirectory, pubCacheDirectory); | 831 pubCommand, pubExecutable, pubspecYamlDirectory, pubCacheDirectory); |
795 return _getUniqueCommand(command); | 832 return _getUniqueCommand(command); |
796 } | 833 } |
797 | 834 |
798 Command getMakeSymlinkCommand(String link, String target) { | 835 Command getMakeSymlinkCommand(String link, String target) { |
799 return _getUniqueCommand(new MakeSymlinkCommand._(link, target)); | 836 return _getUniqueCommand(new MakeSymlinkCommand._(link, target)); |
800 } | 837 } |
(...skipping 2540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3341 } | 3378 } |
3342 } | 3379 } |
3343 | 3380 |
3344 void eventAllTestsDone() { | 3381 void eventAllTestsDone() { |
3345 for (var listener in _eventListener) { | 3382 for (var listener in _eventListener) { |
3346 listener.allDone(); | 3383 listener.allDone(); |
3347 } | 3384 } |
3348 _allDone(); | 3385 _allDone(); |
3349 } | 3386 } |
3350 } | 3387 } |
OLD | NEW |