Commit aad1cf18 authored by kyle Ju's avatar kyle Ju Committed by Commit Bot

A tweak on importer to import webdriver/tests from upstream manually.

Prevent external/wpt/webdriver directory from being cleared out everytime importer imports WPT tests from upstream. This code will be reverted once we start on the two-way sync phase.

Bug: 881513
Change-Id: I6606277c77b66244dcdfb310ce139eba4087aa77
Reviewed-on: https://chromium-review.googlesource.com/c/1450396Reviewed-by: default avatarPhilip Jägenstedt <foolip@chromium.org>
Commit-Queue: Kyle Ju <kyleju@chromium.org>
Cr-Commit-Position: refs/heads/master@{#628907}
parent f888f6fa
......@@ -385,11 +385,19 @@ class TestImporter(object):
first ensures if upstream deletes some files, we also delete them.
"""
_log.info('Cleaning out tests from %s.', self.dest_path)
# TODO(crbug.com/927187): Temporarily prevent the external/wpt/webdriver folder from deletion.
# Will delete once starting the two-way sync phase on webdriver/tests.
webdriver_dir_path = self.fs.join(self.dest_path, 'webdriver')
should_remove = lambda fs, dirname, basename: (
is_file_exportable(fs.relpath(fs.join(dirname, basename), self.finder.chromium_base())))
files_to_delete = self.fs.files_under(self.dest_path, file_filter=should_remove)
for subpath in files_to_delete:
self.remove(self.finder.path_from_web_tests('external', subpath))
remove_path = self.finder.path_from_web_tests('external', subpath)
if remove_path.startswith(webdriver_dir_path):
continue
self.remove(remove_path)
def _commit_changes(self, commit_message):
_log.info('Committing changes.')
......
......@@ -547,6 +547,10 @@ class TestImporterTest(LoggingTestCase):
host.filesystem.write_text_file(dest_path + '/foo-test-expected.txt', '')
host.filesystem.write_text_file(dest_path + '/OWNERS', '')
host.filesystem.write_text_file(dest_path + '/bar/baz/OWNERS', '')
# TODO(crbug.com/927187): Delete it once webdrive/tests manual import is done.
host.filesystem.write_text_file(dest_path + '/webdriver/tests/A.txt', '')
host.filesystem.write_text_file(dest_path + '/webdriver/tests/test/assert.py', '')
host.filesystem.write_text_file(dest_path + '/webdriver/META.yml', '')
# When the destination path is cleared, OWNERS files and baselines
# are kept.
importer._clear_out_dest_path()
......@@ -554,3 +558,7 @@ class TestImporterTest(LoggingTestCase):
self.assertTrue(host.filesystem.exists(dest_path + '/foo-test-expected.txt'))
self.assertTrue(host.filesystem.exists(dest_path + '/OWNERS'))
self.assertTrue(host.filesystem.exists(dest_path + '/bar/baz/OWNERS'))
self.assertTrue(host.filesystem.exists(dest_path + '/webdriver/tests/A.txt'))
self.assertTrue(host.filesystem.exists(dest_path + '/webdriver/tests/test/assert.py'))
self.assertTrue(host.filesystem.exists(dest_path + '/webdriver/META.yml'))
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