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

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

Issue 9361040: Reduce flakiness of browser tests. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 10 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 | « tests/language/language.status ('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 #library("test_runner"); 5 #library("test_runner");
6 6
7 #import("dart:io"); 7 #import("dart:io");
8 #import("status_file_parser.dart"); 8 #import("status_file_parser.dart");
9 #import("test_progress.dart"); 9 #import("test_progress.dart");
10 #import("test_suite.dart"); 10 #import("test_suite.dart");
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 90
91 /** 91 /**
92 * BrowserTestCase has an extra compilation command that is run by 92 * BrowserTestCase has an extra compilation command that is run by
93 * RunningProcess.start(), and it checks conditions on the test output 93 * RunningProcess.start(), and it checks conditions on the test output
94 * in TestOutput.didFail(). 94 * in TestOutput.didFail().
95 */ 95 */
96 class BrowserTestCase extends TestCase { 96 class BrowserTestCase extends TestCase {
97 String compilerPath; 97 String compilerPath;
98 List<String> compilerArguments; 98 List<String> compilerArguments;
99 /**
100 * Indicates if this test is a rerun, to compensate for flaky browser tests.
101 */
102 bool isRerun;
99 103
100 BrowserTestCase(displayName, 104 BrowserTestCase(displayName,
101 this.compilerPath, 105 this.compilerPath,
102 this.compilerArguments, 106 this.compilerArguments,
103 executablePath, 107 executablePath,
104 arguments, 108 arguments,
105 configuration, 109 configuration,
106 completedHandler, 110 completedHandler,
107 expectedOutcomes, 111 expectedOutcomes,
108 [isNegative = false]) : super(displayName, 112 [isNegative = false]) : super(displayName,
109 executablePath, 113 executablePath,
110 arguments, 114 arguments,
111 configuration, 115 configuration,
112 completedHandler, 116 completedHandler,
113 expectedOutcomes, 117 expectedOutcomes,
114 isNegative) { 118 isNegative) {
115 if (compilerPath != null) { 119 if (compilerPath != null) {
116 commandLine = 'execution command: $commandLine'; 120 commandLine = 'execution command: $commandLine';
117 String compilationCommand = 121 String compilationCommand =
118 '$compilerPath ${Strings.join(compilerArguments, " ")}'; 122 '$compilerPath ${Strings.join(compilerArguments, " ")}';
119 commandLine = 'compilation command: $compilationCommand\n$commandLine'; 123 commandLine = 'compilation command: $compilationCommand\n$commandLine';
120 } 124 }
125 isRerun = false;
121 } 126 }
122 } 127 }
123 128
124 129
125 class TestOutput { 130 class TestOutput {
126 // The TestCase this is the output from. 131 // The TestCase this is the output from.
127 TestCase testCase; 132 TestCase testCase;
128 int exitCode; 133 int exitCode;
129 bool timedOut; 134 bool timedOut;
130 bool failed = false; 135 bool failed = false;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 List<String> stderr; 204 List<String> stderr;
200 List<Function> handlers; 205 List<Function> handlers;
201 206
202 RunningProcess(this.testCase); 207 RunningProcess(this.testCase);
203 208
204 void exitHandler(int exitCode) { 209 void exitHandler(int exitCode) {
205 new TestOutput(testCase, exitCode, timedOut, stdout, 210 new TestOutput(testCase, exitCode, timedOut, stdout,
206 stderr, new Date.now().difference(startTime)); 211 stderr, new Date.now().difference(startTime));
207 process.close(); 212 process.close();
208 timeoutTimer.cancel(); 213 timeoutTimer.cancel();
209 testCase.completed(); 214 if (testCase.output.unexpectedOutput && testCase.configuration['verbose']) {
215 print(testCase.output.stdout);
216 print(testCase.output.stderr);
217 }
218 if (testCase is BrowserTestCase && testCase.output.unexpectedOutput &&
219 !testCase.isRerun) {
220 // Selenium tests can be flaky. Try rerunning.
221 testCase.isRerun = true;
222 this.timedOut = false;
223 this.start();
224 } else {
225 testCase.completed();
226 }
210 } 227 }
211 228
212 void compilerExitHandler(int exitCode) { 229 void compilerExitHandler(int exitCode) {
213 if (exitCode != 0) { 230 if (exitCode != 0) {
214 stderr.add('test.dart: Compilation step failed (exit code $exitCode)\n'); 231 stderr.add('test.dart: Compilation step failed (exit code $exitCode)\n');
215 exitHandler(exitCode); 232 exitHandler(exitCode);
216 } else { 233 } else {
217 process.close(); 234 process.close();
218 stderr.add('test.dart: Compilation finished, starting execution\n'); 235 stderr.add('test.dart: Compilation finished, starting execution\n');
219 stdout.add('test.dart: Compilation finished, starting execution\n'); 236 stdout.add('test.dart: Compilation finished, starting execution\n');
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 test.displayName != 'dartc/junit_tests') { 577 test.displayName != 'dartc/junit_tests') {
561 _ensureDartcBatchRunnersStarted(test.executablePath); 578 _ensureDartcBatchRunnersStarted(test.executablePath);
562 _getDartcBatchRunnerProcess().startTest(test); 579 _getDartcBatchRunnerProcess().startTest(test);
563 } else { 580 } else {
564 new RunningProcess(test).start(); 581 new RunningProcess(test).start();
565 } 582 }
566 _numProcesses++; 583 _numProcesses++;
567 } 584 }
568 } 585 }
569 } 586 }
OLDNEW
« no previous file with comments | « tests/language/language.status ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698