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 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1717 var nextCommandIndex = testCase.commandOutputs.keys.length; | 1717 var nextCommandIndex = testCase.commandOutputs.keys.length; |
| 1718 var numberOfCommands = testCase.commands.length; | 1718 var numberOfCommands = testCase.commands.length; |
| 1719 Expect.isTrue(nextCommandIndex < numberOfCommands); | 1719 Expect.isTrue(nextCommandIndex < numberOfCommands); |
| 1720 var command = testCase.commands[nextCommandIndex]; | 1720 var command = testCase.commands[nextCommandIndex]; |
| 1721 var isLastCommand = nextCommandIndex == (numberOfCommands - 1); | 1721 var isLastCommand = nextCommandIndex == (numberOfCommands - 1); |
| 1722 | 1722 |
| 1723 void runCommand() { | 1723 void runCommand() { |
| 1724 var runningProcess = new RunningProcess(testCase, command); | 1724 var runningProcess = new RunningProcess(testCase, command); |
| 1725 runningProcess.start().then((CommandOutput commandOutput) { | 1725 runningProcess.start().then((CommandOutput commandOutput) { |
| 1726 if (isLastCommand) { | 1726 if (isLastCommand) { |
| 1727 // NOTE: We need to call commandOutput.unexpectedOutput here. | |
| 1728 // Calling this getter may result in the side-effect, that | |
| 1729 // commandOutput.requestRetry is set to true. | |
| 1730 // (BrowserCommandOutputImpl._failedBecauseOfMissingXDisplay | |
| 1731 // does that for example) | |
| 1732 // TODO(ricow/kustermann): Getters should not have any | |
|
ricow1
2013/01/29 19:58:33
I would even file a bug for this
kustermann
2013/01/30 09:04:42
Done.
| |
| 1733 // side-effects -- this should be fixed. | |
| 1734 var unexpectedOutput = commandOutput.unexpectedOutput; | |
| 1727 if (allowRetry && testCase.usesWebDriver | 1735 if (allowRetry && testCase.usesWebDriver |
| 1728 && commandOutput.unexpectedOutput | 1736 && unexpectedOutput |
| 1729 && (testCase as BrowserTestCase).numRetries > 0) { | 1737 && (testCase as BrowserTestCase).numRetries > 0) { |
| 1730 // Selenium tests can be flaky. Try rerunning. | 1738 // Selenium tests can be flaky. Try rerunning. |
| 1731 commandOutput.requestRetry = true; | 1739 commandOutput.requestRetry = true; |
| 1732 } | 1740 } |
| 1733 } | 1741 } |
| 1734 if (commandOutput.requestRetry) { | 1742 if (commandOutput.requestRetry) { |
| 1735 commandOutput.requestRetry = false; | 1743 commandOutput.requestRetry = false; |
| 1736 (testCase as BrowserTestCase).numRetries--; | 1744 (testCase as BrowserTestCase).numRetries--; |
| 1737 DebugLogger.warning("Rerunning Test: ${testCase.displayName} " | 1745 DebugLogger.warning("Rerunning Test: ${testCase.displayName} " |
| 1738 "(${(testCase as BrowserTestCase).numRetries} " | 1746 "(${(testCase as BrowserTestCase).numRetries} " |
| 1739 "attempt(s) remains) [cmd:$command]"); | 1747 "attempt(s) remains) [cmd:$command]"); |
| 1740 runCommand(); | 1748 runCommand(); |
| 1741 } else { | 1749 } else { |
| 1742 completer.complete(testCase); | 1750 completer.complete(testCase); |
| 1743 } | 1751 } |
| 1744 }); | 1752 }); |
| 1745 } | 1753 } |
| 1746 runCommand(); | 1754 runCommand(); |
| 1747 | 1755 |
| 1748 return completer.future; | 1756 return completer.future; |
| 1749 } | 1757 } |
| 1750 } | 1758 } |
| 1751 | 1759 |
| OLD | NEW |