| 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 19 matching lines...) Expand all Loading... |
| 30 import logging | 30 import logging |
| 31 import re | 31 import re |
| 32 import time | 32 import time |
| 33 | 33 |
| 34 from webkitpy.layout_tests.controllers import repaint_overlay | 34 from webkitpy.layout_tests.controllers import repaint_overlay |
| 35 from webkitpy.layout_tests.controllers import test_result_writer | 35 from webkitpy.layout_tests.controllers import test_result_writer |
| 36 from webkitpy.layout_tests.port.driver import DeviceFailure, DriverInput, Driver
Output | 36 from webkitpy.layout_tests.port.driver import DeviceFailure, DriverInput, Driver
Output |
| 37 from webkitpy.layout_tests.models import test_expectations | 37 from webkitpy.layout_tests.models import test_expectations |
| 38 from webkitpy.layout_tests.models import test_failures | 38 from webkitpy.layout_tests.models import test_failures |
| 39 from webkitpy.layout_tests.models.test_results import TestResult | 39 from webkitpy.layout_tests.models.test_results import TestResult |
| 40 from webkitpy.layout_tests.testharness import testharness_results_checker |
| 40 | 41 |
| 41 | 42 |
| 42 _log = logging.getLogger(__name__) | 43 _log = logging.getLogger(__name__) |
| 43 | 44 |
| 44 | 45 |
| 45 def run_single_test(port, options, results_directory, worker_name, driver, test_
input, stop_when_done): | 46 def run_single_test(port, options, results_directory, worker_name, driver, test_
input, stop_when_done): |
| 46 runner = SingleTestRunner(port, options, results_directory, worker_name, dri
ver, test_input, stop_when_done) | 47 runner = SingleTestRunner(port, options, results_directory, worker_name, dri
ver, test_input, stop_when_done) |
| 47 try: | 48 try: |
| 48 return runner.run() | 49 return runner.run() |
| 49 except DeviceFailure as e: | 50 except DeviceFailure as e: |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 pid=driver_output.pid, | 266 pid=driver_output.pid, |
| 266 has_repaint_overlay=repaint_overlay.result_contains_re
paint_rects(expected_driver_output.text)) | 267 has_repaint_overlay=repaint_overlay.result_contains_re
paint_rects(expected_driver_output.text)) |
| 267 | 268 |
| 268 def _compare_testharness_test(self, driver_output, expected_driver_output): | 269 def _compare_testharness_test(self, driver_output, expected_driver_output): |
| 269 if expected_driver_output.image or expected_driver_output.audio or expec
ted_driver_output.text: | 270 if expected_driver_output.image or expected_driver_output.audio or expec
ted_driver_output.text: |
| 270 return False, [] | 271 return False, [] |
| 271 | 272 |
| 272 if driver_output.image or driver_output.audio or self._is_render_tree(dr
iver_output.text): | 273 if driver_output.image or driver_output.audio or self._is_render_tree(dr
iver_output.text): |
| 273 return False, [] | 274 return False, [] |
| 274 | 275 |
| 275 failures = [] | |
| 276 found_a_pass = False | |
| 277 text = driver_output.text or '' | 276 text = driver_output.text or '' |
| 278 lines = text.strip().splitlines() | 277 |
| 279 lines = [line.strip() for line in lines] | 278 if not testharness_results_checker.is_testharness_output(text): |
| 280 header = 'This is a testharness.js-based test.' | |
| 281 footer = 'Harness: the test ran to completion.' | |
| 282 if not lines or not header in lines: | |
| 283 return False, [] | 279 return False, [] |
| 284 if not footer in lines: | 280 if not testharness_results_checker.is_testharness_output_passing(text): |
| 285 return True, [test_failures.FailureTestHarnessAssertion()] | |
| 286 | |
| 287 for line in lines: | |
| 288 if line == header or line == footer or line.startswith('PASS'): | |
| 289 continue | |
| 290 # CONSOLE output can happen during tests and shouldn't break them. | |
| 291 if line.startswith('CONSOLE'): | |
| 292 continue | |
| 293 | |
| 294 if line.startswith('FAIL') or line.startswith('TIMEOUT'): | |
| 295 return True, [test_failures.FailureTestHarnessAssertion()] | |
| 296 | |
| 297 # Fail the test if there is any unrecognized output. | |
| 298 return True, [test_failures.FailureTestHarnessAssertion()] | 281 return True, [test_failures.FailureTestHarnessAssertion()] |
| 299 return True, [] | 282 return True, [] |
| 300 | 283 |
| 301 def _is_render_tree(self, text): | 284 def _is_render_tree(self, text): |
| 302 return text and "layer at (0,0) size 800x600" in text | 285 return text and "layer at (0,0) size 800x600" in text |
| 303 | 286 |
| 304 def _compare_text(self, expected_text, actual_text): | 287 def _compare_text(self, expected_text, actual_text): |
| 305 failures = [] | 288 failures = [] |
| 306 if (expected_text and actual_text and | 289 if (expected_text and actual_text and |
| 307 # Assuming expected_text is already normalized. | 290 # Assuming expected_text is already normalized. |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 elif reference_driver_output.image_hash != actual_driver_output.image_ha
sh: | 410 elif reference_driver_output.image_hash != actual_driver_output.image_ha
sh: |
| 428 diff, err_str = self._port.diff_image(reference_driver_output.image,
actual_driver_output.image) | 411 diff, err_str = self._port.diff_image(reference_driver_output.image,
actual_driver_output.image) |
| 429 if diff: | 412 if diff: |
| 430 failures.append(test_failures.FailureReftestMismatch(reference_f
ilename)) | 413 failures.append(test_failures.FailureReftestMismatch(reference_f
ilename)) |
| 431 elif err_str: | 414 elif err_str: |
| 432 _log.error(err_str) | 415 _log.error(err_str) |
| 433 else: | 416 else: |
| 434 _log.warning(" %s -> ref test hashes didn't match but diff pass
ed" % self._test_name) | 417 _log.warning(" %s -> ref test hashes didn't match but diff pass
ed" % self._test_name) |
| 435 | 418 |
| 436 return TestResult(self._test_name, failures, total_test_time, has_stderr
, pid=actual_driver_output.pid) | 419 return TestResult(self._test_name, failures, total_test_time, has_stderr
, pid=actual_driver_output.pid) |
| OLD | NEW |