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

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

Issue 9501003: Do not go infinite loop if test fails constantly. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 | 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 */ 117 */
118 String compilerPath; 118 String compilerPath;
119 /** 119 /**
120 * The arguments for the compilation command. 120 * The arguments for the compilation command.
121 */ 121 */
122 List<String> compilerArguments; 122 List<String> compilerArguments;
123 /** 123 /**
124 * Indicates the number of potential retries remaining, to compensate for 124 * Indicates the number of potential retries remaining, to compensate for
125 * flaky browser tests. 125 * flaky browser tests.
126 */ 126 */
127 bool numRetries; 127 int numRetries;
128 128
129 BrowserTestCase(displayName, 129 BrowserTestCase(displayName,
130 this.compilerPath, 130 this.compilerPath,
131 this.compilerArguments, 131 this.compilerArguments,
132 executablePath, 132 executablePath,
133 arguments, 133 arguments,
134 configuration, 134 configuration,
135 completedHandler, 135 completedHandler,
136 expectedOutcomes, 136 expectedOutcomes,
137 [isNegative = false]) : super(displayName, 137 [isNegative = false]) : super(displayName,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // Browser case: 209 // Browser case:
210 // If the browser test failed, it may have been because DumpRenderTree 210 // If the browser test failed, it may have been because DumpRenderTree
211 // and the virtual framebuffer X server didn't hook up, or DRT crashed with 211 // and the virtual framebuffer X server didn't hook up, or DRT crashed with
212 // a core dump. Sometimes DRT crashes after it has set the stdout to PASS, 212 // a core dump. Sometimes DRT crashes after it has set the stdout to PASS,
213 // so we have to do this check first. 213 // so we have to do this check first.
214 for (String line in stderr) { 214 for (String line in stderr) {
215 if (line.contains('Gtk-WARNING **: cannot open display: :99') || 215 if (line.contains('Gtk-WARNING **: cannot open display: :99') ||
216 line.contains('Failed to run command. return code=1')) { 216 line.contains('Failed to run command. return code=1')) {
217 // If we get the X server error, or DRT crashes with a core dump, retry 217 // If we get the X server error, or DRT crashes with a core dump, retry
218 // the test. 218 // the test.
219 requestRetry = true; 219 if (testCase.dynamic.numRetries > 0) {
220 requestRetry = true;
221 }
220 return true; 222 return true;
221 } 223 }
222 } 224 }
223 225
224 // Browser tests fail unless stdout contains 226 // Browser tests fail unless stdout contains
225 // 'Content-Type: text/plain\nPASS'. 227 // 'Content-Type: text/plain\nPASS'.
226 String previous_line = ''; 228 String previous_line = '';
227 for (String line in stdout) { 229 for (String line in stdout) {
228 if (line == 'PASS' && previous_line == 'Content-Type: text/plain') { 230 if (line == 'PASS' && previous_line == 'Content-Type: text/plain') {
229 return (exitCode != 0 && !hasCrashed); 231 return (exitCode != 0 && !hasCrashed);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 if (allowRetries != null && allowRetries 278 if (allowRetries != null && allowRetries
277 && testCase.configuration['component'] == 'webdriver' && 279 && testCase.configuration['component'] == 'webdriver' &&
278 testCase.output.unexpectedOutput && testCase.numRetries > 0) { 280 testCase.output.unexpectedOutput && testCase.numRetries > 0) {
279 // Selenium tests can be flaky. Try rerunning. 281 // Selenium tests can be flaky. Try rerunning.
280 testCase.output.requestRetry = true; 282 testCase.output.requestRetry = true;
281 } 283 }
282 if (testCase.output.requestRetry) { 284 if (testCase.output.requestRetry) {
283 testCase.output.requestRetry = false; 285 testCase.output.requestRetry = false;
284 this.timedOut = false; 286 this.timedOut = false;
285 testCase.dynamic.numRetries--; 287 testCase.dynamic.numRetries--;
286 print("Potential flake. Re-running " + testCase.displayName); 288 print("Potential flake. Re-running ${testCase.displayName} (${testCase.dyn amic.numRetries} remains)");
Mads Ager (google) 2012/02/28 17:06:56 Long line.
antonm 2012/02/28 17:20:43 Done. I am using + for now as "aa" "bb" syntax do
287 this.start(); 289 this.start();
288 } else { 290 } else {
289 testCase.completed(); 291 testCase.completed();
290 } 292 }
291 } 293 }
292 294
293 void compilerExitHandler(int exitCode) { 295 void compilerExitHandler(int exitCode) {
294 if (exitCode != 0) { 296 if (exitCode != 0) {
295 stderr.add('test.dart: Compilation step failed (exit code $exitCode)\n'); 297 stderr.add('test.dart: Compilation step failed (exit code $exitCode)\n');
296 exitHandler(exitCode); 298 exitHandler(exitCode);
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 // the developer doesn't waste his or her time trying to fix a bunch of 759 // the developer doesn't waste his or her time trying to fix a bunch of
758 // tests that appear to be broken but were actually just flakes that 760 // tests that appear to be broken but were actually just flakes that
759 // didn't get retried because there had already been one failure. 761 // didn't get retried because there had already been one failure.
760 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; 762 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests;
761 new RunningProcess(test, allowRetry, this).start(); 763 new RunningProcess(test, allowRetry, this).start();
762 } 764 }
763 _numProcesses++; 765 _numProcesses++;
764 } 766 }
765 } 767 }
766 } 768 }
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