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

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

Issue 2648323006: Use update_w3c_test_expectations directly in same process. (Closed)
Patch Set: 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.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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 """Fetches a copy of the latest state of a W3C test repository and commits. 5 """Fetches a copy of the latest state of a W3C test repository and commits.
6 6
7 If this script is given the argument --auto-update, it will also: 7 If this script is given the argument --auto-update, it will also:
8 1. Upload a CL. 8 1. Upload a CL.
9 2. Trigger try jobs and wait for them to complete. 9 2. Trigger try jobs and wait for them to complete.
10 3. Make any changes that are required for new failing tests. 10 3. Make any changes that are required for new failing tests.
11 4. Commit the CL. 11 4. Commit the CL.
12 12
13 If this script is given the argument --auto-update, it will also attempt to 13 If this script is given the argument --auto-update, it will also attempt to
14 upload a CL, trigger try jobs, and make any changes that are required for 14 upload a CL, trigger try jobs, and make any changes that are required for
15 new failing tests before committing. 15 new failing tests before committing.
16 """ 16 """
17 17
18 import argparse 18 import argparse
19 import json 19 import json
20 import logging 20 import logging
21 import re 21 import re
22 22
23 from webkitpy.common.net.git_cl import GitCL 23 from webkitpy.common.net.git_cl import GitCL
24 from webkitpy.common.webkit_finder import WebKitFinder 24 from webkitpy.common.webkit_finder import WebKitFinder
25 from webkitpy.layout_tests.models.test_expectations import TestExpectations, Tes tExpectationParser 25 from webkitpy.layout_tests.models.test_expectations import TestExpectations, Tes tExpectationParser
26 from webkitpy.w3c.update_w3c_test_expectations import W3CExpectationsLineAdder
26 from webkitpy.w3c.test_importer import TestImporter 27 from webkitpy.w3c.test_importer import TestImporter
27 from webkitpy.w3c.common import WPT_REPO_URL, CSS_REPO_URL, WPT_DEST_NAME, CSS_D EST_NAME 28 from webkitpy.w3c.common import WPT_REPO_URL, CSS_REPO_URL, WPT_DEST_NAME, CSS_D EST_NAME
28 29
29 # Settings for how often to check try job results and how long to wait. 30 # Settings for how often to check try job results and how long to wait.
30 POLL_DELAY_SECONDS = 2 * 60 31 POLL_DELAY_SECONDS = 2 * 60
31 TIMEOUT_SECONDS = 180 * 60 32 TIMEOUT_SECONDS = 180 * 60
32 33
33 _log = logging.getLogger(__file__) 34 _log = logging.getLogger(__file__)
34 35
35 36
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 address = directory_to_owner[test_dir] 394 address = directory_to_owner[test_dir]
394 if not re.match(r'\S+@\S+', address): 395 if not re.match(r'\S+@\S+', address):
395 _log.warning('%s appears not be an email address, skipping.' , address) 396 _log.warning('%s appears not be an email address, skipping.' , address)
396 continue 397 continue
397 email_addresses.add(address) 398 email_addresses.add(address)
398 return sorted(email_addresses) 399 return sorted(email_addresses)
399 400
400 def fetch_new_expectations_and_baselines(self): 401 def fetch_new_expectations_and_baselines(self):
401 """Adds new expectations and downloads baselines based on try job result s, then commits and uploads the change.""" 402 """Adds new expectations and downloads baselines based on try job result s, then commits and uploads the change."""
402 _log.info('Adding test expectations lines to LayoutTests/TestExpectation s.') 403 _log.info('Adding test expectations lines to LayoutTests/TestExpectation s.')
403 script_path = self.path_from_webkit_base('Tools', 'Scripts', 'update-w3c -test-expectations') 404 line_adder = W3CExpectationsLineAdder(self.host)
404 self.run([self.host.executable, script_path, '--verbose']) 405 line_adder.run()
405 message = 'Modify TestExpectations or download new baselines for tests.' 406 message = 'Update test expectations and baselines.'
406 self.check_run(['git', 'commit', '-a', '-m', message]) 407 self.check_run(['git', 'commit', '-a', '-m', message])
407 self.git_cl.run(['upload', '-m', message, '--rietveld']) 408 self.git_cl.run(['upload', '-m', message, '--rietveld'])
408 409
409 def update_all_test_expectations_files(self, deleted_tests, renamed_tests): 410 def update_all_test_expectations_files(self, deleted_tests, renamed_tests):
410 """Updates all test expectations files for tests that have been deleted or renamed.""" 411 """Updates all test expectations files for tests that have been deleted or renamed."""
411 port = self.host.port_factory.get() 412 port = self.host.port_factory.get()
412 for path, file_contents in port.all_expectations_dict().iteritems(): 413 for path, file_contents in port.all_expectations_dict().iteritems():
413
414 parser = TestExpectationParser(port, all_tests=None, is_lint_mode=Fa lse) 414 parser = TestExpectationParser(port, all_tests=None, is_lint_mode=Fa lse)
415 expectation_lines = parser.parse(path, file_contents) 415 expectation_lines = parser.parse(path, file_contents)
416 self._update_single_test_expectations_file(path, expectation_lines, deleted_tests, renamed_tests) 416 self._update_single_test_expectations_file(path, expectation_lines, deleted_tests, renamed_tests)
417 417
418 def _update_single_test_expectations_file(self, path, expectation_lines, del eted_tests, renamed_tests): 418 def _update_single_test_expectations_file(self, path, expectation_lines, del eted_tests, renamed_tests):
419 """Updates single test expectations file.""" 419 """Updates single test expectations file."""
420 # FIXME: This won't work for removed or renamed directories with test ex pectations 420 # FIXME: This won't work for removed or renamed directories with test ex pectations
421 # that are directories rather than individual tests. 421 # that are directories rather than individual tests.
422 new_lines = [] 422 new_lines = []
423 changed_lines = [] 423 changed_lines = []
(...skipping 26 matching lines...) Expand all
450 """Returns a dict mapping source to dest name for layout tests that have been renamed.""" 450 """Returns a dict mapping source to dest name for layout tests that have been renamed."""
451 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff- filter=R', '--name-status']) 451 out = self.check_run(['git', 'diff', 'origin/master', '-M100%', '--diff- filter=R', '--name-status'])
452 renamed_tests = {} 452 renamed_tests = {}
453 for line in out.splitlines(): 453 for line in out.splitlines():
454 _, source_path, dest_path = line.split() 454 _, source_path, dest_path = line.split()
455 source_test = self.finder.layout_test_name(source_path) 455 source_test = self.finder.layout_test_name(source_path)
456 dest_test = self.finder.layout_test_name(dest_path) 456 dest_test = self.finder.layout_test_name(dest_path)
457 if source_test and dest_test: 457 if source_test and dest_test:
458 renamed_tests[source_test] = dest_test 458 renamed_tests[source_test] = dest_test
459 return renamed_tests 459 return renamed_tests
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698