| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Utility module for checking testharness test output.""" | 5 """Utility module for checking testharness test output.""" |
| 6 | 6 |
| 7 _TESTHARNESSREPORT_HEADER = 'This is a testharness.js-based test.' | 7 _TESTHARNESSREPORT_HEADER = 'This is a testharness.js-based test.' |
| 8 _TESTHARNESSREPORT_FOOTER = 'Harness: the test ran to completion.' | 8 _TESTHARNESSREPORT_FOOTER = 'Harness: the test ran to completion.' |
| 9 | 9 |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 at_least_one_pass = False | 47 at_least_one_pass = False |
| 48 | 48 |
| 49 for line in lines: | 49 for line in lines: |
| 50 if line.startswith('PASS'): | 50 if line.startswith('PASS'): |
| 51 at_least_one_pass = True | 51 at_least_one_pass = True |
| 52 continue | 52 continue |
| 53 if (line.startswith('FAIL') or | 53 if (line.startswith('FAIL') or |
| 54 line.startswith('TIMEOUT') or | 54 line.startswith('TIMEOUT') or |
| 55 line.startswith('NOTRUN') or | 55 line.startswith('NOTRUN') or |
| 56 line.startswith('Harness Error.')): | 56 line.startswith('Harness Error. harness_status = ')): |
| 57 return False | 57 return False |
| 58 | 58 |
| 59 return at_least_one_pass | 59 return at_least_one_pass |
| 60 | 60 |
| 61 | 61 |
| 62 def has_console_errors_or_warnings(content_text): | 62 def has_console_errors_or_warnings(content_text): |
| 63 """Returns whether |content_text| is has console errors or warnings.""" | 63 """Returns whether |content_text| is has console errors or warnings.""" |
| 64 | 64 |
| 65 def is_warning_or_error(line): | 65 def is_warning_or_error(line): |
| 66 return line.startswith('CONSOLE ERROR:') or line.startswith('CONSOLE WAR
NING:') | 66 return line.startswith('CONSOLE ERROR:') or line.startswith('CONSOLE WAR
NING:') |
| 67 | 67 |
| 68 lines = content_text.strip().splitlines() | 68 lines = content_text.strip().splitlines() |
| 69 return any(is_warning_or_error(line) for line in lines) | 69 return any(is_warning_or_error(line) for line in lines) |
| OLD | NEW |