| 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 | |
| 560 class ModifyPubspecYamlCommand extends ScriptCommand { | 528 class ModifyPubspecYamlCommand extends ScriptCommand { |
| 561 String _pubspecYamlFile; | 529 String _pubspecYamlFile; |
| 562 String _destinationFile; | 530 String _destinationFile; |
| 563 Map<String, Map> _dependencyOverrides; | 531 Map<String, Map> _dependencyOverrides; |
| 564 | 532 |
| 565 ModifyPubspecYamlCommand._( | 533 ModifyPubspecYamlCommand._( |
| 566 this._pubspecYamlFile, this._destinationFile, this._dependencyOverrides) | 534 this._pubspecYamlFile, this._destinationFile, this._dependencyOverrides) |
| 567 : super._("modify_pubspec") { | 535 : super._("modify_pubspec") { |
| 568 assert(_pubspecYamlFile.endsWith("pubspec.yaml")); | 536 assert(_pubspecYamlFile.endsWith("pubspec.yaml")); |
| 569 assert(_destinationFile.endsWith("pubspec.yaml")); | 537 assert(_destinationFile.endsWith("pubspec.yaml")); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 displayName, executable, arguments, environment, workingDirectory); | 781 displayName, executable, arguments, environment, workingDirectory); |
| 814 return _getUniqueCommand(command); | 782 return _getUniqueCommand(command); |
| 815 } | 783 } |
| 816 | 784 |
| 817 Command getCopyCommand(String sourceDirectory, String destinationDirectory) { | 785 Command getCopyCommand(String sourceDirectory, String destinationDirectory) { |
| 818 var command = | 786 var command = |
| 819 new CleanDirectoryCopyCommand._(sourceDirectory, destinationDirectory); | 787 new CleanDirectoryCopyCommand._(sourceDirectory, destinationDirectory); |
| 820 return _getUniqueCommand(command); | 788 return _getUniqueCommand(command); |
| 821 } | 789 } |
| 822 | 790 |
| 823 Command getDeleteCommand(String filename) { | |
| 824 var command = new DeleteCommand._(filename); | |
| 825 return _getUniqueCommand(command); | |
| 826 } | |
| 827 | |
| 828 Command getPubCommand(String pubCommand, String pubExecutable, | 791 Command getPubCommand(String pubCommand, String pubExecutable, |
| 829 String pubspecYamlDirectory, String pubCacheDirectory) { | 792 String pubspecYamlDirectory, String pubCacheDirectory) { |
| 830 var command = new PubCommand._( | 793 var command = new PubCommand._( |
| 831 pubCommand, pubExecutable, pubspecYamlDirectory, pubCacheDirectory); | 794 pubCommand, pubExecutable, pubspecYamlDirectory, pubCacheDirectory); |
| 832 return _getUniqueCommand(command); | 795 return _getUniqueCommand(command); |
| 833 } | 796 } |
| 834 | 797 |
| 835 Command getMakeSymlinkCommand(String link, String target) { | 798 Command getMakeSymlinkCommand(String link, String target) { |
| 836 return _getUniqueCommand(new MakeSymlinkCommand._(link, target)); | 799 return _getUniqueCommand(new MakeSymlinkCommand._(link, target)); |
| 837 } | 800 } |
| (...skipping 2540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3378 } | 3341 } |
| 3379 } | 3342 } |
| 3380 | 3343 |
| 3381 void eventAllTestsDone() { | 3344 void eventAllTestsDone() { |
| 3382 for (var listener in _eventListener) { | 3345 for (var listener in _eventListener) { |
| 3383 listener.allDone(); | 3346 listener.allDone(); |
| 3384 } | 3347 } |
| 3385 _allDone(); | 3348 _allDone(); |
| 3386 } | 3349 } |
| 3387 } | 3350 } |
| OLD | NEW |