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

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

Issue 2607013002: Simplify platform specifier list added by w3c-test-autoroller. (Closed)
Patch Set: Rebased Created 3 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 """A class for updating layout test expectations when updating w3c tests. 5 """A class for updating layout test expectations when updating w3c tests.
6 6
7 Specifically, this class fetches results from try bots for the current CL, and: 7 Specifically, this class fetches results from try bots for the current CL, and:
8 1. Downloads new baseline files for any tests that can be rebaselined. 8 1. Downloads new baseline files for any tests that can be rebaselined.
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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 return expectations 245 return expectations
246 246
247 def create_line_list(self, merged_results): 247 def create_line_list(self, merged_results):
248 """Creates list of test expectations lines. 248 """Creates list of test expectations lines.
249 249
250 Traverses through the given |merged_results| dictionary and parses the 250 Traverses through the given |merged_results| dictionary and parses the
251 value to create one test expectations line per key. 251 value to create one test expectations line per key.
252 252
253 Args: 253 Args:
254 merged_results: A merged_results with the format: 254 merged_results: A merged_results with the format:
255 { 255 {test: {platforms: {'expected: '...', 'actual': '...', 'bug': '...'} }}
256 'test_name': {
257 'platform': {
258 'expected: 'PASS',
259 'actual': 'FAIL',
260 'bug': 'crbug.com/11111'
261 }
262 }
263 }
264 256
265 Returns: 257 Returns:
266 A list of test expectations lines with the format: 258 A list of test expectations lines with the format:
267 ['BUG_URL [PLATFORM(S)] TEST_MAME [EXPECTATION(S)]'] 259 ['BUG_URL [PLATFORM(S)] TEST_NAME [EXPECTATION(S)]']
268 """ 260 """
269 line_list = [] 261 line_list = []
270 for test_name, platform_results in merged_results.iteritems(): 262 for test_name, platform_results in merged_results.iteritems():
271 for platform in platform_results: 263 for platform in platform_results:
272 if test_name.startswith('external'): 264 if not test_name.startswith('external/'):
273 platform_list = [] 265 continue
274 bug = [] 266 bug = []
275 expectations = [] 267 expectations = []
276 if isinstance(platform, tuple): 268 platform_specifier = self._platform_specifier(platform)
277 platform_list = list(platform) 269 bug.append(platform_results[platform]['bug'])
278 else: 270 expectations = self.get_expectations(platform_results[platform])
279 platform_list.append(platform) 271 line = '%s [ %s ] %s [ %s ]' % (bug[0], platform_specifier, test _name, ' '.join(expectations))
280 bug.append(platform_results[platform]['bug']) 272 line_list.append(str(line))
281 expectations = self.get_expectations(platform_results[platfo rm])
282 line = '%s [ %s ] %s [ %s ]' % (bug[0], ' '.join(platform_li st), test_name, ' '.join(expectations))
283 line_list.append(str(line))
284 return line_list 273 return line_list
285 274
275 def _platform_specifier(self, platform):
276 if isinstance(platform, tuple):
277 return ' '.join(sorted(platform))
278 return platform
279
286 def write_to_test_expectations(self, line_list): 280 def write_to_test_expectations(self, line_list):
287 """Writes to TestExpectations. 281 """Writes to TestExpectations.
288 282
289 The place in the file where the new lines are inserted is after a 283 The place in the file where the new lines are inserted is after a
290 marker comment line. If this marker comment line is not found, it will 284 marker comment line. If this marker comment line is not found, it will
291 be added to the end of the file. 285 be added to the end of the file.
292 286
293 Args: 287 Args:
294 line_list: A list of lines to add to the TestExpectations file. 288 line_list: A list of lines to add to the TestExpectations file.
295 """ 289 """
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 369
376 Args: 370 Args:
377 test_path: A file path relative to the layout tests directory. 371 test_path: A file path relative to the layout tests directory.
378 This might correspond to a deleted file or a non-test. 372 This might correspond to a deleted file or a non-test.
379 """ 373 """
380 absolute_path = self.host.filesystem.join(self.finder.layout_tests_dir() , test_path) 374 absolute_path = self.host.filesystem.join(self.finder.layout_tests_dir() , test_path)
381 test_parser = TestParser(absolute_path, self.host) 375 test_parser = TestParser(absolute_path, self.host)
382 if not test_parser.test_doc: 376 if not test_parser.test_doc:
383 return False 377 return False
384 return test_parser.is_jstest() 378 return test_parser.is_jstest()
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698