| 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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 // This RunningProcess object is done, and hands over control to | 626 // This RunningProcess object is done, and hands over control to |
| 627 // BatchRunner.startTest(), which handles reporting, etc. | 627 // BatchRunner.startTest(), which handles reporting, etc. |
| 628 timeoutTimer.cancel(); | 628 timeoutTimer.cancel(); |
| 629 processQueue._getBatchRunner(testCase).startTest(testCase); | 629 processQueue._getBatchRunner(testCase).startTest(testCase); |
| 630 } else { | 630 } else { |
| 631 runCommand(testCase.commands[currentStep++], stepExitHandler); | 631 runCommand(testCase.commands[currentStep++], stepExitHandler); |
| 632 } | 632 } |
| 633 } | 633 } |
| 634 } | 634 } |
| 635 | 635 |
| 636 VoidFunction makeReadHandler(StringInputStream source, List<String> destinatio
n) { | 636 VoidFunction makeReadHandler(StringInputStream source, |
| 637 List<String> destination) { |
| 637 void handler () { | 638 void handler () { |
| 638 if (source.closed) return; // TODO(whesse): Remove when bug is fixed. | 639 if (source.closed) return; // TODO(whesse): Remove when bug is fixed. |
| 639 var line = source.readLine(); | 640 var line = source.readLine(); |
| 640 while (null != line) { | 641 while (null != line) { |
| 641 destination.add(line); | 642 destination.add(line); |
| 642 line = source.readLine(); | 643 line = source.readLine(); |
| 643 } | 644 } |
| 644 } | 645 } |
| 645 return handler; | 646 return handler; |
| 646 } | 647 } |
| 647 | 648 |
| 648 void start() { | 649 void start() { |
| 649 Expect.isFalse(testCase.expectedOutcomes.contains(SKIP)); | 650 Expect.isFalse(testCase.expectedOutcomes.contains(SKIP)); |
| 650 stdout = new List<String>(); | 651 stdout = new List<String>(); |
| 651 stderr = new List<String>(); | 652 stderr = new List<String>(); |
| 652 currentStep = 0; | 653 currentStep = 0; |
| 653 startTime = new Date.now(); | 654 startTime = new Date.now(); |
| 654 runCommand(testCase.commands[currentStep++], stepExitHandler); | 655 runCommand(testCase.commands[currentStep++], stepExitHandler); |
| 655 } | 656 } |
| 656 | 657 |
| 657 void runCommand(Command command, | 658 void runCommand(Command command, void exitHandler(int exitCode)) { |
| 658 void exitHandler(int exitCode)) { | |
| 659 process = Process.start(command.executable, command.arguments); | 659 process = Process.start(command.executable, command.arguments); |
| 660 process.onExit = exitHandler; | 660 process.onExit = exitHandler; |
| 661 process.onError = (e) { | 661 process.onError = (e) { |
| 662 print("Error starting process:"); | 662 print("Error starting process:"); |
| 663 print(" Command: $command"); | 663 print(" Command: $command"); |
| 664 print(" Error: $e"); | 664 print(" Error: $e"); |
| 665 testComplete(-1, false); | 665 testComplete(-1, false); |
| 666 }; | 666 }; |
| 667 InputStream stdoutStream = process.stdout; | 667 InputStream stdoutStream = process.stdout; |
| 668 InputStream stderrStream = process.stderr; | 668 InputStream stderrStream = process.stderr; |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 // the developer doesn't waste his or her time trying to fix a bunch of | 1245 // the developer doesn't waste his or her time trying to fix a bunch of |
| 1246 // tests that appear to be broken but were actually just flakes that | 1246 // tests that appear to be broken but were actually just flakes that |
| 1247 // didn't get retried because there had already been one failure. | 1247 // didn't get retried because there had already been one failure. |
| 1248 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; | 1248 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; |
| 1249 new RunningProcess(test, allowRetry, this).start(); | 1249 new RunningProcess(test, allowRetry, this).start(); |
| 1250 } | 1250 } |
| 1251 _numProcesses++; | 1251 _numProcesses++; |
| 1252 } | 1252 } |
| 1253 } | 1253 } |
| 1254 } | 1254 } |
| OLD | NEW |