| 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 | 387 |
| 388 CleanDirectoryCopyCommand._(this._sourceDirectory, this._destinationDirectory) | 388 CleanDirectoryCopyCommand._(this._sourceDirectory, this._destinationDirectory) |
| 389 : super._('dir_copy'); | 389 : super._('dir_copy'); |
| 390 | 390 |
| 391 String get reproductionCommand => | 391 String get reproductionCommand => |
| 392 "Copying '$_sourceDirectory' to '$_destinationDirectory'."; | 392 "Copying '$_sourceDirectory' to '$_destinationDirectory'."; |
| 393 | 393 |
| 394 Future<ScriptCommandOutputImpl> run() { | 394 Future<ScriptCommandOutputImpl> run() { |
| 395 var watch = new Stopwatch()..start(); | 395 var watch = new Stopwatch()..start(); |
| 396 | 396 |
| 397 var source = new io.Directory(_sourceDirectory); | |
| 398 var destination = new io.Directory(_destinationDirectory); | 397 var destination = new io.Directory(_destinationDirectory); |
| 399 | 398 |
| 400 return destination.exists().then((bool exists) { | 399 return destination.exists().then((bool exists) { |
| 401 var cleanDirectoryFuture; | 400 var cleanDirectoryFuture; |
| 402 if (exists) { | 401 if (exists) { |
| 403 cleanDirectoryFuture = TestUtils.deleteDirectory(_destinationDirectory); | 402 cleanDirectoryFuture = TestUtils.deleteDirectory(_destinationDirectory); |
| 404 } else { | 403 } else { |
| 405 cleanDirectoryFuture = new Future.value(null); | 404 cleanDirectoryFuture = new Future.value(null); |
| 406 } | 405 } |
| 407 return cleanDirectoryFuture.then((_) { | 406 return cleanDirectoryFuture.then((_) { |
| (...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1446 return Expectation.STATIC_WARNING; | 1445 return Expectation.STATIC_WARNING; |
| 1447 } | 1446 } |
| 1448 | 1447 |
| 1449 assert (errors.length == 0 && warnings.length == 0); | 1448 assert (errors.length == 0 && warnings.length == 0); |
| 1450 assert (!testCase.hasCompileError && | 1449 assert (!testCase.hasCompileError && |
| 1451 !testCase.hasStaticWarning); | 1450 !testCase.hasStaticWarning); |
| 1452 return Expectation.PASS; | 1451 return Expectation.PASS; |
| 1453 } | 1452 } |
| 1454 | 1453 |
| 1455 void parseAnalyzerOutput(List<String> outErrors, List<String> outWarnings) { | 1454 void parseAnalyzerOutput(List<String> outErrors, List<String> outWarnings) { |
| 1456 AnalysisCommand analysisCommand = command; | |
| 1457 | |
| 1458 // Parse a line delimited by the | character using \ as an escape charager | 1455 // Parse a line delimited by the | character using \ as an escape charager |
| 1459 // like: FOO|BAR|FOO\|BAR|FOO\\BAZ as 4 fields: FOO BAR FOO|BAR FOO\BAZ | 1456 // like: FOO|BAR|FOO\|BAR|FOO\\BAZ as 4 fields: FOO BAR FOO|BAR FOO\BAZ |
| 1460 List<String> splitMachineError(String line) { | 1457 List<String> splitMachineError(String line) { |
| 1461 StringBuffer field = new StringBuffer(); | 1458 StringBuffer field = new StringBuffer(); |
| 1462 List<String> result = []; | 1459 List<String> result = []; |
| 1463 bool escaped = false; | 1460 bool escaped = false; |
| 1464 for (var i = 0 ; i < line.length; i++) { | 1461 for (var i = 0 ; i < line.length; i++) { |
| 1465 var c = line[i]; | 1462 var c = line[i]; |
| 1466 if (!escaped && c == '\\') { | 1463 if (!escaped && c == '\\') { |
| 1467 escaped = true; | 1464 escaped = true; |
| (...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2763 completeTestCase(testCase); | 2760 completeTestCase(testCase); |
| 2764 } | 2761 } |
| 2765 } | 2762 } |
| 2766 } | 2763 } |
| 2767 } | 2764 } |
| 2768 | 2765 |
| 2769 | 2766 |
| 2770 class ProcessQueue { | 2767 class ProcessQueue { |
| 2771 Map _globalConfiguration; | 2768 Map _globalConfiguration; |
| 2772 | 2769 |
| 2773 bool _listTests; | |
| 2774 Function _allDone; | 2770 Function _allDone; |
| 2775 final dgraph.Graph _graph = new dgraph.Graph(); | 2771 final dgraph.Graph _graph = new dgraph.Graph(); |
| 2776 List<EventListener> _eventListener; | 2772 List<EventListener> _eventListener; |
| 2777 | 2773 |
| 2778 ProcessQueue(this._globalConfiguration, | 2774 ProcessQueue(this._globalConfiguration, |
| 2779 maxProcesses, | 2775 maxProcesses, |
| 2780 maxBrowserProcesses, | 2776 maxBrowserProcesses, |
| 2781 DateTime startTime, | 2777 DateTime startTime, |
| 2782 testSuites, | 2778 testSuites, |
| 2783 this._eventListener, | 2779 this._eventListener, |
| 2784 this._allDone, | 2780 this._allDone, |
| 2785 [bool verbose = false, | 2781 [bool verbose = false, |
| 2786 this._listTests = false, | |
| 2787 String recordingOutputFile, | 2782 String recordingOutputFile, |
| 2788 String recordedInputFile]) { | 2783 String recordedInputFile]) { |
| 2789 void setupForListing(TestCaseEnqueuer testCaseEnqueuer) { | 2784 void setupForListing(TestCaseEnqueuer testCaseEnqueuer) { |
| 2790 _graph.events.where((event) => event is dgraph.GraphSealedEvent) | 2785 _graph.events.where((event) => event is dgraph.GraphSealedEvent) |
| 2791 .listen((dgraph.GraphSealedEvent event) { | 2786 .listen((dgraph.GraphSealedEvent event) { |
| 2792 var testCases = new List.from(testCaseEnqueuer.remainingTestCases); | 2787 var testCases = new List.from(testCaseEnqueuer.remainingTestCases); |
| 2793 testCases.sort((a, b) => a.displayName.compareTo(b.displayName)); | 2788 testCases.sort((a, b) => a.displayName.compareTo(b.displayName)); |
| 2794 | 2789 |
| 2795 print("\nGenerating all matching test cases ....\n"); | 2790 print("\nGenerating all matching test cases ....\n"); |
| 2796 | 2791 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2952 } | 2947 } |
| 2953 } | 2948 } |
| 2954 | 2949 |
| 2955 void eventAllTestsDone() { | 2950 void eventAllTestsDone() { |
| 2956 for (var listener in _eventListener) { | 2951 for (var listener in _eventListener) { |
| 2957 listener.allDone(); | 2952 listener.allDone(); |
| 2958 } | 2953 } |
| 2959 _allDone(); | 2954 _allDone(); |
| 2960 } | 2955 } |
| 2961 } | 2956 } |
| OLD | NEW |