| OLD | NEW |
| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 _lastArguments.getRange(1, _lastArguments.length - 1); | 199 _lastArguments.getRange(1, _lastArguments.length - 1); |
| 200 } | 200 } |
| 201 | 201 |
| 202 | 202 |
| 203 /** | 203 /** |
| 204 * TestOutput records the output of a completed test: the process's exit code, | 204 * TestOutput records the output of a completed test: the process's exit code, |
| 205 * the standard output and standard error, whether the process timed out, and | 205 * the standard output and standard error, whether the process timed out, and |
| 206 * the time the process took to run. It also contains a pointer to the | 206 * the time the process took to run. It also contains a pointer to the |
| 207 * [TestCase] this is the output of. | 207 * [TestCase] this is the output of. |
| 208 */ | 208 */ |
| 209 interface TestOutput default TestOutputImpl { | 209 abstract class TestOutput { |
| 210 TestOutput.fromCase(TestCase testCase, int exitCode, bool incomplete, | 210 factory TestOutput.fromCase(TestCase testCase, |
| 211 bool timedOut, | 211 int exitCode, |
| 212 List<String> stdout, List<String> stderr, Duration time); | 212 bool incomplete, |
| 213 bool timedOut, |
| 214 List<String> stdout, |
| 215 List<String> stderr, |
| 216 Duration time) { |
| 217 return new TestOutputImpl.fromCase( |
| 218 testCase, exitCode, incomplete, timedOut, stdout, stderr, time); |
| 219 } |
| 220 |
| 221 bool get incomplete; |
| 213 | 222 |
| 214 String get result; | 223 String get result; |
| 215 | 224 |
| 216 bool get unexpectedOutput; | 225 bool get unexpectedOutput; |
| 217 | 226 |
| 218 bool get hasCrashed; | 227 bool get hasCrashed; |
| 219 | 228 |
| 220 bool get hasTimedOut; | 229 bool get hasTimedOut; |
| 221 | 230 |
| 222 bool get didFail; | 231 bool get didFail; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 TestOutputImpl(TestCase this.testCase, | 274 TestOutputImpl(TestCase this.testCase, |
| 266 int this.exitCode, | 275 int this.exitCode, |
| 267 bool this.incomplete, | 276 bool this.incomplete, |
| 268 bool this.timedOut, | 277 bool this.timedOut, |
| 269 List<String> this.stdout, | 278 List<String> this.stdout, |
| 270 List<String> this.stderr, | 279 List<String> this.stderr, |
| 271 Duration this.time) { | 280 Duration this.time) { |
| 272 testCase.output = this; | 281 testCase.output = this; |
| 273 diagnostics = []; | 282 diagnostics = []; |
| 274 } | 283 } |
| 275 | 284 factory TestOutputImpl.fromCase(TestCase testCase, |
| 276 factory TestOutputImpl.fromCase (TestCase testCase, | 285 int exitCode, |
| 277 int exitCode, | 286 bool incomplete, |
| 278 bool incomplete, | 287 bool timedOut, |
| 279 bool timedOut, | 288 List<String> stdout, |
| 280 List<String> stdout, | 289 List<String> stderr, |
| 281 List<String> stderr, | 290 Duration time) { |
| 282 Duration time) { | |
| 283 if (testCase is BrowserTestCase) { | 291 if (testCase is BrowserTestCase) { |
| 284 return new BrowserTestOutputImpl(testCase, exitCode, incomplete, | 292 return new BrowserTestOutputImpl(testCase, exitCode, incomplete, |
| 285 timedOut, stdout, stderr, time); | 293 timedOut, stdout, stderr, time); |
| 286 } else if (testCase.configuration['compiler'] == 'dartc') { | 294 } else if (testCase.configuration['compiler'] == 'dartc') { |
| 287 return new AnalysisTestOutputImpl(testCase, exitCode, timedOut, | 295 return new AnalysisTestOutputImpl(testCase, exitCode, timedOut, |
| 288 stdout, stderr, time); | 296 stdout, stderr, time); |
| 289 } | 297 } |
| 290 return new TestOutputImpl(testCase, exitCode, incomplete, timedOut, | 298 return new TestOutputImpl(testCase, exitCode, incomplete, timedOut, |
| 291 stdout, stderr, time); | 299 stdout, stderr, time); |
| 292 } | 300 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 for (String line in super.stdout) { | 365 for (String line in super.stdout) { |
| 358 switch (line) { | 366 switch (line) { |
| 359 case 'Content-Type: text/plain': | 367 case 'Content-Type: text/plain': |
| 360 has_content_type = true; | 368 has_content_type = true; |
| 361 break; | 369 break; |
| 362 | 370 |
| 363 case 'PASS': | 371 case 'PASS': |
| 364 if (has_content_type) { | 372 if (has_content_type) { |
| 365 return (exitCode != 0 && !hasCrashed); | 373 return (exitCode != 0 && !hasCrashed); |
| 366 } | 374 } |
| 375 break; |
| 367 } | 376 } |
| 368 } | 377 } |
| 369 return true; | 378 return true; |
| 370 } | 379 } |
| 371 } | 380 } |
| 372 | 381 |
| 373 // The static analyzer does not actually execute code, so | 382 // The static analyzer does not actually execute code, so |
| 374 // the criteria for success now depend on the text sent | 383 // the criteria for success now depend on the text sent |
| 375 // to stderr. | 384 // to stderr. |
| 376 class AnalysisTestOutputImpl extends TestOutputImpl { | 385 class AnalysisTestOutputImpl extends TestOutputImpl { |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 // the developer doesn't waste his or her time trying to fix a bunch of | 1236 // the developer doesn't waste his or her time trying to fix a bunch of |
| 1228 // tests that appear to be broken but were actually just flakes that | 1237 // tests that appear to be broken but were actually just flakes that |
| 1229 // didn't get retried because there had already been one failure. | 1238 // didn't get retried because there had already been one failure. |
| 1230 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; | 1239 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; |
| 1231 new RunningProcess(test, allowRetry, this).start(); | 1240 new RunningProcess(test, allowRetry, this).start(); |
| 1232 } | 1241 } |
| 1233 _numProcesses++; | 1242 _numProcesses++; |
| 1234 } | 1243 } |
| 1235 } | 1244 } |
| 1236 } | 1245 } |
| OLD | NEW |