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

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py

Issue 20830003: Get rid of the distinction between modifiers and expectations. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: clean up a couple things Created 7 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2011 Google Inc. All rights reserved. 1 # Copyright (C) 2011 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 if len(specifier_set) == 0: 150 if len(specifier_set) == 0:
151 return copy.copy(self._all_test_configurations) 151 return copy.copy(self._all_test_configurations)
152 152
153 matching_sets = {} 153 matching_sets = {}
154 154
155 for specifier in specifier_set: 155 for specifier in specifier_set:
156 for expanded_specifier in self._expand_macros(specifier): 156 for expanded_specifier in self._expand_macros(specifier):
157 configurations = self._specifier_to_configuration_set.get(expand ed_specifier) 157 configurations = self._specifier_to_configuration_set.get(expand ed_specifier)
158 if not configurations: 158 if not configurations:
159 if error_list is not None: 159 if error_list is not None:
160 error_list.append("Unrecognized modifier '" + expanded_s pecifier + "'") 160 error_list.append("Unrecognized specifier '" + expanded_ specifier + "'")
161 return set() 161 return set()
162 category = self._specifier_sorter.category_for_specifier(expande d_specifier) 162 category = self._specifier_sorter.category_for_specifier(expande d_specifier)
163 matching_sets.setdefault(category, set()).update(configurations) 163 matching_sets.setdefault(category, set()).update(configurations)
164 164
165 return reduce(set.intersection, matching_sets.values()) 165 return reduce(set.intersection, matching_sets.values())
166 166
167 @classmethod 167 @classmethod
168 def collapse_macros(cls, macros_dict, specifiers_list): 168 def collapse_macros(cls, macros_dict, specifiers_list):
169 for macro_specifier, macro in macros_dict.items(): 169 for macro_specifier, macro in macros_dict.items():
170 if len(macro) == 1: 170 if len(macro) == 1:
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 def symmetric_difference(cls, iterable): 226 def symmetric_difference(cls, iterable):
227 union = set() 227 union = set()
228 intersection = iterable[0] 228 intersection = iterable[0]
229 for item in iterable: 229 for item in iterable:
230 union = union | item 230 union = union | item
231 intersection = intersection.intersection(item) 231 intersection = intersection.intersection(item)
232 return union - intersection 232 return union - intersection
233 233
234 def to_specifiers_list(self, test_configuration_set): 234 def to_specifiers_list(self, test_configuration_set):
235 """Convert a set of TestConfiguration instances into one or more list of specifiers.""" 235 """Convert a set of TestConfiguration instances into one or more list of specifiers."""
236 # Easy out: if the set is all configurations, the modifier is empty. 236 # Easy out: if the set is all configurations, the specifier is empty.
237 if len(test_configuration_set) == len(self._all_test_configurations): 237 if len(test_configuration_set) == len(self._all_test_configurations):
238 return [[]] 238 return [[]]
239 239
240 # 1) Build a list of specifier sets, discarding specifiers that don't ad d value. 240 # 1) Build a list of specifier sets, discarding specifiers that don't ad d value.
241 specifiers_list = [] 241 specifiers_list = []
242 for config in test_configuration_set: 242 for config in test_configuration_set:
243 values = set(config.values()) 243 values = set(config.values())
244 for specifier, junk_specifier_set in self._junk_specifier_combinatio ns.items(): 244 for specifier, junk_specifier_set in self._junk_specifier_combinatio ns.items():
245 if specifier in values: 245 if specifier in values:
246 values -= junk_specifier_set 246 values -= junk_specifier_set
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 specifiers_to_remove = [] 299 specifiers_to_remove = []
300 for specifier_set in specifiers_list: 300 for specifier_set in specifiers_list:
301 if macro_keys <= specifier_set: 301 if macro_keys <= specifier_set:
302 specifiers_to_remove.append(specifier_set) 302 specifiers_to_remove.append(specifier_set)
303 303
304 for specifier_set in specifiers_to_remove: 304 for specifier_set in specifiers_to_remove:
305 specifiers_list.remove(specifier_set) 305 specifiers_list.remove(specifier_set)
306 specifiers_list.append(frozenset(specifier_set - macro_keys)) 306 specifiers_list.append(frozenset(specifier_set - macro_keys))
307 307
308 return specifiers_list 308 return specifiers_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698