Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/testharness_results.py

Issue 2439083003: Replace flaky test, wrangle with harness/infra
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 def is_all_pass_testharness_result(content_text): 11 def is_all_pass_testharness_result(content_text):
12 """Returns whether |content_text| is a testharness result that only contains PASS lines.""" 12 """Returns whether |content_text| is a testharness result that only contains PASS lines."""
13 return (is_testharness_output(content_text) and 13 return (is_testharness_output(content_text) and
14 is_testharness_output_passing(content_text) and 14 is_testharness_output_passing(content_text) and
15 not has_console_errors_or_warnings(content_text)) 15 not has_console_errors_or_warnings(content_text))
16 16
17 17
18 def is_testharness_output(content_text): 18 def is_testharness_output(content_text):
19 """Returns whether |content_text| is a testharness output.""" 19 """Returns whether |content_text| is a testharness output."""
20 # Leading and trailing white spaces are accepted. 20 # Leading and trailing white spaces are accepted.
21 lines = content_text.strip().splitlines() 21 lines = content_text.strip().splitlines()
22 lines = [line.strip() for line in lines] 22 lines = [line.strip() for line in lines]
23 23
24 # A testharness output is defined as containing the header and the footer. 24 # A testharness output is defined as containing the header and the footer.
25 found_header = False 25 found_header = False
26 found_footer = False 26 found_footer = False
27 for line in lines: 27 for line in lines:
28 print "line:" + line
28 if line == _TESTHARNESSREPORT_HEADER: 29 if line == _TESTHARNESSREPORT_HEADER:
30 print "found header"
29 found_header = True 31 found_header = True
30 elif line == _TESTHARNESSREPORT_FOOTER: 32 elif line == _TESTHARNESSREPORT_FOOTER:
33 print "found footer"
31 found_footer = True 34 found_footer = True
32 35
33 return found_header and found_footer 36 return found_header and found_footer
34 37
35 38
36 def is_testharness_output_passing(content_text): 39 def is_testharness_output_passing(content_text):
37 """Returns whether |content_text| is a passing testharness output.""" 40 """Returns whether |content_text| is a passing testharness output."""
38 41
39 # Leading and trailing white spaces are accepted. 42 # Leading and trailing white spaces are accepted.
40 lines = content_text.strip().splitlines() 43 lines = content_text.strip().splitlines()
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 81
79 82
80 def has_console_errors_or_warnings(content_text): 83 def has_console_errors_or_warnings(content_text):
81 """Returns whether |content_text| is has console errors or warnings.""" 84 """Returns whether |content_text| is has console errors or warnings."""
82 85
83 def is_warning_or_error(line): 86 def is_warning_or_error(line):
84 return line.startswith('CONSOLE ERROR:') or line.startswith('CONSOLE WAR NING:') 87 return line.startswith('CONSOLE ERROR:') or line.startswith('CONSOLE WAR NING:')
85 88
86 lines = content_text.strip().splitlines() 89 lines = content_text.strip().splitlines()
87 return any(is_warning_or_error(line) for line in lines) 90 return any(is_warning_or_error(line) for line in lines)
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698