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

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
« no previous file with comments | « tools/testing/dart/test_options.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 StreamSubscription<String> _stdoutSubscription; 1108 StreamSubscription<String> _stdoutSubscription;
1111 StreamSubscription<String> _stderrSubscription; 1109 StreamSubscription<String> _stderrSubscription;
1112 Function _processExitHandler; 1110 Function _processExitHandler;
1113 1111
1114 TestCase _currentTest; 1112 TestCase _currentTest;
1115 List<int> _testStdout; 1113 List<int> _testStdout;
1116 List<int> _testStderr; 1114 List<int> _testStderr;
1117 String _status; 1115 String _status;
1118 DateTime _startTime; 1116 DateTime _startTime;
1119 Timer _timer; 1117 Timer _timer;
1120
1121 bool _isWebDriver; 1118 bool _isWebDriver;
1122 1119
1123 BatchRunnerProcess(TestCase testCase) { 1120 BatchRunnerProcess(TestCase testCase) {
1124 _command = testCase.commands.last; 1121 _command = testCase.commands.last;
1125 _executable = testCase.commands.last.executable; 1122 _executable = testCase.commands.last.executable;
1126 _batchArguments = testCase.batchRunnerArguments; 1123 _batchArguments = testCase.batchRunnerArguments;
1127 _isWebDriver = testCase.usesWebDriver; 1124 _isWebDriver = testCase.usesWebDriver;
1128 } 1125 }
1129 1126
1130 bool get active => _currentTest != null; 1127 bool get active => _currentTest != null;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 var _stdoutStream = 1254 var _stdoutStream =
1258 _process.stdout 1255 _process.stdout
1259 .transform(new io.StringDecoder()) 1256 .transform(new io.StringDecoder())
1260 .transform(new io.LineTransformer()); 1257 .transform(new io.LineTransformer());
1261 _stdoutSubscription = _stdoutStream.listen((String line) { 1258 _stdoutSubscription = _stdoutStream.listen((String line) {
1262 if (line.startsWith('>>> TEST')) { 1259 if (line.startsWith('>>> TEST')) {
1263 _status = line; 1260 _status = line;
1264 } else if (line.startsWith('>>> BATCH')) { 1261 } else if (line.startsWith('>>> BATCH')) {
1265 // ignore 1262 // ignore
1266 } else if (line.startsWith('>>> ')) { 1263 } else if (line.startsWith('>>> ')) {
1267 throw new Exception( 1264 throw new Exception("Unexpected command from batch runner: '$line'.");
1268 'Unexpected command from ${testCase.configuration['compiler']} '
1269 'batch runner.');
1270 } else { 1265 } else {
1271 _testStdout.addAll(encodeUtf8(line)); 1266 _testStdout.addAll(encodeUtf8(line));
1272 _testStdout.addAll("\n".codeUnits); 1267 _testStdout.addAll("\n".codeUnits);
1273 } 1268 }
1274 if (_status != null) { 1269 if (_status != null) {
1275 _stdoutSubscription.pause(); 1270 _stdoutSubscription.pause();
1276 _timer.cancel(); 1271 _timer.cancel();
1277 _stdoutCompleter.complete(null); 1272 _stdoutCompleter.complete(null);
1278 } 1273 }
1279 }); 1274 });
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 _batchProcesses[compiler] = runners; 1589 _batchProcesses[compiler] = runners;
1595 } 1590 }
1596 1591
1597 for (var runner in runners) { 1592 for (var runner in runners) {
1598 if (!runner.active) return runner; 1593 if (!runner.active) return runner;
1599 } 1594 }
1600 throw new Exception('Unable to find inactive batch runner.'); 1595 throw new Exception('Unable to find inactive batch runner.');
1601 } 1596 }
1602 1597
1603 Future<BrowserTestRunner> _getBrowserTestRunner(TestCase test) { 1598 Future<BrowserTestRunner> _getBrowserTestRunner(TestCase test) {
1599 var local_ip = test.configuration['local_ip'];
1604 var runtime = test.configuration['runtime']; 1600 var runtime = test.configuration['runtime'];
1601 var num_browsers = test.configuration['tasks'];
1605 if (_browserTestRunners[runtime] == null) { 1602 if (_browserTestRunners[runtime] == null) {
1606 var testRunner = 1603 var testRunner =
1607 new BrowserTestRunner(runtime, NUMBER_OF_BROWSERCONTROLLER_BROWSERS); 1604 new BrowserTestRunner(local_ip, runtime, num_browsers);
1608 _browserTestRunners[runtime] = testRunner; 1605 _browserTestRunners[runtime] = testRunner;
1609 return testRunner.start().then((started) { 1606 return testRunner.start().then((started) {
1610 if (started) { 1607 if (started) {
1611 return testRunner; 1608 return testRunner;
1612 } 1609 }
1613 print("Issue starting browser test runner"); 1610 print("Issue starting browser test runner");
1614 exit(1); 1611 io.exit(1);
1615 }); 1612 });
1616 } 1613 }
1617 return new Future.immediate(_browserTestRunners[runtime]); 1614 return new Future.immediate(_browserTestRunners[runtime]);
1618 } 1615 }
1619 1616
1620 void _startBrowserControllerTest(var test) { 1617 void _startBrowserControllerTest(var test) {
1621 // Get the url. 1618 // Get the url.
1622 // TODO(ricow): This is not needed when we have eliminated selenium. 1619 // TODO(ricow): This is not needed when we have eliminated selenium.
1623 var nextCommandIndex = test.commandOutputs.keys.length; 1620 var nextCommandIndex = test.commandOutputs.keys.length;
1624 var url = test.commands[nextCommandIndex].toString().split("--out=")[1]; 1621 var url = test.commands[nextCommandIndex].toString().split("--out=")[1];
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 _numProcesses--; 1709 _numProcesses--;
1713 if (isBrowserCommand) { 1710 if (isBrowserCommand) {
1714 _numBrowserProcesses--; 1711 _numBrowserProcesses--;
1715 } 1712 }
1716 eventFinishedTestCase(test_arg); 1713 eventFinishedTestCase(test_arg);
1717 if (test_arg is BrowserTestCase) test_arg.notifyObservers(); 1714 if (test_arg is BrowserTestCase) test_arg.notifyObservers();
1718 oldCallback(test_arg); 1715 oldCallback(test_arg);
1719 _tryRunTest(); 1716 _tryRunTest();
1720 }; 1717 };
1721 test.completedHandler = testCompleted; 1718 test.completedHandler = testCompleted;
1722
1723 if (test.usesBrowserController) { 1719 if (test.usesBrowserController) {
1724 _startBrowserControllerTest(test); 1720 _startBrowserControllerTest(test);
1725 } else { 1721 } else {
1726 _getBatchRunner(test).startTest(test); 1722 _getBatchRunner(test).startTest(test);
1727 } 1723 }
1728 } else { 1724 } else {
1729 // Once we've actually failed a test, technically, we wouldn't need to 1725 // Once we've actually failed a test, technically, we wouldn't need to
1730 // bother retrying any subsequent tests since the bot is already red. 1726 // bother retrying any subsequent tests since the bot is already red.
1731 // However, we continue to retry tests until we have actually failed 1727 // However, we continue to retry tests until we have actually failed
1732 // four tests (arbitrarily chosen) for more debugable output, so that 1728 // four tests (arbitrarily chosen) for more debugable output, so that
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 } 1859 }
1864 } 1860 }
1865 1861
1866 void eventAllTestsDone() { 1862 void eventAllTestsDone() {
1867 for (var listener in _eventListener) { 1863 for (var listener in _eventListener) {
1868 listener.allDone(); 1864 listener.allDone();
1869 } 1865 }
1870 } 1866 }
1871 } 1867 }
1872 1868
OLDNEW
« no previous file with comments | « tools/testing/dart/test_options.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698