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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/layout_package/bot_test_expectations.py

Issue 2125633002: Fill out implementation of UpdateTestExpectations script (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@updateTestExpectations2
Patch Set: Created 4 years, 5 months 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
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 def expectation_for_type(self, type_char): 102 def expectation_for_type(self, type_char):
103 return self._json[self.builder_name][self.FAILURE_MAP_KEY][type_char] 103 return self._json[self.builder_name][self.FAILURE_MAP_KEY][type_char]
104 104
105 # Knowing how to parse the run-length-encoded values in results.json 105 # Knowing how to parse the run-length-encoded values in results.json
106 # is a detail of this class. 106 # is a detail of this class.
107 def occurances_and_type_from_result_item(self, item): 107 def occurances_and_type_from_result_item(self, item):
108 return item[self.RLE_LENGTH], item[self.RLE_VALUE] 108 return item[self.RLE_LENGTH], item[self.RLE_VALUE]
109 109
110 110
111 class BotTestExpectationsFactory(object): 111 class BotTestExpectationsFactory(object):
112 RESULTS_URL_PREFIX = 'http://test-results.appspot.com/testfile?master=Chromi umWebkit&testtype=webkit_tests&name=results-small.json&builder=' 112 RESULTS_URL_PREFIX = 'http://test-results.appspot.com/testfile?master=Chromi umWebkit&testtype=webkit_tests&name=results-small.json&builder='
qyearsley 2016/07/08 17:55:03 Question, unrelated to this CL: Do you know where
bokan 2016/07/08 21:12:59 Sorry, I don't. Ojan or someone more familiar with
113 113
114 def __init__(self, builders): 114 def __init__(self, builders):
115 self.builders = builders 115 self.builders = builders
116 116
117 def _results_json_for_port(self, port_name, builder_category): 117 def _results_json_for_port(self, port_name, builder_category):
118 builder = self.builders.builder_name_for_port_name(port_name) 118 builder = self.builders.builder_name_for_port_name(port_name)
119 if not builder: 119 if not builder:
120 return None 120 return None
121 return self._results_json_for_builder(builder) 121 return self._results_json_for_builder(builder)
122 122
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 additional_expectations = set(e for e in result_exp if not expected( e)) 220 additional_expectations = set(e for e in result_exp if not expected( e))
221 221
222 # Test did not have unexpected results. 222 # Test did not have unexpected results.
223 if not additional_expectations: 223 if not additional_expectations:
224 continue 224 continue
225 225
226 expectations.update(additional_expectations) 226 expectations.update(additional_expectations)
227 unexpected_results_by_path[test_path] = sorted(map(exp_to_string, ex pectations)) 227 unexpected_results_by_path[test_path] = sorted(map(exp_to_string, ex pectations))
228 return unexpected_results_by_path 228 return unexpected_results_by_path
229 229
230 def all_results_by_path(self):
231 results_by_path = {}
232 for test_path, entry in self.results_json.walk_results():
233 results_dict = entry.get(self.results_json.RESULTS_KEY, {})
234
235 result_types = self._all_types_in_results(results_dict)
236
237 if not result_types:
238 continue
239
240 # Distinct results as non-encoded strings.
qyearsley 2016/07/08 17:55:03 Besides this comment, there are a couple ways that
bokan 2016/07/08 21:13:00 Done.
241 result_strings = map(self.results_json.expectation_for_type, result_ types)
242
243 results_by_path[test_path] = sorted(result_strings)
244 return results_by_path
245
230 def expectation_lines(self, only_ignore_very_flaky): 246 def expectation_lines(self, only_ignore_very_flaky):
231 lines = [] 247 lines = []
232 for test_path, entry in self.results_json.walk_results(): 248 for test_path, entry in self.results_json.walk_results():
233 flaky_types = self._flaky_types_in_results(entry, only_ignore_very_f laky) 249 flaky_types = self._flaky_types_in_results(entry, only_ignore_very_f laky)
234 if len(flaky_types) > 1: 250 if len(flaky_types) > 1:
235 line = self._line_from_test_and_flaky_types(test_path, flaky_typ es) 251 line = self._line_from_test_and_flaky_types(test_path, flaky_typ es)
236 lines.append(line) 252 lines.append(line)
237 return lines 253 return lines
238 254
239 def _all_types_in_results(self, run_length_encoded_results): 255 def _all_types_in_results(self, run_length_encoded_results):
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 # The only thing we lose by not fixing this is that a test that was flaky 312 # The only thing we lose by not fixing this is that a test that was flaky
297 # and got fixed will still get printed out until 100 runs have p assed. 313 # and got fixed will still get printed out until 100 runs have p assed.
298 if not TestExpectations.result_was_expected(result_enum, latest_ expectations, test_needs_rebaselining=False): 314 if not TestExpectations.result_was_expected(result_enum, latest_ expectations, test_needs_rebaselining=False):
299 has_unexpected_results = True 315 has_unexpected_results = True
300 break 316 break
301 317
302 if has_unexpected_results: 318 if has_unexpected_results:
303 flaky_results = flaky_results.union(set(result_types)) 319 flaky_results = flaky_results.union(set(result_types))
304 320
305 return flaky_results 321 return flaky_results
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698