Chromium Code Reviews| 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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 723 _timer = new Timer(testCase.timeout * 1000, _timeoutHandler); | 723 _timer = new Timer(testCase.timeout * 1000, _timeoutHandler); |
| 724 var line = _createArgumentsLine(testCase.batchTestArguments); | 724 var line = _createArgumentsLine(testCase.batchTestArguments); |
| 725 _process.stdin.write(line.charCodes()); | 725 _process.stdin.write(line.charCodes()); |
| 726 } | 726 } |
| 727 | 727 |
| 728 String _createArgumentsLine(List<String> arguments) { | 728 String _createArgumentsLine(List<String> arguments) { |
| 729 return Strings.join(arguments, ' ').concat('\n'); | 729 return Strings.join(arguments, ' ').concat('\n'); |
| 730 } | 730 } |
| 731 | 731 |
| 732 void _testCompleted() { | 732 void _testCompleted() { |
| 733 // TODO(whesse): Remove this temporary code used to diagnose problem. | |
|
Søren Gjesse
2012/05/29 09:11:56
If there is not already a bug on this please file
| |
| 734 if (!_stdoutDrained || !_stderrDrained) { | |
| 735 print("Warning: Batch Test Runner problem:\n" | |
| 736 " _stdoutDrained: $_stdoutDrained, _stderrDrained: $_stderrDrained"); | |
| 737 } | |
| 733 var test = _currentTest; | 738 var test = _currentTest; |
| 734 _currentTest = null; | 739 _currentTest = null; |
| 735 test.completed(); | 740 test.completed(); |
| 736 } | 741 } |
| 737 | 742 |
| 738 int _reportResult(String output) { | 743 int _reportResult(String output) { |
| 739 _stdoutDrained = true; | 744 _stdoutDrained = true; |
| 740 // output = '>>> TEST {PASS, FAIL, OK, CRASH, FAIL, TIMEOUT}' | 745 // output = '>>> TEST {PASS, FAIL, OK, CRASH, FAIL, TIMEOUT}' |
| 741 var outcome = output.split(" ")[2]; | 746 var outcome = output.split(" ")[2]; |
| 742 var exitCode = 0; | 747 var exitCode = 0; |
| 743 if (outcome == "CRASH") exitCode = -10; | 748 if (outcome == "CRASH") exitCode = -10; |
| 744 if (outcome == "FAIL" || outcome == "TIMEOUT") exitCode = 1; | 749 if (outcome == "FAIL" || outcome == "TIMEOUT") exitCode = 1; |
| 745 new TestOutput.fromCase(_currentTest, exitCode, (outcome == "TIMEOUT"), | 750 // TODO(whesse): Remove this temporary code used to diagnose problem. |
| 746 _testStdout, _testStderr, | 751 if (_currentTest == null) { |
| 747 new Date.now().difference(_startTime)); | 752 print("Warning: Batch Test Runner problem:\n" |
| 753 " _currentTest is null\n" | |
| 754 » " Stdout:"); | |
|
Søren Gjesse
2012/05/29 09:11:56
Tab character.
| |
| 755 for (var line in _testStdout) { | |
| 756 print(line); | |
| 757 } | |
| 758 print(" Stderr:"); | |
| 759 for (var line in _testStderr) { | |
| 760 print(line); | |
| 761 } | |
| 762 } else { | |
| 763 new TestOutput.fromCase(_currentTest, exitCode, (outcome == "TIMEOUT"), | |
| 764 _testStdout, _testStderr, | |
| 765 new Date.now().difference(_startTime)); | |
| 766 } | |
| 748 // Move on when both stdout and stderr has been drained. If the test | 767 // Move on when both stdout and stderr has been drained. If the test |
| 749 // crashed, we restarted the process and therefore do not attempt to | 768 // crashed, we restarted the process and therefore do not attempt to |
| 750 // drain stderr. | 769 // drain stderr. |
| 751 if (_stderrDrained || (_currentTest.output.hasCrashed)) _testCompleted(); | 770 if (_stderrDrained || (_currentTest.output.hasCrashed)) _testCompleted(); |
| 752 } | 771 } |
| 753 | 772 |
| 754 void _stderrDone() { | 773 void _stderrDone() { |
| 755 _stderrDrained = true; | 774 _stderrDrained = true; |
| 756 // Move on when both stdout and stderr has been drained. | 775 // Move on when both stdout and stderr has been drained. |
| 757 if (_stdoutDrained) _testCompleted(); | 776 if (_stdoutDrained) _testCompleted(); |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1136 // the developer doesn't waste his or her time trying to fix a bunch of | 1155 // the developer doesn't waste his or her time trying to fix a bunch of |
| 1137 // tests that appear to be broken but were actually just flakes that | 1156 // tests that appear to be broken but were actually just flakes that |
| 1138 // didn't get retried because there had already been one failure. | 1157 // didn't get retried because there had already been one failure. |
| 1139 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; | 1158 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; |
| 1140 new RunningProcess(test, allowRetry, this).start(); | 1159 new RunningProcess(test, allowRetry, this).start(); |
| 1141 } | 1160 } |
| 1142 _numProcesses++; | 1161 _numProcesses++; |
| 1143 } | 1162 } |
| 1144 } | 1163 } |
| 1145 } | 1164 } |
| OLD | NEW |