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

Side by Side Diff: sky/tools/webkitpy/layout_tests/controllers/single_test_runner.py

Issue 802573002: Prepare python code for reftests. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 self._timeout = test_input.timeout 64 self._timeout = test_input.timeout
65 self._worker_name = worker_name 65 self._worker_name = worker_name
66 self._test_name = test_input.test_name 66 self._test_name = test_input.test_name
67 self._should_run_pixel_test = test_input.should_run_pixel_test 67 self._should_run_pixel_test = test_input.should_run_pixel_test
68 self._reference_files = test_input.reference_files 68 self._reference_files = test_input.reference_files
69 self._should_add_missing_baselines = test_input.should_add_missing_basel ines 69 self._should_add_missing_baselines = test_input.should_add_missing_basel ines
70 self._stop_when_done = stop_when_done 70 self._stop_when_done = stop_when_done
71 71
72 if self._reference_files: 72 if self._reference_files:
73 # Detect and report a test which has a wrong combination of expectat ion files. 73 # Detect and report a test which has a wrong combination of expectat ion files.
74 # For example, if 'foo.html' has two expectation files, 'foo-expecte d.html' and 74 # For example, if 'foo.html' has two expectation files, 'foo-expecte d.sky' and
75 # 'foo-expected.txt', we should warn users. One test file must be us ed exclusively 75 # 'foo-expected.txt', we should warn users. One test file must be us ed exclusively
76 # in either layout tests or reftests, but not in both. 76 # in either layout tests or reftests, but not in both.
77 for suffix in ('.txt', '.png', '.wav'): 77 for suffix in ('.txt', '.png', '.wav'):
78 expected_filename = self._port.expected_filename(self._test_name , suffix) 78 expected_filename = self._port.expected_filename(self._test_name , suffix)
79 if self._filesystem.exists(expected_filename): 79 if self._filesystem.exists(expected_filename):
80 _log.error('%s is a reftest, but has an unused expectation f ile. Please remove %s.', 80 _log.error('%s is a reftest, but has an unused expectation f ile. Please remove %s.',
81 self._test_name, expected_filename) 81 self._test_name, expected_filename)
82 82
83 def _expected_driver_output(self): 83 def _expected_driver_output(self):
84 return DriverOutput(self._port.expected_text(self._test_name), 84 return DriverOutput(self._port.expected_text(self._test_name),
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 if failures: 395 if failures:
396 # Don't continue any more if we already have crash or timeout. 396 # Don't continue any more if we already have crash or timeout.
397 return TestResult(self._test_name, failures, total_test_time, has_st derr) 397 return TestResult(self._test_name, failures, total_test_time, has_st derr)
398 failures.extend(self._handle_error(reference_driver_output, reference_fi lename=reference_filename)) 398 failures.extend(self._handle_error(reference_driver_output, reference_fi lename=reference_filename))
399 if failures: 399 if failures:
400 return TestResult(self._test_name, failures, total_test_time, has_st derr, pid=actual_driver_output.pid) 400 return TestResult(self._test_name, failures, total_test_time, has_st derr, pid=actual_driver_output.pid)
401 401
402 if not reference_driver_output.image_hash and not actual_driver_output.i mage_hash: 402 if not reference_driver_output.image_hash and not actual_driver_output.i mage_hash:
403 failures.append(test_failures.FailureReftestNoImagesGenerated(refere nce_filename)) 403 failures.append(test_failures.FailureReftestNoImagesGenerated(refere nce_filename))
404 elif mismatch: 404 elif mismatch:
405 if reference_driver_output.image_hash == actual_driver_output.image_ hash: 405 diff, err_str = self._port.diff_image(reference_driver_output.image, actual_driver_output.image)
406 diff, err_str = self._port.diff_image(reference_driver_output.im age, actual_driver_output.image) 406 if not diff:
407 if not diff: 407 failures.append(test_failures.FailureReftestMismatchDidNotOccur( reference_filename))
408 failures.append(test_failures.FailureReftestMismatchDidNotOc cur(reference_filename)) 408 elif err_str:
409 elif err_str: 409 _log.error(err_str)
410 _log.error(err_str)
411 else:
412 _log.warning(" %s -> ref test hashes matched but diff faile d" % self._test_name)
413 410
414 elif reference_driver_output.image_hash != actual_driver_output.image_ha sh: 411 else:
415 diff, err_str = self._port.diff_image(reference_driver_output.image, actual_driver_output.image) 412 diff, err_str = self._port.diff_image(reference_driver_output.image, actual_driver_output.image)
416 if diff: 413 if diff:
417 failures.append(test_failures.FailureReftestMismatch(reference_f ilename)) 414 failures.append(test_failures.FailureReftestMismatch(reference_f ilename))
418 elif err_str: 415 elif err_str:
419 _log.error(err_str) 416 _log.error(err_str)
420 else:
421 _log.warning(" %s -> ref test hashes didn't match but diff pass ed" % self._test_name)
422 417
423 return TestResult(self._test_name, failures, total_test_time, has_stderr , pid=actual_driver_output.pid) 418 return TestResult(self._test_name, failures, total_test_time, has_stderr , pid=actual_driver_output.pid)
OLDNEW
« no previous file with comments | « sky/tests/resources/results.html ('k') | sky/tools/webkitpy/layout_tests/controllers/test_result_writer_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698