Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(553)

Side by Side Diff: tools/testing/dart/test_runner.dart

Issue 15567002: Added support for running dart2js tests on android devices (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 12 matching lines...) Expand all
23 import "status_file_parser.dart"; 23 import "status_file_parser.dart";
24 import "test_progress.dart"; 24 import "test_progress.dart";
25 import "test_suite.dart"; 25 import "test_suite.dart";
26 import "utils.dart"; 26 import "utils.dart";
27 27
28 const int NO_TIMEOUT = 0; 28 const int NO_TIMEOUT = 0;
29 const int SLOW_TIMEOUT_MULTIPLIER = 4; 29 const int SLOW_TIMEOUT_MULTIPLIER = 4;
30 30
31 const int CRASHING_BROWSER_EXITCODE = -10; 31 const int CRASHING_BROWSER_EXITCODE = -10;
32 32
33 const int NUMBER_OF_BROWSERCONTROLLER_BROWSERS = 4;
34
35 typedef void TestCaseEvent(TestCase testCase); 33 typedef void TestCaseEvent(TestCase testCase);
36 typedef void ExitCodeEvent(int exitCode); 34 typedef void ExitCodeEvent(int exitCode);
37 typedef void EnqueueMoreWork(ProcessQueue queue); 35 typedef void EnqueueMoreWork(ProcessQueue queue);
38 36
39 // Some IO tests use these variables and get confused if the host environment 37 // Some IO tests use these variables and get confused if the host environment
40 // variables are inherited so they are excluded. 38 // variables are inherited so they are excluded.
41 const List<String> EXCLUDED_ENVIRONMENT_VARIABLES = 39 const List<String> EXCLUDED_ENVIRONMENT_VARIABLES =
42 const ['http_proxy', 'https_proxy', 'no_proxy', 40 const ['http_proxy', 'https_proxy', 'no_proxy',
43 'HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY']; 41 'HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY'];
44 42
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 StreamSubscription<String> _stdoutSubscription; 1092 StreamSubscription<String> _stdoutSubscription;
1095 StreamSubscription<String> _stderrSubscription; 1093 StreamSubscription<String> _stderrSubscription;
1096 Function _processExitHandler; 1094 Function _processExitHandler;
1097 1095
1098 TestCase _currentTest; 1096 TestCase _currentTest;
1099 List<int> _testStdout; 1097 List<int> _testStdout;
1100 List<int> _testStderr; 1098 List<int> _testStderr;
1101 String _status; 1099 String _status;
1102 DateTime _startTime; 1100 DateTime _startTime;
1103 Timer _timer; 1101 Timer _timer;
1104
1105 bool _isWebDriver; 1102 bool _isWebDriver;
1106 1103
1107 BatchRunnerProcess(TestCase testCase) { 1104 BatchRunnerProcess(TestCase testCase) {
1108 _command = testCase.commands.last; 1105 _command = testCase.commands.last;
1109 _executable = testCase.commands.last.executable; 1106 _executable = testCase.commands.last.executable;
1110 _batchArguments = testCase.batchRunnerArguments; 1107 _batchArguments = testCase.batchRunnerArguments;
1111 _isWebDriver = testCase.usesWebDriver; 1108 _isWebDriver = testCase.usesWebDriver;
1112 } 1109 }
1113 1110
1114 bool get active => _currentTest != null; 1111 bool get active => _currentTest != null;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 var _stdoutStream = 1236 var _stdoutStream =
1240 _process.stdout 1237 _process.stdout
1241 .transform(new io.StringDecoder()) 1238 .transform(new io.StringDecoder())
1242 .transform(new io.LineTransformer()); 1239 .transform(new io.LineTransformer());
1243 _stdoutSubscription = _stdoutStream.listen((String line) { 1240 _stdoutSubscription = _stdoutStream.listen((String line) {
1244 if (line.startsWith('>>> TEST')) { 1241 if (line.startsWith('>>> TEST')) {
1245 _status = line; 1242 _status = line;
1246 } else if (line.startsWith('>>> BATCH')) { 1243 } else if (line.startsWith('>>> BATCH')) {
1247 // ignore 1244 // ignore
1248 } else if (line.startsWith('>>> ')) { 1245 } else if (line.startsWith('>>> ')) {
1249 throw new Exception( 1246 throw new Exception("Unexpected command from batch runner: '$line'.");
1250 'Unexpected command from ${testCase.configuration['compiler']} '
1251 'batch runner.');
1252 } else { 1247 } else {
1253 _testStdout.addAll(encodeUtf8(line)); 1248 _testStdout.addAll(encodeUtf8(line));
1254 _testStdout.addAll("\n".codeUnits); 1249 _testStdout.addAll("\n".codeUnits);
1255 } 1250 }
1256 if (_status != null) { 1251 if (_status != null) {
1257 _stdoutSubscription.pause(); 1252 _stdoutSubscription.pause();
1258 _timer.cancel(); 1253 _timer.cancel();
1259 _stdoutCompleter.complete(null); 1254 _stdoutCompleter.complete(null);
1260 } 1255 }
1261 }); 1256 });
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 _batchProcesses[compiler] = runners; 1571 _batchProcesses[compiler] = runners;
1577 } 1572 }
1578 1573
1579 for (var runner in runners) { 1574 for (var runner in runners) {
1580 if (!runner.active) return runner; 1575 if (!runner.active) return runner;
1581 } 1576 }
1582 throw new Exception('Unable to find inactive batch runner.'); 1577 throw new Exception('Unable to find inactive batch runner.');
1583 } 1578 }
1584 1579
1585 Future<BrowserTestRunner> _getBrowserTestRunner(TestCase test) { 1580 Future<BrowserTestRunner> _getBrowserTestRunner(TestCase test) {
1581 var local_ip = test.configuration['local_ip'];
1586 var runtime = test.configuration['runtime']; 1582 var runtime = test.configuration['runtime'];
1583 var num_browsers = test.configuration['tasks'];
1587 if (_browserTestRunners[runtime] == null) { 1584 if (_browserTestRunners[runtime] == null) {
1588 var testRunner = 1585 var testRunner =
1589 new BrowserTestRunner(runtime, NUMBER_OF_BROWSERCONTROLLER_BROWSERS); 1586 new BrowserTestRunner(local_ip, runtime, num_browsers);
1590 _browserTestRunners[runtime] = testRunner; 1587 _browserTestRunners[runtime] = testRunner;
1591 return testRunner.start().then((started) { 1588 return testRunner.start().then((started) {
1592 if (started) { 1589 if (started) {
1593 return testRunner; 1590 return testRunner;
1594 } 1591 }
1595 print("Issue starting browser test runner"); 1592 print("Issue starting browser test runner");
1596 exit(1); 1593 io.exit(1);
1597 }); 1594 });
1598 } 1595 }
1599 return new Future.immediate(_browserTestRunners[runtime]); 1596 return new Future.immediate(_browserTestRunners[runtime]);
1600 } 1597 }
1601 1598
1602 void _startBrowserControllerTest(var test) { 1599 void _startBrowserControllerTest(var test) {
1603 // Get the url. 1600 // Get the url.
1604 // TODO(ricow): This is not needed when we have eliminated selenium. 1601 // TODO(ricow): This is not needed when we have eliminated selenium.
1605 var nextCommandIndex = test.commandOutputs.keys.length; 1602 var nextCommandIndex = test.commandOutputs.keys.length;
1606 var url = test.commands[nextCommandIndex].toString().split("--out=")[1]; 1603 var url = test.commands[nextCommandIndex].toString().split("--out=")[1];
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1694 _numProcesses--; 1691 _numProcesses--;
1695 if (isBrowserCommand) { 1692 if (isBrowserCommand) {
1696 _numBrowserProcesses--; 1693 _numBrowserProcesses--;
1697 } 1694 }
1698 eventFinishedTestCase(test_arg); 1695 eventFinishedTestCase(test_arg);
1699 if (test_arg is BrowserTestCase) test_arg.notifyObservers(); 1696 if (test_arg is BrowserTestCase) test_arg.notifyObservers();
1700 oldCallback(test_arg); 1697 oldCallback(test_arg);
1701 _tryRunTest(); 1698 _tryRunTest();
1702 }; 1699 };
1703 test.completedHandler = testCompleted; 1700 test.completedHandler = testCompleted;
1704
1705 if (test.usesBrowserController) { 1701 if (test.usesBrowserController) {
1706 _startBrowserControllerTest(test); 1702 _startBrowserControllerTest(test);
1707 } else { 1703 } else {
1708 _getBatchRunner(test).startTest(test); 1704 _getBatchRunner(test).startTest(test);
1709 } 1705 }
1710 } else { 1706 } else {
1711 // Once we've actually failed a test, technically, we wouldn't need to 1707 // Once we've actually failed a test, technically, we wouldn't need to
1712 // bother retrying any subsequent tests since the bot is already red. 1708 // bother retrying any subsequent tests since the bot is already red.
1713 // However, we continue to retry tests until we have actually failed 1709 // However, we continue to retry tests until we have actually failed
1714 // four tests (arbitrarily chosen) for more debugable output, so that 1710 // four tests (arbitrarily chosen) for more debugable output, so that
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 } 1841 }
1846 } 1842 }
1847 1843
1848 void eventAllTestsDone() { 1844 void eventAllTestsDone() {
1849 for (var listener in _eventListener) { 1845 for (var listener in _eventListener) {
1850 listener.allDone(); 1846 listener.allDone();
1851 } 1847 }
1852 } 1848 }
1853 } 1849 }
1854 1850
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698