| OLD | NEW |
| 1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """A helper class for comparing the failures and crashes between layout test | 5 """A helper class for comparing the failures and crashes between layout test |
| 6 runs. The results from the last test run are stored in expected-failures.txt | 6 runs. The results from the last test run are stored in expected-failures.txt |
| 7 and expected-crashes.txt in the layout test results directory.""" | 7 and expected-crashes.txt in the layout test results directory.""" |
| 8 | 8 |
| 9 import errno | 9 import errno |
| 10 import os | 10 import os |
| 11 | 11 |
| 12 import path_utils | 12 import path_utils |
| 13 import test_failures | 13 import test_failures |
| 14 import test_expectations | 14 import test_expectations |
| 15 | 15 |
| 16 | 16 |
| 17 def PrintFilesFromSet(filenames, header_text, output, opt_expectations=None): | 17 def PrintFilesFromSet(filenames, header_text, output, opt_expectations=None, |
| 18 opt_relativizeFilenames=True): |
| 18 """A helper method to print a list of files to output. | 19 """A helper method to print a list of files to output. |
| 19 | 20 |
| 20 Args: | 21 Args: |
| 21 filenames: a list of absolute filenames | 22 filenames: a list of absolute filenames |
| 22 header_text: a string to display before the list of filenames | 23 header_text: a string to display before the list of filenames |
| 23 output: file descriptor to write the results to. | 24 output: file descriptor to write the results to. |
| 24 opt_expectations: expecations that failed for this test | 25 opt_expectations: expecations that failed for this test |
| 25 """ | 26 """ |
| 26 if not len(filenames): | 27 if not len(filenames): |
| 27 return | 28 return |
| 28 | 29 |
| 29 filenames = list(filenames) | 30 filenames = list(filenames) |
| 30 filenames.sort() | 31 filenames.sort() |
| 31 output.write("\n") | 32 output.write("\n") |
| 32 output.write("%s (%d):\n" % (header_text, len(filenames))) | 33 output.write("%s (%d):\n" % (header_text, len(filenames))) |
| 33 output_string = " %s" | 34 output_string = " %s" |
| 34 if opt_expectations: | 35 if opt_expectations: |
| 35 output_string += " = %s" % opt_expectations | 36 output_string += " = %s" % opt_expectations |
| 36 output_string += "\n" | 37 output_string += "\n" |
| 37 for filename in filenames: | 38 for filename in filenames: |
| 38 output.write(output_string % path_utils.RelativeTestFilename(filename)) | 39 if opt_relativizeFilenames: |
| 40 filename = path_utils.RelativeTestFilename(filename) |
| 41 output.write(output_string % filename) |
| 39 | 42 |
| 40 | 43 |
| 41 | 44 |
| 42 class CompareFailures: | 45 class CompareFailures: |
| 43 # A list of which TestFailure classes count as a failure vs a crash. | 46 # A list of which TestFailure classes count as a failure vs a crash. |
| 44 FAILURE_TYPES = (test_failures.FailureTextMismatch, | 47 FAILURE_TYPES = (test_failures.FailureTextMismatch, |
| 45 test_failures.FailureImageHashMismatch) | 48 test_failures.FailureImageHashMismatch) |
| 46 CRASH_TYPES = (test_failures.FailureCrash,) | 49 CRASH_TYPES = (test_failures.FailureCrash,) |
| 47 HANG_TYPES = (test_failures.FailureTimeout,) | 50 HANG_TYPES = (test_failures.FailureTimeout,) |
| 48 MISSING_TYPES = (test_failures.FailureMissingResult, | 51 MISSING_TYPES = (test_failures.FailureMissingResult, |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 158 |
| 156 | 159 |
| 157 def GetRegressions(self): | 160 def GetRegressions(self): |
| 158 """Returns a set of regressions from the test expectations. This is | 161 """Returns a set of regressions from the test expectations. This is |
| 159 used to determine which tests to list in results.html and the | 162 used to determine which tests to list in results.html and the |
| 160 right script exit code for the build bots. The list does not | 163 right script exit code for the build bots. The list does not |
| 161 include the unexpected passes.""" | 164 include the unexpected passes.""" |
| 162 return (self._regressed_failures | self._regressed_hangs | | 165 return (self._regressed_failures | self._regressed_hangs | |
| 163 self._regressed_crashes | self._missing) | 166 self._regressed_crashes | self._missing) |
| 164 | 167 |
| OLD | NEW |