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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 523 if (testCase is BrowserTestCase) { | 523 if (testCase is BrowserTestCase) { |
| 524 return new BrowserCommandOutputImpl(testCase, | 524 return new BrowserCommandOutputImpl(testCase, |
| 525 command, | 525 command, |
| 526 exitCode, | 526 exitCode, |
| 527 incomplete, | 527 incomplete, |
| 528 timedOut, | 528 timedOut, |
| 529 stdout, | 529 stdout, |
| 530 stderr, | 530 stderr, |
| 531 time, | 531 time, |
| 532 compilationSkipped); | 532 compilationSkipped); |
| 533 } else if (testCase.configuration['compiler'] == 'dartc') { | 533 } else if (testCase.configuration['analyzer']) { |
| 534 return new AnalysisCommandOutputImpl(testCase, | 534 return new AnalysisCommandOutputImpl(testCase, |
|
kustermann
2013/03/12 17:55:23
Is the output of the new analyzer in the same form
ricow1
2013/03/12 18:06:06
Yes
| |
| 535 command, | 535 command, |
| 536 exitCode, | 536 exitCode, |
| 537 timedOut, | 537 timedOut, |
| 538 stdout, | 538 stdout, |
| 539 stderr, | 539 stderr, |
| 540 time, | 540 time, |
| 541 compilationSkipped); | 541 compilationSkipped); |
| 542 } | 542 } |
| 543 return new CommandOutputImpl(testCase, | 543 return new CommandOutputImpl(testCase, |
| 544 command, | 544 command, |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1197 return; | 1197 return; |
| 1198 } | 1198 } |
| 1199 // Otherwise, process output and call _reportResult() when done. | 1199 // Otherwise, process output and call _reportResult() when done. |
| 1200 var line = stream.readLine(); | 1200 var line = stream.readLine(); |
| 1201 while (line != null) { | 1201 while (line != null) { |
| 1202 if (line.startsWith('>>> TEST')) { | 1202 if (line.startsWith('>>> TEST')) { |
| 1203 _status = line; | 1203 _status = line; |
| 1204 } else if (line.startsWith('>>> BATCH')) { | 1204 } else if (line.startsWith('>>> BATCH')) { |
| 1205 // ignore | 1205 // ignore |
| 1206 } else if (line.startsWith('>>> ')) { | 1206 } else if (line.startsWith('>>> ')) { |
| 1207 throw new Exception('Unexpected command from dartc batch runner.'); | 1207 throw new Exception( |
| 1208 'Unexpected command from ${testCase.configuration['compiler']} ' | |
| 1209 'batch runner.'); | |
| 1208 } else { | 1210 } else { |
| 1209 buffer.addAll(encodeUtf8(line)); | 1211 buffer.addAll(encodeUtf8(line)); |
| 1210 buffer.addAll("\n".charCodes); | 1212 buffer.addAll("\n".charCodes); |
| 1211 } | 1213 } |
| 1212 line = stream.readLine(); | 1214 line = stream.readLine(); |
| 1213 } | 1215 } |
| 1214 if (_status != null) { | 1216 if (_status != null) { |
| 1215 _timer.cancel(); | 1217 _timer.cancel(); |
| 1216 _stdoutDone(); | 1218 _stdoutDone(); |
| 1217 } | 1219 } |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1614 var isBrowserCommand = isLastCommand && (test is BrowserTestCase); | 1616 var isBrowserCommand = isLastCommand && (test is BrowserTestCase); |
| 1615 if (isBrowserCommand && _numBrowserProcesses == _maxBrowserProcesses) { | 1617 if (isBrowserCommand && _numBrowserProcesses == _maxBrowserProcesses) { |
| 1616 // If there is no free browser runner, put it back into the queue. | 1618 // If there is no free browser runner, put it back into the queue. |
| 1617 _tests.add(test); | 1619 _tests.add(test); |
| 1618 new Timer(100, (_) => _tryRunTest()); // Don't lose a process. | 1620 new Timer(100, (_) => _tryRunTest()); // Don't lose a process. |
| 1619 return; | 1621 return; |
| 1620 } | 1622 } |
| 1621 | 1623 |
| 1622 _progress.start(test); | 1624 _progress.start(test); |
| 1623 | 1625 |
| 1624 // Dartc and browser test commands can be run by a [BatchRunnerProcess] | 1626 // Analyzer and browser test commands can be run by a [BatchRunnerProcess] |
| 1625 var nextCommandIndex = test.commandOutputs.keys.length; | 1627 var nextCommandIndex = test.commandOutputs.keys.length; |
| 1626 var numberOfCommands = test.commands.length; | 1628 var numberOfCommands = test.commands.length; |
| 1627 var useBatchRunnerForDartc = test.configuration['compiler'] == 'dartc' && | 1629 |
| 1628 test.displayName != 'dartc/junit_tests'; | 1630 var useBatchRunnerForAnalyzer = |
| 1631 test.configuration['analyzer'] && | |
|
kustermann
2013/03/12 17:55:23
Indentation is strange.
ricow1
2013/03/12 18:06:06
Done.
| |
| 1632 test.displayName != 'dartc/junit_tests'; | |
| 1629 var isWebdriverCommand = nextCommandIndex == (numberOfCommands - 1) && | 1633 var isWebdriverCommand = nextCommandIndex == (numberOfCommands - 1) && |
| 1630 test.usesWebDriver && | 1634 test.usesWebDriver && |
| 1631 !test.configuration['noBatch']; | 1635 !test.configuration['noBatch']; |
| 1632 if (useBatchRunnerForDartc || isWebdriverCommand) { | 1636 if (useBatchRunnerForAnalyzer || isWebdriverCommand) { |
| 1633 TestCaseEvent oldCallback = test.completedHandler; | 1637 TestCaseEvent oldCallback = test.completedHandler; |
| 1634 void testCompleted(TestCase test_arg) { | 1638 void testCompleted(TestCase test_arg) { |
| 1635 _numProcesses--; | 1639 _numProcesses--; |
| 1636 if (isBrowserCommand) { | 1640 if (isBrowserCommand) { |
| 1637 _numBrowserProcesses--; | 1641 _numBrowserProcesses--; |
| 1638 } | 1642 } |
| 1639 _progress.done(test_arg); | 1643 _progress.done(test_arg); |
| 1640 if (test_arg is BrowserTestCase) test_arg.notifyObservers(); | 1644 if (test_arg is BrowserTestCase) test_arg.notifyObservers(); |
| 1641 oldCallback(test_arg); | 1645 oldCallback(test_arg); |
| 1642 _tryRunTest(); | 1646 _tryRunTest(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1746 completer.complete(testCase); | 1750 completer.complete(testCase); |
| 1747 } | 1751 } |
| 1748 }); | 1752 }); |
| 1749 } | 1753 } |
| 1750 runCommand(); | 1754 runCommand(); |
| 1751 | 1755 |
| 1752 return completer.future; | 1756 return completer.future; |
| 1753 } | 1757 } |
| 1754 } | 1758 } |
| 1755 | 1759 |
| OLD | NEW |