| 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 def _compare_output(self, expected_driver_output, driver_output): | 229 def _compare_output(self, expected_driver_output, driver_output): |
| 230 failures = [] | 230 failures = [] |
| 231 failures.extend(self._handle_error(driver_output)) | 231 failures.extend(self._handle_error(driver_output)) |
| 232 | 232 |
| 233 if driver_output.crash: | 233 if driver_output.crash: |
| 234 # Don't continue any more if we already have a crash. | 234 # Don't continue any more if we already have a crash. |
| 235 # In case of timeouts, we continue since we still want to see the te
xt and image output. | 235 # In case of timeouts, we continue since we still want to see the te
xt and image output. |
| 236 return TestResult(self._test_name, failures, driver_output.test_time
, driver_output.has_stderr(), | 236 return TestResult(self._test_name, failures, driver_output.test_time
, driver_output.has_stderr(), |
| 237 pid=driver_output.pid) | 237 pid=driver_output.pid) |
| 238 | 238 |
| 239 failures.extend(self._compare_text(expected_driver_output.text, driver_o
utput.text)) | 239 is_testharness_test, testharness_failures = self._compare_testharness_te
st(driver_output, expected_driver_output) |
| 240 failures.extend(self._compare_audio(expected_driver_output.audio, driver
_output.audio)) | 240 if is_testharness_test: |
| 241 if self._should_run_pixel_test: | 241 failures.extend(testharness_failures) |
| 242 failures.extend(self._compare_image(expected_driver_output, driver_o
utput)) | 242 else: |
| 243 failures.extend(self._compare_text(expected_driver_output.text, driv
er_output.text)) |
| 244 failures.extend(self._compare_audio(expected_driver_output.audio, dr
iver_output.audio)) |
| 245 if self._should_run_pixel_test: |
| 246 failures.extend(self._compare_image(expected_driver_output, driv
er_output)) |
| 243 return TestResult(self._test_name, failures, driver_output.test_time, dr
iver_output.has_stderr(), | 247 return TestResult(self._test_name, failures, driver_output.test_time, dr
iver_output.has_stderr(), |
| 244 pid=driver_output.pid) | 248 pid=driver_output.pid) |
| 245 | 249 |
| 250 def _compare_testharness_test(self, driver_output, expected_driver_output): |
| 251 if expected_driver_output.image or expected_driver_output.audio or expec
ted_driver_output.text: |
| 252 return False, [] |
| 253 |
| 254 if driver_output.image or driver_output.audio or self._is_render_tree(dr
iver_output.text): |
| 255 return False, [] |
| 256 |
| 257 failures = [] |
| 258 found_a_pass = False |
| 259 text = driver_output.text or '' |
| 260 lines = text.splitlines() |
| 261 if not lines or lines[0] != 'This is a testharness.js-based test.': |
| 262 return False, [] |
| 263 if lines[-2:] != ['Harness: the test ran to completion.', '']: |
| 264 return True, [test_failures.FailureTestHarnessAssertion()] |
| 265 |
| 266 for line in lines: |
| 267 if line.startswith('FAIL') or line.startswith('TIMEOUT'): |
| 268 return True, [test_failures.FailureTestHarnessAssertion()] |
| 269 |
| 270 return True, [] |
| 271 |
| 272 def _is_render_tree(self, text): |
| 273 return text and "layer at (0,0) size 800x600" in text |
| 274 |
| 246 def _compare_text(self, expected_text, actual_text): | 275 def _compare_text(self, expected_text, actual_text): |
| 247 failures = [] | 276 failures = [] |
| 248 if (expected_text and actual_text and | 277 if (expected_text and actual_text and |
| 249 # Assuming expected_text is already normalized. | 278 # Assuming expected_text is already normalized. |
| 250 self._port.do_text_results_differ(expected_text, self._get_normalize
d_output_text(actual_text))): | 279 self._port.do_text_results_differ(expected_text, self._get_normalize
d_output_text(actual_text))): |
| 251 failures.append(test_failures.FailureTextMismatch()) | 280 failures.append(test_failures.FailureTextMismatch()) |
| 252 elif actual_text and not expected_text: | 281 elif actual_text and not expected_text: |
| 253 failures.append(test_failures.FailureMissingResult()) | 282 failures.append(test_failures.FailureMissingResult()) |
| 254 return failures | 283 return failures |
| 255 | 284 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 elif reference_driver_output.image_hash != actual_driver_output.image_ha
sh: | 394 elif reference_driver_output.image_hash != actual_driver_output.image_ha
sh: |
| 366 diff, err_str = self._port.diff_image(reference_driver_output.image,
actual_driver_output.image) | 395 diff, err_str = self._port.diff_image(reference_driver_output.image,
actual_driver_output.image) |
| 367 if diff: | 396 if diff: |
| 368 failures.append(test_failures.FailureReftestMismatch(reference_f
ilename)) | 397 failures.append(test_failures.FailureReftestMismatch(reference_f
ilename)) |
| 369 elif err_str: | 398 elif err_str: |
| 370 _log.error(err_str) | 399 _log.error(err_str) |
| 371 else: | 400 else: |
| 372 _log.warning(" %s -> ref test hashes didn't match but diff pass
ed" % self._test_name) | 401 _log.warning(" %s -> ref test hashes didn't match but diff pass
ed" % self._test_name) |
| 373 | 402 |
| 374 return TestResult(self._test_name, failures, total_test_time, has_stderr
, pid=actual_driver_output.pid) | 403 return TestResult(self._test_name, failures, total_test_time, has_stderr
, pid=actual_driver_output.pid) |
| OLD | NEW |