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 test_result = self._compare_output(expected_driver_output, test_outp
ut) | 371 return self._compare_output(expected_driver_output, test_output) |
372 test_result_writer.write_test_result(self._filesystem, self._port, s
elf._results_directory, self._test_name, test_output, reference_output, test_res
ult.failures) | |
373 return test_result | |
374 | 372 |
375 # A reftest can have multiple match references and multiple mismatch ref
erences; | 373 # A reftest can have multiple match references and multiple mismatch ref
erences; |
376 # the test fails if any mismatch matches and all of the matches don't ma
tch. | 374 # the test fails if any mismatch matches and all of the matches don't ma
tch. |
377 # To minimize the number of references we have to check, we run all of t
he mismatches first, | 375 # To minimize the number of references we have to check, we run all of t
he mismatches first, |
378 # then the matches, and short-circuit out as soon as we can. | 376 # then the matches, and short-circuit out as soon as we can. |
379 # Note that sorting by the expectation sorts "!=" before "==" so this is
easy to do. | 377 # Note that sorting by the expectation sorts "!=" before "==" so this is
easy to do. |
380 | 378 |
381 putAllMismatchBeforeMatch = sorted | 379 putAllMismatchBeforeMatch = sorted |
382 reference_test_names = [] | 380 reference_test_names = [] |
383 for expectation, reference_filename in putAllMismatchBeforeMatch(self._r
eference_files): | 381 for expectation, reference_filename in putAllMismatchBeforeMatch(self._r
eference_files): |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 elif reference_driver_output.image_hash != actual_driver_output.image_ha
sh: | 430 elif reference_driver_output.image_hash != actual_driver_output.image_ha
sh: |
433 diff, err_str = self._port.diff_image(reference_driver_output.image,
actual_driver_output.image) | 431 diff, err_str = self._port.diff_image(reference_driver_output.image,
actual_driver_output.image) |
434 if diff: | 432 if diff: |
435 failures.append(test_failures.FailureReftestMismatch(reference_f
ilename)) | 433 failures.append(test_failures.FailureReftestMismatch(reference_f
ilename)) |
436 elif err_str: | 434 elif err_str: |
437 _log.error(err_str) | 435 _log.error(err_str) |
438 else: | 436 else: |
439 _log.warning(" %s -> ref test hashes didn't match but diff pass
ed" % self._test_name) | 437 _log.warning(" %s -> ref test hashes didn't match but diff pass
ed" % self._test_name) |
440 | 438 |
441 return TestResult(self._test_name, failures, total_test_time, has_stderr
, pid=actual_driver_output.pid) | 439 return TestResult(self._test_name, failures, total_test_time, has_stderr
, pid=actual_driver_output.pid) |
OLD | NEW |