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

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

Issue 2934243002: Move ie11 timeout handling code to BrowserControllerTestOutcome (Closed)
Patch Set: Add TODO comment Created 3 years, 6 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
« no previous file with comments | « no previous file | no next file » | 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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 Expectation outcome, bool isNegative) { 1036 Expectation outcome, bool isNegative) {
1037 if (!isNegative) return outcome; 1037 if (!isNegative) return outcome;
1038 if (outcome == Expectation.ignore) return outcome; 1038 if (outcome == Expectation.ignore) return outcome;
1039 if (outcome.canBeOutcomeOf(Expectation.fail)) { 1039 if (outcome.canBeOutcomeOf(Expectation.fail)) {
1040 return Expectation.pass; 1040 return Expectation.pass;
1041 } 1041 }
1042 return Expectation.fail; 1042 return Expectation.fail;
1043 } 1043 }
1044 } 1044 }
1045 1045
1046 class BrowserCommandOutputImpl extends CommandOutputImpl { 1046 class ContentShellCommandOutputImpl extends CommandOutputImpl {
1047 // Although tests are reported as passing, content shell sometimes exits with 1047 // Although tests are reported as passing, content shell sometimes exits with
1048 // a nonzero exitcode which makes our dartium builders extremely falky. 1048 // a nonzero exitcode which makes our dartium builders extremely falky.
1049 // See: http://dartbug.com/15139. 1049 // See: http://dartbug.com/15139.
1050 // TODO(rnystrom): Is this still needed? The underlying bug is closed. 1050 // TODO(rnystrom): Is this still needed? The underlying bug is closed.
1051 static int WHITELISTED_CONTENTSHELL_EXITCODE = -1073740022; 1051 static int WHITELISTED_CONTENTSHELL_EXITCODE = -1073740022;
1052 static bool isWindows = io.Platform.operatingSystem == 'windows'; 1052 static bool isWindows = io.Platform.operatingSystem == 'windows';
1053 static bool _failedBecauseOfFlakyInfrastructure( 1053 static bool _failedBecauseOfFlakyInfrastructure(
1054 Command command, bool timedOut, List<int> stderrBytes) { 1054 Command command, bool timedOut, List<int> stderrBytes) {
1055 // If the browser test failed, it may have been because content shell 1055 // If the browser test failed, it may have been because content shell
1056 // and the virtual framebuffer X server didn't hook up, or it crashed with 1056 // and the virtual framebuffer X server didn't hook up, or it crashed with
(...skipping 10 matching lines...) Expand all
1067 DebugLogger.warning( 1067 DebugLogger.warning(
1068 "Warning: Failure because of missing XDisplay. Test ignored"); 1068 "Warning: Failure because of missing XDisplay. Test ignored");
1069 return true; 1069 return true;
1070 } 1070 }
1071 // TODO(26739): See http://dartbug.com/26739 1071 // TODO(26739): See http://dartbug.com/26739
1072 if (zygoteCrash.hasMatch(stderr)) { 1072 if (zygoteCrash.hasMatch(stderr)) {
1073 DebugLogger.warning("Warning: Failure because of content_shell " 1073 DebugLogger.warning("Warning: Failure because of content_shell "
1074 "zygote crash. Test ignored"); 1074 "zygote crash. Test ignored");
1075 return true; 1075 return true;
1076 } 1076 }
1077 // TODO(28955): See http://dartbug.com/28955
1078 if (timedOut &&
1079 command is BrowserTestCommand &&
1080 command.browser == Runtime.ie11) {
1081 DebugLogger.warning("Timeout of ie11 on test page ${command.url}");
1082 return true;
1083 }
1084 return false; 1077 return false;
1085 } 1078 }
1086 1079
1087 bool _infraFailure; 1080 bool _infraFailure;
1088 1081
1089 BrowserCommandOutputImpl( 1082 ContentShellCommandOutputImpl(
1090 Command command, 1083 Command command,
1091 int exitCode, 1084 int exitCode,
1092 bool timedOut, 1085 bool timedOut,
1093 List<int> stdout, 1086 List<int> stdout,
1094 List<int> stderr, 1087 List<int> stderr,
1095 Duration time, 1088 Duration time,
1096 bool compilationSkipped) 1089 bool compilationSkipped)
1097 : _infraFailure = 1090 : _infraFailure =
1098 _failedBecauseOfFlakyInfrastructure(command, timedOut, stderr), 1091 _failedBecauseOfFlakyInfrastructure(command, timedOut, stderr),
1099 super(command, exitCode, timedOut, stdout, stderr, time, 1092 super(command, exitCode, timedOut, stdout, stderr, time,
1100 compilationSkipped, 0); 1093 compilationSkipped, 0);
1101 1094
1102 Expectation result(TestCase testCase) { 1095 Expectation result(TestCase testCase) {
1103 if (_infraFailure) { 1096 if (_infraFailure) {
1104 return Expectation.ignore; 1097 return Expectation.ignore;
1105 } 1098 }
1106 // TODO(28955): See http://dartbug.com/28955 1099
1107 // The code for this in _failedBecauseOfFlakyInfrastructure doesn't
1108 // seem to be working.
1109 if (hasTimedOut && testCase.configuration.runtime == Runtime.ie11) {
1110 DebugLogger.warning("Timeout of ie11 on test ${testCase.displayName}");
1111 return Expectation.ignore;
1112 }
1113 // Handle crashes and timeouts first 1100 // Handle crashes and timeouts first
1114 if (hasCrashed) return Expectation.crash; 1101 if (hasCrashed) return Expectation.crash;
1115 if (hasTimedOut) return Expectation.timeout; 1102 if (hasTimedOut) return Expectation.timeout;
1116 if (hasNonUtf8) return Expectation.nonUtf8Error; 1103 if (hasNonUtf8) return Expectation.nonUtf8Error;
1117 1104
1118 var outcome = _getOutcome(); 1105 var outcome = _getOutcome();
1119 1106
1120 if (testCase.hasRuntimeError) { 1107 if (testCase.hasRuntimeError) {
1121 if (!outcome.canBeOutcomeOf(Expectation.runtimeError)) { 1108 if (!outcome.canBeOutcomeOf(Expectation.runtimeError)) {
1122 return Expectation.missingRuntimeError; 1109 return Expectation.missingRuntimeError;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 return (!hasCrashed && 1185 return (!hasCrashed &&
1199 exitCode != 0 && 1186 exitCode != 0 &&
1200 (!isWindows || exitCode != WHITELISTED_CONTENTSHELL_EXITCODE)); 1187 (!isWindows || exitCode != WHITELISTED_CONTENTSHELL_EXITCODE));
1201 } 1188 }
1202 DebugLogger.warning("Couldn't find 'Content-Type: text/plain' in output. " 1189 DebugLogger.warning("Couldn't find 'Content-Type: text/plain' in output. "
1203 "($command)."); 1190 "($command).");
1204 return true; 1191 return true;
1205 } 1192 }
1206 } 1193 }
1207 1194
1208 class HTMLBrowserCommandOutputImpl extends BrowserCommandOutputImpl { 1195 // TODO(29869): Remove this class after verifying it isn't used.
1196 class HTMLBrowserCommandOutputImpl extends ContentShellCommandOutputImpl {
1209 HTMLBrowserCommandOutputImpl( 1197 HTMLBrowserCommandOutputImpl(
1210 Command command, 1198 Command command,
1211 int exitCode, 1199 int exitCode,
1212 bool timedOut, 1200 bool timedOut,
1213 List<int> stdout, 1201 List<int> stdout,
1214 List<int> stderr, 1202 List<int> stderr,
1215 Duration time, 1203 Duration time,
1216 bool compilationSkipped) 1204 bool compilationSkipped)
1217 : super(command, exitCode, timedOut, stdout, stderr, time, 1205 : super(command, exitCode, timedOut, stdout, stderr, time,
1218 compilationSkipped); 1206 compilationSkipped);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 this._rawOutcome, 1406 this._rawOutcome,
1419 List<int> stdout, 1407 List<int> stdout,
1420 List<int> stderr) 1408 List<int> stderr)
1421 : super(command, 0, result.didTimeout, stdout, stderr, result.duration, 1409 : super(command, 0, result.didTimeout, stdout, stderr, result.duration,
1422 false, 0) { 1410 false, 0) {
1423 _result = result; 1411 _result = result;
1424 } 1412 }
1425 1413
1426 Expectation result(TestCase testCase) { 1414 Expectation result(TestCase testCase) {
1427 // Handle timeouts first 1415 // Handle timeouts first
1428 if (_result.didTimeout) return Expectation.timeout; 1416 if (_result.didTimeout) {
1417 if (testCase.configuration.runtime == Runtime.ie11) {
1418 // TODO(28955): See http://dartbug.com/28955
1419 DebugLogger.warning("Timeout of ie11 on test ${testCase.displayName}");
1420 return Expectation.ignore;
1421 }
1422 return Expectation.timeout;
1423 }
1424
1429 if (hasNonUtf8) return Expectation.nonUtf8Error; 1425 if (hasNonUtf8) return Expectation.nonUtf8Error;
1430 1426
1431 // Multitests are handled specially 1427 // Multitests are handled specially
1432 if (testCase.hasRuntimeError) { 1428 if (testCase.hasRuntimeError) {
1433 if (_rawOutcome == Expectation.runtimeError) return Expectation.pass; 1429 if (_rawOutcome == Expectation.runtimeError) return Expectation.pass;
1434 return Expectation.missingRuntimeError; 1430 return Expectation.missingRuntimeError;
1435 } 1431 }
1436 1432
1437 return _negateOutcomeIfNegativeTest(_rawOutcome, testCase.isNegative); 1433 return _negateOutcomeIfNegativeTest(_rawOutcome, testCase.isNegative);
1438 } 1434 }
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 1742
1747 bool get canRunDependendCommands => _result == Expectation.pass; 1743 bool get canRunDependendCommands => _result == Expectation.pass;
1748 1744
1749 bool get successful => _result == Expectation.pass; 1745 bool get successful => _result == Expectation.pass;
1750 } 1746 }
1751 1747
1752 CommandOutput createCommandOutput(Command command, int exitCode, bool timedOut, 1748 CommandOutput createCommandOutput(Command command, int exitCode, bool timedOut,
1753 List<int> stdout, List<int> stderr, Duration time, bool compilationSkipped, 1749 List<int> stdout, List<int> stderr, Duration time, bool compilationSkipped,
1754 [int pid = 0]) { 1750 [int pid = 0]) {
1755 if (command is ContentShellCommand) { 1751 if (command is ContentShellCommand) {
1756 return new BrowserCommandOutputImpl( 1752 return new ContentShellCommandOutputImpl(
1757 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped); 1753 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped);
1758 } else if (command is BrowserTestCommand) { 1754 } else if (command is BrowserTestCommand) {
1759 return new HTMLBrowserCommandOutputImpl( 1755 return new HTMLBrowserCommandOutputImpl(
1760 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped); 1756 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped);
1761 } else if (command is AnalysisCommand) { 1757 } else if (command is AnalysisCommand) {
1762 return new AnalysisCommandOutputImpl( 1758 return new AnalysisCommandOutputImpl(
1763 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped); 1759 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped);
1764 } else if (command is VmCommand) { 1760 } else if (command is VmCommand) {
1765 return new VmCommandOutputImpl( 1761 return new VmCommandOutputImpl(
1766 command, exitCode, timedOut, stdout, stderr, time, pid); 1762 command, exitCode, timedOut, stdout, stderr, time, pid);
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
3235 } 3231 }
3236 } 3232 }
3237 3233
3238 void eventAllTestsDone() { 3234 void eventAllTestsDone() {
3239 for (var listener in _eventListener) { 3235 for (var listener in _eventListener) {
3240 listener.allDone(); 3236 listener.allDone();
3241 } 3237 }
3242 _allDone(); 3238 _allDone();
3243 } 3239 }
3244 } 3240 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698