Chromium Code Reviews| 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 self._port = port | 63 self._port = port |
| 64 self._filesystem = port.host.filesystem | 64 self._filesystem = port.host.filesystem |
| 65 self._options = options | 65 self._options = options |
| 66 self._results_directory = results_directory | 66 self._results_directory = results_directory |
| 67 self._driver = primary_driver | 67 self._driver = primary_driver |
| 68 self._reference_driver = primary_driver | 68 self._reference_driver = primary_driver |
| 69 self._timeout_ms = test_input.timeout_ms | 69 self._timeout_ms = test_input.timeout_ms |
| 70 self._worker_name = worker_name | 70 self._worker_name = worker_name |
| 71 self._test_name = test_input.test_name | 71 self._test_name = test_input.test_name |
| 72 self._should_run_pixel_test = test_input.should_run_pixel_test | 72 self._should_run_pixel_test = test_input.should_run_pixel_test |
| 73 self._should_run_pixel_test_first = ( | |
| 74 test_input.should_run_pixel_test_first) | |
| 73 self._reference_files = test_input.reference_files | 75 self._reference_files = test_input.reference_files |
| 74 self._should_add_missing_baselines = test_input.should_add_missing_basel ines | 76 self._should_add_missing_baselines = test_input.should_add_missing_basel ines |
| 75 self._stop_when_done = stop_when_done | 77 self._stop_when_done = stop_when_done |
| 76 | 78 |
| 77 # If this is a virtual test that uses the default flags instead of the | 79 # If this is a virtual test that uses the default flags instead of the |
| 78 # virtual flags for it's references, run it on the secondary driver so | 80 # virtual flags for it's references, run it on the secondary driver so |
| 79 # that the primary driver does not need to be restarted. | 81 # that the primary driver does not need to be restarted. |
| 80 if (secondary_driver and | 82 if (secondary_driver and |
| 81 self._port.is_virtual_test(self._test_name) and | 83 self._port.is_virtual_test(self._test_name) and |
| 82 not self._port.lookup_virtual_reference_args(self._test_name)): | 84 not self._port.lookup_virtual_reference_args(self._test_name)): |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 | 278 |
| 277 if driver_output.crash: | 279 if driver_output.crash: |
| 278 # Don't continue any more if we already have a crash. | 280 # Don't continue any more if we already have a crash. |
| 279 # In case of timeouts, we continue since we still want to see the te xt and image output. | 281 # In case of timeouts, we continue since we still want to see the te xt and image output. |
| 280 return TestResult(self._test_name, failures, driver_output.test_time , driver_output.has_stderr(), | 282 return TestResult(self._test_name, failures, driver_output.test_time , driver_output.has_stderr(), |
| 281 pid=driver_output.pid) | 283 pid=driver_output.pid) |
| 282 | 284 |
| 283 is_testharness_test, testharness_failures = self._compare_testharness_te st(driver_output, expected_driver_output) | 285 is_testharness_test, testharness_failures = self._compare_testharness_te st(driver_output, expected_driver_output) |
| 284 if is_testharness_test: | 286 if is_testharness_test: |
| 285 failures.extend(testharness_failures) | 287 failures.extend(testharness_failures) |
| 288 | |
| 289 compare_functions = [] | |
| 290 compare_image_fn = (self._compare_image, ( | |
| 291 expected_driver_output, driver_output)) | |
| 292 compare_txt_fn = (self._compare_text, ( | |
| 293 expected_driver_output.text, driver_output.text)) | |
| 294 compare_audio_fn = (self._compare_audio, ( | |
| 295 expected_driver_output.audio, driver_output.audio)) | |
|
qyearsley
2017/03/21 22:44:09
Formatting note: Technically, the line length limi
| |
| 296 | |
| 297 if self._should_run_pixel_test_first: | |
| 298 if driver_output.image_hash: | |
| 299 compare_functions.append(compare_image_fn) | |
| 300 else: | |
| 301 compare_functions.append(compare_txt_fn) | |
| 286 else: | 302 else: |
| 287 failures.extend(self._compare_text(expected_driver_output.text, driv er_output.text)) | 303 compare_functions.append(compare_txt_fn) |
| 288 failures.extend(self._compare_audio(expected_driver_output.audio, driver _output.audio)) | 304 if self._should_run_pixel_test: |
| 289 if self._should_run_pixel_test: | 305 compare_functions.append(compare_image_fn) |
| 290 failures.extend(self._compare_image(expected_driver_output, driver_o utput)) | 306 compare_functions.append(compare_audio_fn) |
| 307 | |
| 308 for func, args in compare_functions: | |
| 309 failures.extend(func(*args)) | |
| 310 | |
| 291 has_repaint_overlay = (repaint_overlay.result_contains_repaint_rects(exp ected_driver_output.text) or | 311 has_repaint_overlay = (repaint_overlay.result_contains_repaint_rects(exp ected_driver_output.text) or |
| 292 repaint_overlay.result_contains_repaint_rects(dri ver_output.text)) | 312 repaint_overlay.result_contains_repaint_rects(dri ver_output.text)) |
| 293 return TestResult(self._test_name, failures, driver_output.test_time, dr iver_output.has_stderr(), | 313 return TestResult(self._test_name, failures, driver_output.test_time, dr iver_output.has_stderr(), |
| 294 pid=driver_output.pid, has_repaint_overlay=has_repaint _overlay) | 314 pid=driver_output.pid, has_repaint_overlay=has_repaint _overlay) |
| 295 | 315 |
| 296 def _compare_testharness_test(self, driver_output, expected_driver_output): | 316 def _compare_testharness_test(self, driver_output, expected_driver_output): |
| 297 if expected_driver_output.text: | 317 if expected_driver_output.text: |
| 298 return False, [] | 318 return False, [] |
| 299 | 319 |
| 300 if self._is_render_tree(driver_output.text): | 320 if self._is_render_tree(driver_output.text): |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 449 elif reference_driver_output.image_hash != actual_driver_output.image_ha sh: | 469 elif reference_driver_output.image_hash != actual_driver_output.image_ha sh: |
| 450 diff, err_str = self._port.diff_image(reference_driver_output.image, actual_driver_output.image) | 470 diff, err_str = self._port.diff_image(reference_driver_output.image, actual_driver_output.image) |
| 451 if diff: | 471 if diff: |
| 452 failures.append(test_failures.FailureReftestMismatch(reference_f ilename)) | 472 failures.append(test_failures.FailureReftestMismatch(reference_f ilename)) |
| 453 elif err_str: | 473 elif err_str: |
| 454 _log.error(err_str) | 474 _log.error(err_str) |
| 455 else: | 475 else: |
| 456 _log.warning(" %s -> ref test hashes didn't match but diff pass ed", self._test_name) | 476 _log.warning(" %s -> ref test hashes didn't match but diff pass ed", self._test_name) |
| 457 | 477 |
| 458 return TestResult(self._test_name, failures, 0, has_stderr, pid=actual_d river_output.pid) | 478 return TestResult(self._test_name, failures, 0, has_stderr, pid=actual_d river_output.pid) |
| OLD | NEW |