Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py

Issue 2759263002: Add image-first-tests flag to run-webkit-tests (Closed)
Patch Set: Only run compare_txt_fn if !is_testharness_test Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 = test_input.should_run_pixel_test_fir st
73 self._reference_files = test_input.reference_files 74 self._reference_files = test_input.reference_files
74 self._should_add_missing_baselines = test_input.should_add_missing_basel ines 75 self._should_add_missing_baselines = test_input.should_add_missing_basel ines
75 self._stop_when_done = stop_when_done 76 self._stop_when_done = stop_when_done
76 77
77 # If this is a virtual test that uses the default flags instead of the 78 # 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 79 # virtual flags for it's references, run it on the secondary driver so
79 # that the primary driver does not need to be restarted. 80 # that the primary driver does not need to be restarted.
80 if (secondary_driver and 81 if (secondary_driver and
81 self._port.is_virtual_test(self._test_name) and 82 self._port.is_virtual_test(self._test_name) and
82 not self._port.lookup_virtual_reference_args(self._test_name)): 83 not self._port.lookup_virtual_reference_args(self._test_name)):
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 277
277 if driver_output.crash: 278 if driver_output.crash:
278 # Don't continue any more if we already have a crash. 279 # 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. 280 # 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(), 281 return TestResult(self._test_name, failures, driver_output.test_time , driver_output.has_stderr(),
281 pid=driver_output.pid) 282 pid=driver_output.pid)
282 283
283 is_testharness_test, testharness_failures = self._compare_testharness_te st(driver_output, expected_driver_output) 284 is_testharness_test, testharness_failures = self._compare_testharness_te st(driver_output, expected_driver_output)
284 if is_testharness_test: 285 if is_testharness_test:
285 failures.extend(testharness_failures) 286 failures.extend(testharness_failures)
287
288 compare_functions = []
289 compare_image_fn = (self._compare_image, (expected_driver_output, driver _output))
290 compare_txt_fn = (self._compare_text, (expected_driver_output.text, driv er_output.text))
291 compare_audio_fn = (self._compare_audio, (expected_driver_output.audio, driver_output.audio))
292
293 if self._should_run_pixel_test_first:
294 if driver_output.image_hash and self._should_run_pixel_test:
295 compare_functions.append(compare_image_fn)
296 elif not is_testharness_test:
297 compare_functions.append(compare_txt_fn)
286 else: 298 else:
287 failures.extend(self._compare_text(expected_driver_output.text, driv er_output.text)) 299 if not is_testharness_test:
288 failures.extend(self._compare_audio(expected_driver_output.audio, driver _output.audio)) 300 compare_functions.append(compare_txt_fn)
289 if self._should_run_pixel_test: 301 if self._should_run_pixel_test:
290 failures.extend(self._compare_image(expected_driver_output, driver_o utput)) 302 compare_functions.append(compare_image_fn)
303 compare_functions.append(compare_audio_fn)
304
305 for func, args in compare_functions:
306 failures.extend(func(*args))
307
291 has_repaint_overlay = (repaint_overlay.result_contains_repaint_rects(exp ected_driver_output.text) or 308 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)) 309 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(), 310 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) 311 pid=driver_output.pid, has_repaint_overlay=has_repaint _overlay)
295 312
296 def _compare_testharness_test(self, driver_output, expected_driver_output): 313 def _compare_testharness_test(self, driver_output, expected_driver_output):
297 if expected_driver_output.text: 314 if expected_driver_output.text:
298 return False, [] 315 return False, []
299 316
300 if self._is_render_tree(driver_output.text): 317 if self._is_render_tree(driver_output.text):
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 elif reference_driver_output.image_hash != actual_driver_output.image_ha sh: 466 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) 467 diff, err_str = self._port.diff_image(reference_driver_output.image, actual_driver_output.image)
451 if diff: 468 if diff:
452 failures.append(test_failures.FailureReftestMismatch(reference_f ilename)) 469 failures.append(test_failures.FailureReftestMismatch(reference_f ilename))
453 elif err_str: 470 elif err_str:
454 _log.error(err_str) 471 _log.error(err_str)
455 else: 472 else:
456 _log.warning(" %s -> ref test hashes didn't match but diff pass ed", self._test_name) 473 _log.warning(" %s -> ref test hashes didn't match but diff pass ed", self._test_name)
457 474
458 return TestResult(self._test_name, failures, 0, has_stderr, pid=actual_d river_output.pid) 475 return TestResult(self._test_name, failures, 0, has_stderr, pid=actual_d river_output.pid)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698