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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 // Browser case: | 309 // Browser case: |
310 // If the browser test failed, it may have been because DumpRenderTree | 310 // If the browser test failed, it may have been because DumpRenderTree |
311 // and the virtual framebuffer X server didn't hook up, or DRT crashed with | 311 // and the virtual framebuffer X server didn't hook up, or DRT crashed with |
312 // a core dump. Sometimes DRT crashes after it has set the stdout to PASS, | 312 // a core dump. Sometimes DRT crashes after it has set the stdout to PASS, |
313 // so we have to do this check first. | 313 // so we have to do this check first. |
314 for (String line in super.stderr) { | 314 for (String line in super.stderr) { |
315 if (line.contains('Gtk-WARNING **: cannot open display: :99') || | 315 if (line.contains('Gtk-WARNING **: cannot open display: :99') || |
316 line.contains('Failed to run command. return code=1')) { | 316 line.contains('Failed to run command. return code=1')) { |
317 // If we get the X server error, or DRT crashes with a core dump, retry | 317 // If we get the X server error, or DRT crashes with a core dump, retry |
318 // the test. | 318 // the test. |
319 if (testCase.dynamic.numRetries > 0) { | 319 if ((testCase as Dynamic).numRetries > 0) { |
320 requestRetry = true; | 320 requestRetry = true; |
321 } | 321 } |
322 return true; | 322 return true; |
323 } | 323 } |
324 } | 324 } |
325 | 325 |
326 // Browser tests fail unless stdout contains | 326 // Browser tests fail unless stdout contains |
327 // 'Content-Type: text/plain' followed by 'PASS'. | 327 // 'Content-Type: text/plain' followed by 'PASS'. |
328 bool has_content_type = false; | 328 bool has_content_type = false; |
329 for (String line in super.stdout) { | 329 for (String line in super.stdout) { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 timeoutTimer.cancel(); | 544 timeoutTimer.cancel(); |
545 if (testCase.output.unexpectedOutput | 545 if (testCase.output.unexpectedOutput |
546 && testCase.configuration['verbose'] != null | 546 && testCase.configuration['verbose'] != null |
547 && testCase.configuration['verbose']) { | 547 && testCase.configuration['verbose']) { |
548 print(testCase.displayName); | 548 print(testCase.displayName); |
549 for (var line in testCase.output.stderr) print(line); | 549 for (var line in testCase.output.stderr) print(line); |
550 for (var line in testCase.output.stdout) print(line); | 550 for (var line in testCase.output.stdout) print(line); |
551 } | 551 } |
552 if (allowRetries && testCase.usesWebDriver | 552 if (allowRetries && testCase.usesWebDriver |
553 && testCase.output.unexpectedOutput | 553 && testCase.output.unexpectedOutput |
554 && testCase.dynamic.numRetries > 0) { | 554 && (testCase as Dynamic).numRetries > 0) { |
555 // Selenium tests can be flaky. Try rerunning. | 555 // Selenium tests can be flaky. Try rerunning. |
556 testCase.output.requestRetry = true; | 556 testCase.output.requestRetry = true; |
557 } | 557 } |
558 if (testCase.output.requestRetry) { | 558 if (testCase.output.requestRetry) { |
559 testCase.output.requestRetry = false; | 559 testCase.output.requestRetry = false; |
560 this.timedOut = false; | 560 this.timedOut = false; |
561 testCase.dynamic.numRetries--; | 561 (testCase as Dynamic).numRetries--; |
562 print("Potential flake. Re-running ${testCase.displayName} " | 562 print("Potential flake. Re-running ${testCase.displayName} " |
563 "(${testCase.dynamic.numRetries} attempt(s) remains)"); | 563 "(${(testCase as Dynamic).numRetries} attempt(s) remains)"); |
564 this.start(); | 564 this.start(); |
565 } else { | 565 } else { |
566 testCase.completed(); | 566 testCase.completed(); |
567 } | 567 } |
568 } | 568 } |
569 | 569 |
570 /** | 570 /** |
571 * Process exit handler called at the end of every command. It internally | 571 * Process exit handler called at the end of every command. It internally |
572 * treats all but the last command as compilation steps. The last command is | 572 * treats all but the last command as compilation steps. The last command is |
573 * the actual test and its output is analyzed in [testComplete]. | 573 * the actual test and its output is analyzed in [testComplete]. |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 // the developer doesn't waste his or her time trying to fix a bunch of | 1186 // the developer doesn't waste his or her time trying to fix a bunch of |
1187 // tests that appear to be broken but were actually just flakes that | 1187 // tests that appear to be broken but were actually just flakes that |
1188 // didn't get retried because there had already been one failure. | 1188 // didn't get retried because there had already been one failure. |
1189 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; | 1189 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; |
1190 new RunningProcess(test, allowRetry, this).start(); | 1190 new RunningProcess(test, allowRetry, this).start(); |
1191 } | 1191 } |
1192 _numProcesses++; | 1192 _numProcesses++; |
1193 } | 1193 } |
1194 } | 1194 } |
1195 } | 1195 } |
OLD | NEW |