Commit 5c989879 authored by tkent's avatar tkent Committed by Commit bot

wpt-import: Work on third_party/WebKit/LayoutTests instead of third_party/WebKit.

To reduce path_from_webkit_base() usage.

- Remove rmtree()
  Only one callsite, and it called this function with an absolute path.

- Remove relative path resolution in remove()
  There are two callsites, and only one of them passed relative paths.

This CL should have no functional changes.

BUG=710535

Review-Url: https://codereview.chromium.org/2842393003
Cr-Commit-Position: refs/heads/master@{#467828}
parent d681cc9b
......@@ -67,7 +67,7 @@ class TestImporter(object):
# TODO(qyearsley): Simplify this to use LocalWPT.fetch when csswg-test
# is merged into web-platform-tests (crbug.com/706118).
temp_repo_path = self.finder.path_from_webkit_base(dest_dir_name)
temp_repo_path = self.finder.path_from_layout_tests(dest_dir_name)
_log.info('Cloning repo: %s', repo_url)
_log.info('Local path: %s', temp_repo_path)
self.run(['git', 'clone', repo_url, temp_repo_path])
......@@ -139,8 +139,9 @@ class TestImporter(object):
_log.warning('Checkout has local commits; aborting. Use --allow-local-commits to allow this.')
return False
if self.fs.exists(self.finder.path_from_webkit_base(WPT_DEST_NAME)):
_log.warning('WebKit/%s exists; aborting.', WPT_DEST_NAME)
temp_repo_path = self.finder.path_from_layout_tests(WPT_DEST_NAME)
if self.fs.exists(temp_repo_path):
_log.warning('%s exists; aborting.', temp_repo_path)
return False
return True
......@@ -162,7 +163,7 @@ class TestImporter(object):
def clean_up_temp_repo(self, temp_repo_path):
_log.info('Deleting temp repo directory %s.', temp_repo_path)
self.rmtree(temp_repo_path)
self.fs.rmtree(temp_repo_path)
def _copy_resources(self):
"""Copies resources from wpt to LayoutTests/resources.
......@@ -248,7 +249,7 @@ class TestImporter(object):
basename != 'OWNERS')
files_to_delete = self.fs.files_under(dest_path, file_filter=should_remove)
for subpath in files_to_delete:
self.remove('LayoutTests', 'external', subpath)
self.remove(self.finder.path_from_layout_tests('external', subpath))
def _commit_changes(self, commit_message):
_log.info('Committing changes.')
......@@ -286,7 +287,7 @@ class TestImporter(object):
def run(self, cmd, exit_on_failure=True, cwd=None, stdin=''):
_log.debug('Running command: %s', ' '.join(cmd))
cwd = cwd or self.finder.webkit_base()
cwd = cwd or self.finder.path_from_layout_tests()
proc = self.executive.popen(cmd, stdout=self.executive.PIPE, stderr=self.executive.PIPE, stdin=self.executive.PIPE, cwd=cwd)
out, err = proc.communicate(stdin)
if proc.returncode or self.verbose:
......@@ -311,16 +312,10 @@ class TestImporter(object):
_log.debug('cp %s %s', source, destination)
self.fs.copyfile(source, destination)
def remove(self, *comps):
dest = self.finder.path_from_webkit_base(*comps)
def remove(self, dest):
_log.debug('rm %s', dest)
self.fs.remove(dest)
def rmtree(self, *comps):
dest = self.finder.path_from_webkit_base(*comps)
_log.debug('rm -fr %s', dest)
self.fs.rmtree(dest)
def do_auto_update(self):
"""Attempts to upload a CL, make any required adjustments, and commit.
......
......@@ -25,11 +25,11 @@ class TestImporterTest(LoggingTestCase):
self.assertEqual(return_code, 0)
self.assertLog([
'INFO: Cloning repo: https://chromium.googlesource.com/external/w3c/web-platform-tests.git\n',
'INFO: Local path: /mock-checkout/third_party/WebKit/wpt\n',
'INFO: Local path: /mock-checkout/third_party/WebKit/LayoutTests/wpt\n',
'INFO: There were exportable but not-yet-exported commits:\n',
'INFO: https://chromium.googlesource.com/chromium/src/+/deadbeef\n',
'INFO: Aborting import to prevent clobbering these commits.\n',
'INFO: Deleting temp repo directory /mock-checkout/third_party/WebKit/wpt.\n',
'INFO: Deleting temp repo directory /mock-checkout/third_party/WebKit/LayoutTests/wpt.\n',
])
def test_update_test_expectations(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment