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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 | 316 |
317 def _compare_audio(self, expected_audio, actual_audio): | 317 def _compare_audio(self, expected_audio, actual_audio): |
318 failures = [] | 318 failures = [] |
319 if (expected_audio and actual_audio and | 319 if (expected_audio and actual_audio and |
320 self._port.do_audio_results_differ(expected_audio, actual_audio)): | 320 self._port.do_audio_results_differ(expected_audio, actual_audio)): |
321 failures.append(test_failures.FailureAudioMismatch()) | 321 failures.append(test_failures.FailureAudioMismatch()) |
322 elif actual_audio and not expected_audio: | 322 elif actual_audio and not expected_audio: |
323 failures.append(test_failures.FailureMissingAudio()) | 323 failures.append(test_failures.FailureMissingAudio()) |
324 return failures | 324 return failures |
325 | 325 |
| 326 _observatory_cleaner = re.compile(r"^Observatory.*\n", re.MULTILINE) |
| 327 _console_observatory_cleaner = re.compile(r"^CONSOLE INFO: Observatory.*\n",
re.MULTILINE) |
| 328 |
326 def _get_normalized_output_text(self, output): | 329 def _get_normalized_output_text(self, output): |
327 """Returns the normalized text output, i.e. the output in which | 330 """Returns the normalized text output, i.e. the output in which |
328 the end-of-line characters are normalized to "\n".""" | 331 the end-of-line characters are normalized to "\n".""" |
329 # Running tests on Windows produces "\r\n". The "\n" part is helpfully | 332 # Running tests on Windows produces "\r\n". The "\n" part is helpfully |
330 # changed to "\r\n" by our system (Python/Cygwin), resulting in | 333 # changed to "\r\n" by our system (Python/Cygwin), resulting in |
331 # "\r\r\n", when, in fact, we wanted to compare the text output with | 334 # "\r\r\n", when, in fact, we wanted to compare the text output with |
332 # the normalized text expectation files. | 335 # the normalized text expectation files. |
333 return output.replace("\r\r\n", "\r\n").replace("\r\n", "\n") | 336 normalized_lines = output.replace("\r\r\n", "\r\n").replace("\r\n", "\n"
) |
| 337 normalized_lines = re.sub(self._observatory_cleaner, r"", normalized_lin
es) |
| 338 normalized_lines = re.sub(self._console_observatory_cleaner, r"", normal
ized_lines) |
| 339 return normalized_lines |
334 | 340 |
335 # FIXME: This function also creates the image diff. Maybe that work should | 341 # FIXME: This function also creates the image diff. Maybe that work should |
336 # be handled elsewhere? | 342 # be handled elsewhere? |
337 def _compare_image(self, expected_driver_output, driver_output): | 343 def _compare_image(self, expected_driver_output, driver_output): |
338 failures = [] | 344 failures = [] |
339 # If we didn't produce a hash file, this test must be text-only. | 345 # If we didn't produce a hash file, this test must be text-only. |
340 if driver_output.image_hash is None: | 346 if driver_output.image_hash is None: |
341 return failures | 347 return failures |
342 if not expected_driver_output.image: | 348 if not expected_driver_output.image: |
343 failures.append(test_failures.FailureMissingImage()) | 349 failures.append(test_failures.FailureMissingImage()) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 elif reference_driver_output.image_hash != actual_driver_output.image_ha
sh: | 436 elif reference_driver_output.image_hash != actual_driver_output.image_ha
sh: |
431 diff, err_str = self._port.diff_image(reference_driver_output.image,
actual_driver_output.image) | 437 diff, err_str = self._port.diff_image(reference_driver_output.image,
actual_driver_output.image) |
432 if diff: | 438 if diff: |
433 failures.append(test_failures.FailureReftestMismatch(reference_f
ilename)) | 439 failures.append(test_failures.FailureReftestMismatch(reference_f
ilename)) |
434 elif err_str: | 440 elif err_str: |
435 _log.error(err_str) | 441 _log.error(err_str) |
436 else: | 442 else: |
437 _log.warning(" %s -> ref test hashes didn't match but diff pass
ed" % self._test_name) | 443 _log.warning(" %s -> ref test hashes didn't match but diff pass
ed" % self._test_name) |
438 | 444 |
439 return TestResult(self._test_name, failures, total_test_time, has_stderr
, pid=actual_driver_output.pid) | 445 return TestResult(self._test_name, failures, total_test_time, has_stderr
, pid=actual_driver_output.pid) |
OLD | NEW |