| OLD | NEW |
| 1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 writer.write_image_files(driver_output.image, expected_driver_output
.image) | 63 writer.write_image_files(driver_output.image, expected_driver_output
.image) |
| 64 writer.write_image_diff_files(driver_output.image_diff) | 64 writer.write_image_diff_files(driver_output.image_diff) |
| 65 elif isinstance(failure, (test_failures.FailureAudioMismatch, | 65 elif isinstance(failure, (test_failures.FailureAudioMismatch, |
| 66 test_failures.FailureMissingAudio)): | 66 test_failures.FailureMissingAudio)): |
| 67 writer.write_audio_files(driver_output.audio, expected_driver_output
.audio) | 67 writer.write_audio_files(driver_output.audio, expected_driver_output
.audio) |
| 68 elif isinstance(failure, test_failures.FailureCrash): | 68 elif isinstance(failure, test_failures.FailureCrash): |
| 69 crashed_driver_output = expected_driver_output if failure.is_reftest
else driver_output | 69 crashed_driver_output = expected_driver_output if failure.is_reftest
else driver_output |
| 70 writer.write_crash_log(crashed_driver_output.crash_log) | 70 writer.write_crash_log(crashed_driver_output.crash_log) |
| 71 elif isinstance(failure, test_failures.FailureLeak): | 71 elif isinstance(failure, test_failures.FailureLeak): |
| 72 writer.write_leak_log(driver_output.leak_log) | 72 writer.write_leak_log(driver_output.leak_log) |
| 73 elif isinstance(failure, test_failures.FailureReftestMismatch): | 73 elif isinstance(failure, ( |
| 74 test_failures.FailureReftestMismatch, |
| 75 test_failures.FailureReftestNoImageGenerated, |
| 76 test_failures.FailureReftestNoReferenceImageGenerated)): |
| 74 writer.write_image_files(driver_output.image, expected_driver_output
.image) | 77 writer.write_image_files(driver_output.image, expected_driver_output
.image) |
| 75 # FIXME: This work should be done earlier in the pipeline (e.g., whe
n we compare images for non-ref tests). | |
| 76 # FIXME: We should always have 2 images here. | |
| 77 if driver_output.image and expected_driver_output.image: | 78 if driver_output.image and expected_driver_output.image: |
| 78 diff_image, _ = port.diff_image(expected_driver_output.image, dr
iver_output.image) | 79 diff_image, _ = port.diff_image(expected_driver_output.image, dr
iver_output.image) |
| 79 if diff_image: | 80 if diff_image: |
| 80 writer.write_image_diff_files(diff_image) | 81 writer.write_image_diff_files(diff_image) |
| 81 else: | 82 else: |
| 82 _log.warning('ref test mismatch did not produce an image dif
f.') | 83 _log.warning('ref test mismatch did not produce an image dif
f.') |
| 83 writer.write_image_files(driver_output.image, expected_image=None) | |
| 84 if filesystem.exists(failure.reference_filename): | 84 if filesystem.exists(failure.reference_filename): |
| 85 writer.write_reftest(failure.reference_filename) | 85 writer.write_reftest(failure.reference_filename) |
| 86 else: | 86 else: |
| 87 _log.warning("reference %s was not found", failure.reference_fil
ename) | 87 _log.warning("reference %s was not found", failure.reference_fil
ename) |
| 88 elif isinstance(failure, test_failures.FailureReftestMismatchDidNotOccur
): | 88 elif isinstance(failure, test_failures.FailureReftestMismatchDidNotOccur
): |
| 89 writer.write_image_files(driver_output.image, expected_image=None) | 89 writer.write_image_files(driver_output.image, expected_image=None) |
| 90 if filesystem.exists(failure.reference_filename): | 90 if filesystem.exists(failure.reference_filename): |
| 91 writer.write_reftest(failure.reference_filename) | 91 writer.write_reftest(failure.reference_filename) |
| 92 else: | 92 else: |
| 93 _log.warning("reference %s was not found", failure.reference_fil
ename) | 93 _log.warning("reference %s was not found", failure.reference_fil
ename) |
| 94 else: | 94 else: |
| 95 assert isinstance(failure, (test_failures.FailureTimeout, test_failu
res.FailureReftestNoImagesGenerated)) | 95 assert isinstance(failure, test_failures.FailureTimeout) |
| 96 | 96 |
| 97 if expected_driver_output is not None: | 97 if expected_driver_output is not None: |
| 98 writer.create_repaint_overlay_result(driver_output.text, expected_dr
iver_output.text) | 98 writer.create_repaint_overlay_result(driver_output.text, expected_dr
iver_output.text) |
| 99 | 99 |
| 100 | 100 |
| 101 def baseline_name(filesystem, test_name, suffix): | 101 def baseline_name(filesystem, test_name, suffix): |
| 102 base = filesystem.splitext(test_name)[0] | 102 base = filesystem.splitext(test_name)[0] |
| 103 return '%s%s.%s' % (base, TestResultWriter.FILENAME_SUFFIX_EXPECTED, suffix) | 103 return '%s%s.%s' % (base, TestResultWriter.FILENAME_SUFFIX_EXPECTED, suffix) |
| 104 | 104 |
| 105 | 105 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 'diff_filename': self._output_testname(self.FILENAME_SUFFIX_IMAGE_DI
FF), | 283 'diff_filename': self._output_testname(self.FILENAME_SUFFIX_IMAGE_DI
FF), |
| 284 'prefix': self._output_testname(''), | 284 'prefix': self._output_testname(''), |
| 285 } | 285 } |
| 286 self._write_file(diffs_html_filename, html) | 286 self._write_file(diffs_html_filename, html) |
| 287 | 287 |
| 288 def write_reftest(self, src_filepath): | 288 def write_reftest(self, src_filepath): |
| 289 fs = self._filesystem | 289 fs = self._filesystem |
| 290 dst_dir = fs.dirname(fs.join(self._root_output_dir, self._test_name)) | 290 dst_dir = fs.dirname(fs.join(self._root_output_dir, self._test_name)) |
| 291 dst_filepath = fs.join(dst_dir, fs.basename(src_filepath)) | 291 dst_filepath = fs.join(dst_dir, fs.basename(src_filepath)) |
| 292 self._write_file(dst_filepath, fs.read_binary_file(src_filepath)) | 292 self._write_file(dst_filepath, fs.read_binary_file(src_filepath)) |
| OLD | NEW |