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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 # Those are expected passing output. | 58 # Those are expected passing output. |
59 if line.startswith('CONSOLE'): | 59 if line.startswith('CONSOLE'): |
60 previous_line_is_console_line = True | 60 previous_line_is_console_line = True |
61 continue | 61 continue |
62 | 62 |
63 if line.startswith('PASS'): | 63 if line.startswith('PASS'): |
64 previous_line_is_console_line = False | 64 previous_line_is_console_line = False |
65 continue | 65 continue |
66 | 66 |
| 67 if line.startswith('Found'): |
| 68 previous_line_is_console_line = False |
| 69 continue |
| 70 |
67 # Those are expected failing output. | 71 # Those are expected failing output. |
68 if (line.startswith('FAIL') or | 72 if (line.startswith('FAIL') or |
69 line.startswith('TIMEOUT') or | 73 line.startswith('TIMEOUT') or |
70 line.startswith('NOTRUN') or | 74 line.startswith('NOTRUN') or |
71 line.startswith('Harness Error. harness_status = ')): | 75 line.startswith('Harness Error. harness_status = ')): |
72 return False | 76 return False |
73 | 77 |
74 # Unexpected output should be considered as a failure. | 78 # Unexpected output should be considered as a failure. |
75 return False | 79 return False |
76 | 80 |
77 return True | 81 return True |
78 | 82 |
79 | 83 |
80 def has_console_errors_or_warnings(content_text): | 84 def has_console_errors_or_warnings(content_text): |
81 """Returns whether |content_text| is has console errors or warnings.""" | 85 """Returns whether |content_text| is has console errors or warnings.""" |
82 | 86 |
83 def is_warning_or_error(line): | 87 def is_warning_or_error(line): |
84 return line.startswith('CONSOLE ERROR:') or line.startswith('CONSOLE WAR
NING:') | 88 return line.startswith('CONSOLE ERROR:') or line.startswith('CONSOLE WAR
NING:') |
85 | 89 |
86 lines = content_text.strip().splitlines() | 90 lines = content_text.strip().splitlines() |
87 return any(is_warning_or_error(line) for line in lines) | 91 return any(is_warning_or_error(line) for line in lines) |
OLD | NEW |