| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 300 |
| 301 def _compare_audio(self, expected_audio, actual_audio): | 301 def _compare_audio(self, expected_audio, actual_audio): |
| 302 failures = [] | 302 failures = [] |
| 303 if (expected_audio and actual_audio and | 303 if (expected_audio and actual_audio and |
| 304 self._port.do_audio_results_differ(expected_audio, actual_audio)): | 304 self._port.do_audio_results_differ(expected_audio, actual_audio)): |
| 305 failures.append(test_failures.FailureAudioMismatch()) | 305 failures.append(test_failures.FailureAudioMismatch()) |
| 306 elif actual_audio and not expected_audio: | 306 elif actual_audio and not expected_audio: |
| 307 failures.append(test_failures.FailureMissingAudio()) | 307 failures.append(test_failures.FailureMissingAudio()) |
| 308 return failures | 308 return failures |
| 309 | 309 |
| 310 # FIXME: This won't be needed once we have flags for Sky that suppress the |
| 311 # Observatory messages. |
| 312 _filter_observatory_messages = re.compile(r"^CONSOLE: Observatory listening
on.*\n", re.MULTILINE) |
| 313 |
| 310 def _get_normalized_output_text(self, output): | 314 def _get_normalized_output_text(self, output): |
| 311 """Returns the normalized text output, i.e. the output in which | 315 """Returns the normalized text output, i.e. the output in which |
| 312 the end-of-line characters are normalized to "\n".""" | 316 the end-of-line characters are normalized to "\n".""" |
| 313 # Running tests on Windows produces "\r\n". The "\n" part is helpfully | 317 # Running tests on Windows produces "\r\n". The "\n" part is helpfully |
| 314 # changed to "\r\n" by our system (Python/Cygwin), resulting in | 318 # changed to "\r\n" by our system (Python/Cygwin), resulting in |
| 315 # "\r\r\n", when, in fact, we wanted to compare the text output with | 319 # "\r\r\n", when, in fact, we wanted to compare the text output with |
| 316 # the normalized text expectation files. | 320 # the normalized text expectation files. |
| 317 return output.replace("\r\r\n", "\r\n").replace("\r\n", "\n") | 321 normalized_lines = output.replace("\r\r\n", "\r\n").replace("\r\n", "\n"
) |
| 322 normalized_lines = re.sub(self._filter_observatory_messages, r"", normal
ized_lines) |
| 323 return normalized_lines |
| 318 | 324 |
| 319 # FIXME: This function also creates the image diff. Maybe that work should | 325 # FIXME: This function also creates the image diff. Maybe that work should |
| 320 # be handled elsewhere? | 326 # be handled elsewhere? |
| 321 def _compare_image(self, expected_driver_output, driver_output): | 327 def _compare_image(self, expected_driver_output, driver_output): |
| 322 failures = [] | 328 failures = [] |
| 323 # If we didn't produce a hash file, this test must be text-only. | 329 # If we didn't produce a hash file, this test must be text-only. |
| 324 if driver_output.image_hash is None: | 330 if driver_output.image_hash is None: |
| 325 return failures | 331 return failures |
| 326 if not expected_driver_output.image: | 332 if not expected_driver_output.image: |
| 327 failures.append(test_failures.FailureMissingImage()) | 333 failures.append(test_failures.FailureMissingImage()) |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 _log.error(err_str) | 415 _log.error(err_str) |
| 410 | 416 |
| 411 else: | 417 else: |
| 412 diff, err_str = self._port.diff_image(reference_driver_output.image,
actual_driver_output.image) | 418 diff, err_str = self._port.diff_image(reference_driver_output.image,
actual_driver_output.image) |
| 413 if diff: | 419 if diff: |
| 414 failures.append(test_failures.FailureReftestMismatch(reference_f
ilename)) | 420 failures.append(test_failures.FailureReftestMismatch(reference_f
ilename)) |
| 415 elif err_str: | 421 elif err_str: |
| 416 _log.error(err_str) | 422 _log.error(err_str) |
| 417 | 423 |
| 418 return TestResult(self._test_name, failures, total_test_time, has_stderr
, pid=actual_driver_output.pid) | 424 return TestResult(self._test_name, failures, total_test_time, has_stderr
, pid=actual_driver_output.pid) |
| OLD | NEW |