| 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 def _run_reftest(self): | 361 def _run_reftest(self): |
| 362 test_output = self._driver.run_test(self._driver_input(), self._stop_whe
n_done) | 362 test_output = self._driver.run_test(self._driver_input(), self._stop_whe
n_done) |
| 363 total_test_time = 0 | 363 total_test_time = 0 |
| 364 reference_output = None | 364 reference_output = None |
| 365 test_result = None | 365 test_result = None |
| 366 | 366 |
| 367 # If the test crashed, or timed out, there's no point in running the ref
erence at all. | 367 # If the test crashed, or timed out, there's no point in running the ref
erence at all. |
| 368 # This can save a lot of execution time if we have a lot of crashes or t
imeouts. | 368 # This can save a lot of execution time if we have a lot of crashes or t
imeouts. |
| 369 if test_output.crash or test_output.timeout: | 369 if test_output.crash or test_output.timeout: |
| 370 expected_driver_output = DriverOutput(text=None, image=None, image_h
ash=None, audio=None) | 370 expected_driver_output = DriverOutput(text=None, image=None, image_h
ash=None, audio=None) |
| 371 return self._compare_output(expected_driver_output, test_output) | 371 test_result = self._compare_output(expected_driver_output, test_outp
ut) |
| 372 |
| 373 if test_output.crash: |
| 374 test_result_writer.write_test_result(self._filesystem, self._por
t, self._results_directory, self._test_name, test_output, expected_driver_output
, test_result.failures) |
| 375 return test_result |
| 372 | 376 |
| 373 # A reftest can have multiple match references and multiple mismatch ref
erences; | 377 # A reftest can have multiple match references and multiple mismatch ref
erences; |
| 374 # the test fails if any mismatch matches and all of the matches don't ma
tch. | 378 # the test fails if any mismatch matches and all of the matches don't ma
tch. |
| 375 # To minimize the number of references we have to check, we run all of t
he mismatches first, | 379 # To minimize the number of references we have to check, we run all of t
he mismatches first, |
| 376 # then the matches, and short-circuit out as soon as we can. | 380 # then the matches, and short-circuit out as soon as we can. |
| 377 # Note that sorting by the expectation sorts "!=" before "==" so this is
easy to do. | 381 # Note that sorting by the expectation sorts "!=" before "==" so this is
easy to do. |
| 378 | 382 |
| 379 putAllMismatchBeforeMatch = sorted | 383 putAllMismatchBeforeMatch = sorted |
| 380 reference_test_names = [] | 384 reference_test_names = [] |
| 381 for expectation, reference_filename in putAllMismatchBeforeMatch(self._r
eference_files): | 385 for expectation, reference_filename in putAllMismatchBeforeMatch(self._r
eference_files): |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 elif reference_driver_output.image_hash != actual_driver_output.image_ha
sh: | 434 elif reference_driver_output.image_hash != actual_driver_output.image_ha
sh: |
| 431 diff, err_str = self._port.diff_image(reference_driver_output.image,
actual_driver_output.image) | 435 diff, err_str = self._port.diff_image(reference_driver_output.image,
actual_driver_output.image) |
| 432 if diff: | 436 if diff: |
| 433 failures.append(test_failures.FailureReftestMismatch(reference_f
ilename)) | 437 failures.append(test_failures.FailureReftestMismatch(reference_f
ilename)) |
| 434 elif err_str: | 438 elif err_str: |
| 435 _log.error(err_str) | 439 _log.error(err_str) |
| 436 else: | 440 else: |
| 437 _log.warning(" %s -> ref test hashes didn't match but diff pass
ed" % self._test_name) | 441 _log.warning(" %s -> ref test hashes didn't match but diff pass
ed" % self._test_name) |
| 438 | 442 |
| 439 return TestResult(self._test_name, failures, total_test_time, has_stderr
, pid=actual_driver_output.pid) | 443 return TestResult(self._test_name, failures, total_test_time, has_stderr
, pid=actual_driver_output.pid) |
| OLD | NEW |