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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 if expected_driver_output.image or expected_driver_output.audio or expec
ted_driver_output.text: | 255 if expected_driver_output.image or expected_driver_output.audio or expec
ted_driver_output.text: |
256 return False, [] | 256 return False, [] |
257 | 257 |
258 if driver_output.image or driver_output.audio or self._is_render_tree(dr
iver_output.text): | 258 if driver_output.image or driver_output.audio or self._is_render_tree(dr
iver_output.text): |
259 return False, [] | 259 return False, [] |
260 | 260 |
261 failures = [] | 261 failures = [] |
262 found_a_pass = False | 262 found_a_pass = False |
263 text = driver_output.text or '' | 263 text = driver_output.text or '' |
264 lines = text.strip().splitlines() | 264 lines = text.strip().splitlines() |
| 265 lines = [line.strip() for line in lines] |
265 header = 'This is a testharness.js-based test.' | 266 header = 'This is a testharness.js-based test.' |
266 footer = 'Harness: the test ran to completion.' | 267 footer = 'Harness: the test ran to completion.' |
267 if not lines or not header in lines: | 268 if not lines or not header in lines: |
268 return False, [] | 269 return False, [] |
269 if not footer in lines: | 270 if not footer in lines: |
270 return True, [test_failures.FailureTestHarnessAssertion()] | 271 return True, [test_failures.FailureTestHarnessAssertion()] |
271 | 272 |
272 for line in lines: | 273 for line in lines: |
| 274 if line == header or line == footer or line.startswith('PASS'): |
| 275 continue |
| 276 # CONSOLE output can happen during tests and shouldn't break them. |
| 277 if line.startswith('CONSOLE'): |
| 278 continue |
| 279 |
273 if line.startswith('FAIL') or line.startswith('TIMEOUT'): | 280 if line.startswith('FAIL') or line.startswith('TIMEOUT'): |
274 return True, [test_failures.FailureTestHarnessAssertion()] | 281 return True, [test_failures.FailureTestHarnessAssertion()] |
275 | 282 |
276 # Fail the test if there is any unrecognized output. | 283 # Fail the test if there is any unrecognized output. |
277 if line != header and line != footer and not line.startswith('PASS')
: | 284 return True, [test_failures.FailureTestHarnessAssertion()] |
278 return True, [test_failures.FailureTestHarnessAssertion()] | |
279 return True, [] | 285 return True, [] |
280 | 286 |
281 def _is_render_tree(self, text): | 287 def _is_render_tree(self, text): |
282 return text and "layer at (0,0) size 800x600" in text | 288 return text and "layer at (0,0) size 800x600" in text |
283 | 289 |
284 def _compare_text(self, expected_text, actual_text): | 290 def _compare_text(self, expected_text, actual_text): |
285 failures = [] | 291 failures = [] |
286 if (expected_text and actual_text and | 292 if (expected_text and actual_text and |
287 # Assuming expected_text is already normalized. | 293 # Assuming expected_text is already normalized. |
288 self._port.do_text_results_differ(expected_text, self._get_normalize
d_output_text(actual_text))): | 294 self._port.do_text_results_differ(expected_text, self._get_normalize
d_output_text(actual_text))): |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 elif reference_driver_output.image_hash != actual_driver_output.image_ha
sh: | 413 elif reference_driver_output.image_hash != actual_driver_output.image_ha
sh: |
408 diff, err_str = self._port.diff_image(reference_driver_output.image,
actual_driver_output.image) | 414 diff, err_str = self._port.diff_image(reference_driver_output.image,
actual_driver_output.image) |
409 if diff: | 415 if diff: |
410 failures.append(test_failures.FailureReftestMismatch(reference_f
ilename)) | 416 failures.append(test_failures.FailureReftestMismatch(reference_f
ilename)) |
411 elif err_str: | 417 elif err_str: |
412 _log.error(err_str) | 418 _log.error(err_str) |
413 else: | 419 else: |
414 _log.warning(" %s -> ref test hashes didn't match but diff pass
ed" % self._test_name) | 420 _log.warning(" %s -> ref test hashes didn't match but diff pass
ed" % self._test_name) |
415 | 421 |
416 return TestResult(self._test_name, failures, total_test_time, has_stderr
, pid=actual_driver_output.pid) | 422 return TestResult(self._test_name, failures, total_test_time, has_stderr
, pid=actual_driver_output.pid) |
OLD | NEW |