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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 743 }; | 743 }; |
| 744 _process.kill(); | 744 _process.kill(); |
| 745 } else { | 745 } else { |
| 746 doStartTest(testCase); | 746 doStartTest(testCase); |
| 747 } | 747 } |
| 748 } | 748 } |
| 749 | 749 |
| 750 Future terminate() { | 750 Future terminate() { |
| 751 if (_process == null) return new Future.immediate(true); | 751 if (_process == null) return new Future.immediate(true); |
| 752 Completer completer = new Completer(); | 752 Completer completer = new Completer(); |
| 753 Timer killTimer; | |
| 753 _process.onExit = (exitCode) { | 754 _process.onExit = (exitCode) { |
| 754 _process.close(); | 755 _process.close(); |
| 756 if (killTimer != null) killTimer.cancel(); | |
| 755 completer.complete(true); | 757 completer.complete(true); |
| 756 }; | 758 }; |
| 757 if (_isWebDriver && Platform.operatingSystem == 'windows') { | 759 if (_isWebDriver) { |
| 758 // Use a graceful shutdown so our Selenium script can close | 760 // Use a graceful shutdown so our Selenium script can close |
| 759 // the open browser processes. TODO(jmesserly): Send a signal once | 761 // the open browser processes. On Windows, signals do not exist |
|
Jennifer Messerly
2012/10/09 17:54:56
I'm confused by this comment. See: http://msdn.mic
Emily Fortuna
2012/10/09 18:01:41
It does http://docs.python.org/library/subprocess.
| |
| 760 // that's supported in Windows. | 762 // and a kill is a hard kill. |
| 761 _process.stdin.write('--terminate\n'.charCodes()); | 763 _process.stdin.write('--terminate\n'.charCodes()); |
| 762 | 764 |
| 763 // In case the run_selenium process didn't close, kill it after 30s | 765 // In case the run_selenium process didn't close, kill it after 30s |
| 764 int shutdownMillisecs = 30000; | 766 int shutdownMillisecs = 30000; |
| 765 new Timer(shutdownMillisecs, (e) { if (!closed) _process.kill(); }); | 767 killTimer = new Timer(shutdownMillisecs, (e) { _process.kill(); }); |
| 766 } else { | 768 } else { |
| 767 _process.kill(); | 769 _process.kill(); |
| 768 } | 770 } |
| 769 | 771 |
| 770 return completer.future; | 772 return completer.future; |
| 771 } | 773 } |
| 772 | 774 |
| 773 void doStartTest(TestCase testCase) { | 775 void doStartTest(TestCase testCase) { |
| 774 _startTime = new Date.now(); | 776 _startTime = new Date.now(); |
| 775 _testStdout = []; | 777 _testStdout = []; |
| (...skipping 469 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 | 1247 // 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 | 1248 // tests that appear to be broken but were actually just flakes that |
| 1247 // didn't get retried because there had already been one failure. | 1249 // didn't get retried because there had already been one failure. |
| 1248 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; | 1250 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; |
| 1249 new RunningProcess(test, allowRetry, this).start(); | 1251 new RunningProcess(test, allowRetry, this).start(); |
| 1250 } | 1252 } |
| 1251 _numProcesses++; | 1253 _numProcesses++; |
| 1252 } | 1254 } |
| 1253 } | 1255 } |
| 1254 } | 1256 } |
| OLD | NEW |