OLD | NEW |
---|---|
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 if not results_json: | 133 if not results_json: |
134 return None | 134 return None |
135 return BotTestExpectations(results_json) | 135 return BotTestExpectations(results_json) |
136 | 136 |
137 def expectations_for_builder(self, builder): | 137 def expectations_for_builder(self, builder): |
138 results_json = self._results_json_for_builder(builder) | 138 results_json = self._results_json_for_builder(builder) |
139 if not results_json: | 139 if not results_json: |
140 return None | 140 return None |
141 return BotTestExpectations(results_json) | 141 return BotTestExpectations(results_json) |
142 | 142 |
143 class BotTestExpectations(object): | 143 class BotTestExpectations(object): |
qyearsley
2016/03/07 19:09:53
Does a BotTestExpectations object represent the se
bokan
2016/03/07 22:59:15
No, it's the results of running the layout tests o
| |
144 # FIXME: Get this from the json instead of hard-coding it. | 144 # FIXME: Get this from the json instead of hard-coding it. |
145 RESULT_TYPES_TO_IGNORE = ['N', 'X', 'Y'] # NO_DATA, SKIP, NOTRUN | 145 RESULT_TYPES_TO_IGNORE = ['N', 'X', 'Y'] # NO_DATA, SKIP, NOTRUN |
146 | 146 |
147 # TODO(ojan): Remove this once crbug.com/514378 is fixed. | 147 # TODO(ojan): Remove this once crbug.com/514378 is fixed. |
148 # The JSON can contain results for expectations, not just actual result type s. | 148 # The JSON can contain results for expectations, not just actual result type s. |
149 NON_RESULT_TYPES = ['S', 'X'] # SLOW, SKIP | 149 NON_RESULT_TYPES = ['S', 'X'] # SLOW, SKIP |
150 | 150 |
151 # specifiers arg is used in unittests to avoid the static dependency on buil ders. | 151 # specifiers arg is used in unittests to avoid the static dependency on buil ders. |
152 def __init__(self, results_json, specifiers=None): | 152 def __init__(self, results_json, specifiers=None): |
153 self.results_json = results_json | 153 self.results_json = results_json |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 additional_expectations = set(e for e in result_exp if not expected( e)) | 213 additional_expectations = set(e for e in result_exp if not expected( e)) |
214 | 214 |
215 # Test did not have unexpected results. | 215 # Test did not have unexpected results. |
216 if not additional_expectations: | 216 if not additional_expectations: |
217 continue | 217 continue |
218 | 218 |
219 expectations.update(additional_expectations) | 219 expectations.update(additional_expectations) |
220 unexpected_results_by_path[test_path] = sorted(map(exp_to_string, ex pectations)) | 220 unexpected_results_by_path[test_path] = sorted(map(exp_to_string, ex pectations)) |
221 return unexpected_results_by_path | 221 return unexpected_results_by_path |
222 | 222 |
223 def all_results_by_path(self): | |
224 results_by_path = {} | |
225 for test_path, entry in self.results_json.walk_results(): | |
226 results_dict = entry.get(self.results_json.RESULTS_KEY, {}) | |
227 | |
228 result_types = self._all_types_in_results(results_dict) | |
229 | |
230 if not result_types: | |
231 continue | |
232 | |
233 # Distinct results as non-encoded strings. | |
234 result_strings = map(self.results_json.expectation_for_type, result_ types) | |
qyearsley
2016/03/07 19:09:53
What are the possible result strings that are retu
bokan
2016/03/07 22:59:15
The result codes come from the bot so I'm not sure
| |
235 | |
236 results_by_path[test_path] = sorted(result_strings) | |
237 return results_by_path | |
238 | |
223 def expectation_lines(self, only_ignore_very_flaky): | 239 def expectation_lines(self, only_ignore_very_flaky): |
224 lines = [] | 240 lines = [] |
225 for test_path, entry in self.results_json.walk_results(): | 241 for test_path, entry in self.results_json.walk_results(): |
226 flaky_types = self._flaky_types_in_results(entry, only_ignore_very_f laky) | 242 flaky_types = self._flaky_types_in_results(entry, only_ignore_very_f laky) |
227 if len(flaky_types) > 1: | 243 if len(flaky_types) > 1: |
228 line = self._line_from_test_and_flaky_types(test_path, flaky_typ es) | 244 line = self._line_from_test_and_flaky_types(test_path, flaky_typ es) |
229 lines.append(line) | 245 lines.append(line) |
230 return lines | 246 return lines |
231 | 247 |
232 def _all_types_in_results(self, run_length_encoded_results): | 248 def _all_types_in_results(self, run_length_encoded_results): |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
289 # The only thing we lose by not fixing this is that a test that was flaky | 305 # The only thing we lose by not fixing this is that a test that was flaky |
290 # and got fixed will still get printed out until 100 runs have p assed. | 306 # and got fixed will still get printed out until 100 runs have p assed. |
291 if not TestExpectations.result_was_expected(result_enum, latest_ expectations, test_needs_rebaselining=False): | 307 if not TestExpectations.result_was_expected(result_enum, latest_ expectations, test_needs_rebaselining=False): |
292 has_unexpected_results = True | 308 has_unexpected_results = True |
293 break | 309 break |
294 | 310 |
295 if has_unexpected_results: | 311 if has_unexpected_results: |
296 flaky_results = flaky_results.union(set(result_types)) | 312 flaky_results = flaky_results.union(set(result_types)) |
297 | 313 |
298 return flaky_results | 314 return flaky_results |
OLD | NEW |