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