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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py

Issue 2694293003: Simplify specifiers when all platforms are covered, and sort lines. (Closed)
Patch Set: Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 """Updates layout test expectations and baselines when updating w3c tests. 5 """Updates layout test expectations and baselines when updating w3c tests.
6 6
7 Specifically, this class fetches results from try bots for the current CL, then 7 Specifically, this class fetches results from try bots for the current CL, then
8 (1) downloads new baseline files for any tests that can be rebaselined, and 8 (1) downloads new baseline files for any tests that can be rebaselined, and
9 (2) updates the generic TestExpectations file for any other failing tests. 9 (2) updates the generic TestExpectations file for any other failing tests.
10 """ 10 """
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 'bug': 'crbug.com/11111' 249 'bug': 'crbug.com/11111'
250 } 250 }
251 } 251 }
252 } 252 }
253 253
254 Returns: 254 Returns:
255 A list of test expectations lines with the format: 255 A list of test expectations lines with the format:
256 ['BUG_URL [PLATFORM(S)] TEST_NAME [EXPECTATION(S)]'] 256 ['BUG_URL [PLATFORM(S)] TEST_NAME [EXPECTATION(S)]']
257 """ 257 """
258 line_list = [] 258 line_list = []
259 for test_name, port_results in merged_results.iteritems(): 259 for test_name, port_results in sorted(merged_results.iteritems()):
260 for port_names in sorted(port_results): 260 for port_names in sorted(port_results):
261 if test_name.startswith('external'): 261 if test_name.startswith('external'):
262 line_parts = [port_results[port_names]['bug']] 262 line_parts = [port_results[port_names]['bug']]
263 specifier_part = self.specifier_part(self.to_list(port_names ), test_name) 263 specifier_part = self.specifier_part(self.to_list(port_names ), test_name)
264 if specifier_part: 264 if specifier_part:
265 line_parts.append(specifier_part) 265 line_parts.append(specifier_part)
266 line_parts.append(test_name) 266 line_parts.append(test_name)
267 line_parts.append('[ %s ]' % ' '.join(self.get_expectations( port_results[port_names]))) 267 line_parts.append('[ %s ]' % ' '.join(self.get_expectations( port_results[port_names])))
268 line_list.append(' '.join(line_parts)) 268 line_list.append(' '.join(line_parts))
269 return line_list 269 return line_list
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 supported platforms, then an empty list is returned. 332 supported platforms, then an empty list is returned.
333 This list will be sorted and have capitalized specifier strings. 333 This list will be sorted and have capitalized specifier strings.
334 """ 334 """
335 specifiers = {specifier.lower() for specifier in specifiers} 335 specifiers = {specifier.lower() for specifier in specifiers}
336 for macro_specifier, version_specifiers in configuration_specifier_macro s.iteritems(): 336 for macro_specifier, version_specifiers in configuration_specifier_macro s.iteritems():
337 macro_specifier = macro_specifier.lower() 337 macro_specifier = macro_specifier.lower()
338 version_specifiers = {specifier.lower() for specifier in version_spe cifiers} 338 version_specifiers = {specifier.lower() for specifier in version_spe cifiers}
339 if version_specifiers.issubset(specifiers): 339 if version_specifiers.issubset(specifiers):
340 specifiers -= version_specifiers 340 specifiers -= version_specifiers
341 specifiers.add(macro_specifier) 341 specifiers.add(macro_specifier)
342 if specifiers == set(configuration_specifier_macros): 342 if specifiers == {macro.lower() for macro in configuration_specifier_mac ros.keys()}:
343 return [] 343 return []
344 return sorted(specifier.capitalize() for specifier in specifiers) 344 return sorted(specifier.capitalize() for specifier in specifiers)
345 345
346 def write_to_test_expectations(self, line_list): 346 def write_to_test_expectations(self, line_list):
347 """Writes to TestExpectations. 347 """Writes to TestExpectations.
348 348
349 The place in the file where the new lines are inserted is after a 349 The place in the file where the new lines are inserted is after a
350 marker comment line. If this marker comment line is not found, it will 350 marker comment line. If this marker comment line is not found, it will
351 be added to the end of the file. 351 be added to the end of the file.
352 352
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 439
440 Args: 440 Args:
441 test_path: A file path relative to the layout tests directory. 441 test_path: A file path relative to the layout tests directory.
442 This might correspond to a deleted file or a non-test. 442 This might correspond to a deleted file or a non-test.
443 """ 443 """
444 absolute_path = self.host.filesystem.join(self.finder.layout_tests_dir() , test_path) 444 absolute_path = self.host.filesystem.join(self.finder.layout_tests_dir() , test_path)
445 test_parser = TestParser(absolute_path, self.host) 445 test_parser = TestParser(absolute_path, self.host)
446 if not test_parser.test_doc: 446 if not test_parser.test_doc:
447 return False 447 return False
448 return test_parser.is_jstest() 448 return test_parser.is_jstest()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698