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

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

Issue 12051037: Fix selenium to detect and handle browser crashes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 | « no previous file | tools/testing/run_selenium.py » ('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.
11 */ 11 */
12 library test_runner; 12 library test_runner;
13 13
14 import "dart:async"; 14 import "dart:async";
15 import "dart:collection" show Queue; 15 import "dart:collection" show Queue;
16 // We need to use the 'io' prefix here, otherwise io.exitCode will shadow 16 // We need to use the 'io' prefix here, otherwise io.exitCode will shadow
17 // CommandOutput.exitCode in subclasses of CommandOutput. 17 // CommandOutput.exitCode in subclasses of CommandOutput.
18 import "dart:io" as io; 18 import "dart:io" as io;
19 import "dart:isolate"; 19 import "dart:isolate";
20 import "dart:uri"; 20 import "dart:uri";
21 import "http_server.dart" as http_server; 21 import "http_server.dart" as http_server;
22 import "status_file_parser.dart"; 22 import "status_file_parser.dart";
23 import "test_progress.dart"; 23 import "test_progress.dart";
24 import "test_suite.dart"; 24 import "test_suite.dart";
25 import "utils.dart"; 25 import "utils.dart";
26 26
27 const int NO_TIMEOUT = 0; 27 const int NO_TIMEOUT = 0;
28 const int SLOW_TIMEOUT_MULTIPLIER = 4; 28 const int SLOW_TIMEOUT_MULTIPLIER = 4;
29 29
30 const int CRASHING_BROWSER_EXITCODE = -10;
31
30 typedef void TestCaseEvent(TestCase testCase); 32 typedef void TestCaseEvent(TestCase testCase);
31 typedef void ExitCodeEvent(int exitCode); 33 typedef void ExitCodeEvent(int exitCode);
32 typedef void EnqueueMoreWork(ProcessQueue queue); 34 typedef void EnqueueMoreWork(ProcessQueue queue);
33 35
34 36
35 /** 37 /**
36 * [areByteArraysEqual] compares a range of bytes from [buffer1] with a 38 * [areByteArraysEqual] compares a range of bytes from [buffer1] with a
37 * range of bytes from [buffer2]. 39 * range of bytes from [buffer2].
38 * 40 *
39 * Returns [true] if the [count] bytes in [buffer1] (starting at 41 * Returns [true] if the [count] bytes in [buffer1] (starting at
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 bool get hasCrashed { 561 bool get hasCrashed {
560 // The Java dartc runner and dart2js exits with code 253 in case 562 // The Java dartc runner and dart2js exits with code 253 in case
561 // of unhandled exceptions. 563 // of unhandled exceptions.
562 if (exitCode == 253) return true; 564 if (exitCode == 253) return true;
563 if (io.Platform.operatingSystem == 'windows') { 565 if (io.Platform.operatingSystem == 'windows') {
564 // The VM uses std::abort to terminate on asserts. 566 // The VM uses std::abort to terminate on asserts.
565 // std::abort terminates with exit code 3 on Windows. 567 // std::abort terminates with exit code 3 on Windows.
566 if (exitCode == 3) { 568 if (exitCode == 3) {
567 return !timedOut; 569 return !timedOut;
568 } 570 }
571 // TODO(ricow): Remove this dirty hack ones we have a selenium
572 // replacement.
573 if (exitCode == CRASHING_BROWSER_EXITCODE) {
574 return !timedOut;
575 }
569 return (!timedOut && (exitCode < 0) && ((0x3FFFFF00 & exitCode) == 0)); 576 return (!timedOut && (exitCode < 0) && ((0x3FFFFF00 & exitCode) == 0));
570 } 577 }
571 return !timedOut && ((exitCode < 0)); 578 return !timedOut && ((exitCode < 0));
572 } 579 }
573 580
574 bool get hasTimedOut => timedOut; 581 bool get hasTimedOut => timedOut;
575 582
576 bool get didFail { 583 bool get didFail {
577 return (exitCode != 0 && !hasCrashed); 584 return (exitCode != 0 && !hasCrashed);
578 } 585 }
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 String _createArgumentsLine(List<String> arguments) { 1274 String _createArgumentsLine(List<String> arguments) {
1268 return Strings.join(arguments, ' ').concat('\n'); 1275 return Strings.join(arguments, ' ').concat('\n');
1269 } 1276 }
1270 1277
1271 void _reportResult() { 1278 void _reportResult() {
1272 if (!active) return; 1279 if (!active) return;
1273 // _status == '>>> TEST {PASS, FAIL, OK, CRASH, FAIL, TIMEOUT}' 1280 // _status == '>>> TEST {PASS, FAIL, OK, CRASH, FAIL, TIMEOUT}'
1274 1281
1275 var outcome = _status.split(" ")[2]; 1282 var outcome = _status.split(" ")[2];
1276 var exitCode = 0; 1283 var exitCode = 0;
1277 if (outcome == "CRASH") exitCode = -10; 1284 if (outcome == "CRASH") exitCode = CRASHING_BROWSER_EXITCODE;
1278 if (outcome == "FAIL" || outcome == "TIMEOUT") exitCode = 1; 1285 if (outcome == "FAIL" || outcome == "TIMEOUT") exitCode = 1;
1279 new CommandOutput.fromCase(_currentTest, 1286 new CommandOutput.fromCase(_currentTest,
1280 _command, 1287 _command,
1281 exitCode, 1288 exitCode,
1282 false, 1289 false,
1283 (outcome == "TIMEOUT"), 1290 (outcome == "TIMEOUT"),
1284 _testStdout, 1291 _testStdout,
1285 _testStderr, 1292 _testStderr,
1286 new Date.now().difference(_startTime), 1293 new Date.now().difference(_startTime),
1287 false); 1294 false);
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
1747 // the developer doesn't waste his or her time trying to fix a bunch of 1754 // the developer doesn't waste his or her time trying to fix a bunch of
1748 // tests that appear to be broken but were actually just flakes that 1755 // tests that appear to be broken but were actually just flakes that
1749 // didn't get retried because there had already been one failure. 1756 // didn't get retried because there had already been one failure.
1750 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; 1757 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests;
1751 new RunningProcess(test, allowRetry, this).start(); 1758 new RunningProcess(test, allowRetry, this).start();
1752 } 1759 }
1753 _numProcesses++; 1760 _numProcesses++;
1754 } 1761 }
1755 } 1762 }
1756 } 1763 }
OLDNEW
« no previous file with comments | « no previous file | tools/testing/run_selenium.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698