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