| 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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 // so we have to do this check first. | 624 // so we have to do this check first. |
| 625 var stderrLines = new String.fromCharCodes(super.stderr).split("\n"); | 625 var stderrLines = new String.fromCharCodes(super.stderr).split("\n"); |
| 626 for (String line in stderrLines) { | 626 for (String line in stderrLines) { |
| 627 if (line.contains('Gtk-WARNING **: cannot open display: :99') || | 627 if (line.contains('Gtk-WARNING **: cannot open display: :99') || |
| 628 line.contains('Failed to run command. return code=1')) { | 628 line.contains('Failed to run command. return code=1')) { |
| 629 // If we get the X server error, or DRT crashes with a core dump, retry | 629 // If we get the X server error, or DRT crashes with a core dump, retry |
| 630 // the test. | 630 // the test. |
| 631 if ((testCase as BrowserTestCase).numRetries > 0) { | 631 if ((testCase as BrowserTestCase).numRetries > 0) { |
| 632 requestRetry = true; | 632 requestRetry = true; |
| 633 } | 633 } |
| 634 printDebug("Failed because of missing XDisplay"); |
| 634 return true; | 635 return true; |
| 635 } | 636 } |
| 636 } | 637 } |
| 637 return false; | 638 return false; |
| 638 } | 639 } |
| 639 | 640 |
| 640 bool get _failedBecauseOfUnexpectedDRTOutput { | 641 bool get _failedBecauseOfUnexpectedDRTOutput { |
| 641 /* | 642 /* |
| 642 * The output of DumpRenderTree is different for pixel tests than for | 643 * The output of DumpRenderTree is different for pixel tests than for |
| 643 * layout tests. | 644 * layout tests. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 666 var startOfContentLength = findBytes(stdout, bytesContentLength); | 667 var startOfContentLength = findBytes(stdout, bytesContentLength); |
| 667 if (startOfContentLength >= 0) { | 668 if (startOfContentLength >= 0) { |
| 668 var newLineAfterContentLength = findBytes(stdout, | 669 var newLineAfterContentLength = findBytes(stdout, |
| 669 bytesNewLine, | 670 bytesNewLine, |
| 670 startOfContentLength); | 671 startOfContentLength); |
| 671 if (newLineAfterContentLength > 0) { | 672 if (newLineAfterContentLength > 0) { |
| 672 var startPosition = newLineAfterContentLength + | 673 var startPosition = newLineAfterContentLength + |
| 673 bytesNewLine.length; | 674 bytesNewLine.length; |
| 674 var endPosition = stdout.length - bytesEOF.length; | 675 var endPosition = stdout.length - bytesEOF.length; |
| 675 | 676 |
| 676 return !areByteArraysEqual(expectedContent, | 677 var _failed = !areByteArraysEqual(expectedContent, |
| 677 0, | 678 0, |
| 678 stdout, | 679 stdout, |
| 679 startPosition, | 680 startPosition, |
| 680 endPosition - startPosition); | 681 endPosition - startPosition); |
| 682 if (_failed) { |
| 683 printDebug("Failed because command.expectedOutputFile doesn't " |
| 684 "match stdout of DRT"); |
| 685 } |
| 686 return _failed; |
| 681 } | 687 } |
| 682 } | 688 } |
| 689 printDebug("Failed because we didn't find 'Content-Length' in the DRT " |
| 690 "output"); |
| 683 return true; | 691 return true; |
| 684 } else { | 692 } else { |
| 685 return !areByteArraysEqual(expectedContent, 0, | 693 var _failed = !areByteArraysEqual(expectedContent, 0, |
| 686 stdout, 0, | 694 stdout, 0, |
| 687 stdout.length); | 695 stdout.length); |
| 696 if (_failed) { |
| 697 printDebug("Failed because command.expectedOutputFile doesn't match " |
| 698 "stdout of DRT"); |
| 699 } |
| 700 return _failed; |
| 688 } | 701 } |
| 689 } | 702 } |
| 703 printDebug("Failed because command.expectedOutputFile doesn't exist"); |
| 690 return true; | 704 return true; |
| 691 } | 705 } |
| 692 | 706 |
| 693 bool get _browserTestFailure { | 707 bool get _browserTestFailure { |
| 694 // Browser tests fail unless stdout contains | 708 // Browser tests fail unless stdout contains |
| 695 // 'Content-Type: text/plain' followed by 'PASS'. | 709 // 'Content-Type: text/plain' followed by 'PASS'. |
| 696 bool has_content_type = false; | 710 bool has_content_type = false; |
| 697 var stdoutLines = new String.fromCharCodes(super.stdout).split("\n"); | 711 var stdoutLines = new String.fromCharCodes(super.stdout).split("\n"); |
| 698 for (String line in stdoutLines) { | 712 for (String line in stdoutLines) { |
| 699 switch (line) { | 713 switch (line) { |
| 700 case 'Content-Type: text/plain': | 714 case 'Content-Type: text/plain': |
| 701 has_content_type = true; | 715 has_content_type = true; |
| 702 break; | 716 break; |
| 703 case 'PASS': | 717 case 'PASS': |
| 704 if (has_content_type) { | 718 if (has_content_type) { |
| 705 return (exitCode != 0 && !hasCrashed); | 719 var _failed = (exitCode != 0 && !hasCrashed); |
| 720 if (_failed) { |
| 721 printDebug("Failed because '(exitCode != 0 && !hasCrashed) was " |
| 722 "true"); |
| 723 } |
| 724 return _failed; |
| 706 } | 725 } |
| 707 break; | 726 break; |
| 708 } | 727 } |
| 709 } | 728 } |
| 729 printDebug("Failed because content-type: text/plain + PASS was not found"); |
| 710 return true; | 730 return true; |
| 711 } | 731 } |
| 732 |
| 733 void printDebug(String msg) { |
| 734 print(""); |
| 735 print("DEBUG(infrastructure): $msg"); |
| 736 print("DEBUG(infrastructure): cmd.executable: '${command.executable}'"); |
| 737 print("DEBUG(infrastructure): cmd.arguments: '${command.arguments}'"); |
| 738 print("DEBUG(infrastructure): cmd.environment: '${command.environment}'"); |
| 739 print(""); |
| 740 } |
| 712 } | 741 } |
| 713 | 742 |
| 714 // The static analyzer does not actually execute code, so | 743 // The static analyzer does not actually execute code, so |
| 715 // the criteria for success now depend on the text sent | 744 // the criteria for success now depend on the text sent |
| 716 // to stderr. | 745 // to stderr. |
| 717 class AnalysisCommandOutputImpl extends CommandOutputImpl { | 746 class AnalysisCommandOutputImpl extends CommandOutputImpl { |
| 718 // An error line has 8 fields that look like: | 747 // An error line has 8 fields that look like: |
| 719 // ERROR|COMPILER|MISSING_SOURCE|file:/tmp/t.dart|15|1|24|Missing source. | 748 // ERROR|COMPILER|MISSING_SOURCE|file:/tmp/t.dart|15|1|24|Missing source. |
| 720 final int ERROR_LEVEL = 0; | 749 final int ERROR_LEVEL = 0; |
| 721 final int ERROR_TYPE = 1; | 750 final int ERROR_TYPE = 1; |
| (...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1725 // the developer doesn't waste his or her time trying to fix a bunch of | 1754 // the developer doesn't waste his or her time trying to fix a bunch of |
| 1726 // tests that appear to be broken but were actually just flakes that | 1755 // tests that appear to be broken but were actually just flakes that |
| 1727 // didn't get retried because there had already been one failure. | 1756 // didn't get retried because there had already been one failure. |
| 1728 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; | 1757 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; |
| 1729 new RunningProcess(test, allowRetry, this).start(); | 1758 new RunningProcess(test, allowRetry, this).start(); |
| 1730 } | 1759 } |
| 1731 _numProcesses++; | 1760 _numProcesses++; |
| 1732 } | 1761 } |
| 1733 } | 1762 } |
| 1734 } | 1763 } |
| OLD | NEW |