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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 # the test fails if any mismatch matches and all of the matches don't ma
tch. | 351 # the test fails if any mismatch matches and all of the matches don't ma
tch. |
352 # To minimize the number of references we have to check, we run all of t
he mismatches first, | 352 # To minimize the number of references we have to check, we run all of t
he mismatches first, |
353 # then the matches, and short-circuit out as soon as we can. | 353 # then the matches, and short-circuit out as soon as we can. |
354 # Note that sorting by the expectation sorts "!=" before "==" so this is
easy to do. | 354 # Note that sorting by the expectation sorts "!=" before "==" so this is
easy to do. |
355 | 355 |
356 putAllMismatchBeforeMatch = sorted | 356 putAllMismatchBeforeMatch = sorted |
357 reference_test_names = [] | 357 reference_test_names = [] |
358 for expectation, reference_filename in putAllMismatchBeforeMatch(self._r
eference_files): | 358 for expectation, reference_filename in putAllMismatchBeforeMatch(self._r
eference_files): |
359 reference_test_name = self._port.relative_test_filename(reference_fi
lename) | 359 reference_test_name = self._port.relative_test_filename(reference_fi
lename) |
360 reference_test_names.append(reference_test_name) | 360 reference_test_names.append(reference_test_name) |
361 driver_input = DriverInput(reference_test_name, self._timeout, image
_hash=None, should_run_pixel_test=True, args=self._port.lookup_virtual_test_args
(reference_test_name)) | 361 driver_input = DriverInput(reference_test_name, self._timeout, image
_hash=None, should_run_pixel_test=True, args=self._port.lookup_virtual_test_args
(self._test_name)) |
362 reference_output = self._driver.run_test(driver_input, self._stop_wh
en_done) | 362 reference_output = self._driver.run_test(driver_input, self._stop_wh
en_done) |
363 test_result = self._compare_output_with_reference(reference_output,
test_output, reference_filename, expectation == '!=') | 363 test_result = self._compare_output_with_reference(reference_output,
test_output, reference_filename, expectation == '!=') |
364 | 364 |
365 if (expectation == '!=' and test_result.failures) or (expectation ==
'==' and not test_result.failures): | 365 if (expectation == '!=' and test_result.failures) or (expectation ==
'==' and not test_result.failures): |
366 break | 366 break |
367 total_test_time += test_result.test_run_time | 367 total_test_time += test_result.test_run_time |
368 | 368 |
369 assert(reference_output) | 369 assert(reference_output) |
370 test_result_writer.write_test_result(self._filesystem, self._port, self.
_results_directory, self._test_name, test_output, reference_output, test_result.
failures) | 370 test_result_writer.write_test_result(self._filesystem, self._port, self.
_results_directory, self._test_name, test_output, reference_output, test_result.
failures) |
371 | 371 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 elif reference_driver_output.image_hash != actual_driver_output.image_ha
sh: | 403 elif reference_driver_output.image_hash != actual_driver_output.image_ha
sh: |
404 diff, err_str = self._port.diff_image(reference_driver_output.image,
actual_driver_output.image) | 404 diff, err_str = self._port.diff_image(reference_driver_output.image,
actual_driver_output.image) |
405 if diff: | 405 if diff: |
406 failures.append(test_failures.FailureReftestMismatch(reference_f
ilename)) | 406 failures.append(test_failures.FailureReftestMismatch(reference_f
ilename)) |
407 elif err_str: | 407 elif err_str: |
408 _log.error(err_str) | 408 _log.error(err_str) |
409 else: | 409 else: |
410 _log.warning(" %s -> ref test hashes didn't match but diff pass
ed" % self._test_name) | 410 _log.warning(" %s -> ref test hashes didn't match but diff pass
ed" % self._test_name) |
411 | 411 |
412 return TestResult(self._test_name, failures, total_test_time, has_stderr
, pid=actual_driver_output.pid) | 412 return TestResult(self._test_name, failures, total_test_time, has_stderr
, pid=actual_driver_output.pid) |
OLD | NEW |