Currently in the webkitpy codebase, there are various places where paths are hard-coded, including paths to the layout tests directory.
In order to make it simpler to change paths (for bug 622551) we can do some preliminary work avoid repeated hard-coding of paths.
Examples of some occurrences of the literal "LayoutTests":
webkitpy/style/checker.py: 'LayoutTests' + os.path.sep,
webkitpy/common/checkout/baseline_optimizer.py: ROOT_LAYOUT_TESTS_DIRECTORY = 'LayoutTests'
webkitpy/common/host_mock.py: external_dir = webkit_finder.path_from_webkit_base('LayoutTests', 'external')
webkitpy/layout_tests/controllers/layout_test_finder.py: self.LAYOUT_TESTS_DIRECTORIES = ('src', 'third_party', 'WebKit', 'LayoutTests')
webkitpy/layout_tests/controllers/manager.py: self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests'
webkitpy/layout_tests/controllers/manager.py: base_dir = self._port.path_from_webkit_base('LayoutTests', 'fast', 'harness')
webkitpy/layout_tests/port/base.py: assert self._filesystem.exists(path_to_virtual_test_suites), 'LayoutTests/VirtualTestSuites not found'
webkitpy/layout_tests/port/test.py:LAYOUT_TEST_DIR = '/test.checkout/LayoutTests'
webkitpy/layout_tests/port/android.py:DEVICE_LAYOUT_TESTS_DIR = DEVICE_WEBKIT_BASE_DIR + 'LayoutTests/'
webkitpy/layout_tests/port/driver.py: "file:///src/LayoutTests/fast/html/keygen.html" it would return
webkitpy/layout_tests/lint_test_expectations.py: failure = 'LayoutTests/%s/README.txt is missing (each virtual suite must have one).' % suite.name
webkitpy/layout_tests/models/test_expectations.py: # the LayoutTests directory
webkitpy/w3c/chromium_commit.py:CHROMIUM_WPT_DIR = 'third_party/WebKit/LayoutTests/external/wpt/'
webkitpy/w3c/test_copier.py: self.layout_tests_dir = self.webkit_finder.path_from_webkit_base('LayoutTests')
webkitpy/w3c/test_copier.py: w3c_import_expectations_path = self.webkit_finder.path_from_webkit_base('LayoutTests', 'W3CImportExpectations')
webkitpy/w3c/directory_owners_extractor.py: input_path = self.finder.path_from_webkit_base('LayoutTests', 'W3CImportExpectations')
webkitpy/w3c/test_importer.py: source = self.path_from_webkit_base('LayoutTests', 'external', WPT_DEST_NAME, wpt_subdir, filename)
webkitpy/w3c/test_importer.py: destination = self.path_from_webkit_base('LayoutTests', 'resources', filename)
webkitpy/w3c/test_importer.py: dest_path = self.path_from_webkit_base('LayoutTests', 'external', dest_dir_name)
webkitpy/w3c/wpt_manifest.py: manifest_path = finder.path_from_webkit_base('LayoutTests', 'external', 'wpt', 'MANIFEST.json')
webkitpy/w3c/wpt_manifest.py: base_manifest_path = finder.path_from_webkit_base('LayoutTests', 'external', 'WPT_BASE_MANIFEST.json')
webkitpy/w3c/wpt_manifest.py: wpt_path = manifest_path = finder.path_from_webkit_base('LayoutTests', 'external', 'wpt')
webkitpy/w3c/common.py:CHROMIUM_WPT_DIR = 'third_party/WebKit/LayoutTests/external/wpt/'
webkitpy/w3c/chromium_finder.py: return finder.path_from_webkit_base('LayoutTests', 'external', 'wpt')
webkitpy/tool/commands/queries.py: file = file.replace(layout_tests_dir, 'LayoutTests')
webkitpy/tool/commands/rebaseline.py: baseline_re = re.compile(r'.*[\\/]LayoutTests[\\/].*-expected\.(txt|png|wav)$')
webkitpy/tool/commands/rebaseline_cl.py: test_base = 'third_party/WebKit/LayoutTests/'
Related work:
- Rename webkit_finder to something like path_finder
- Add support in the path finder module to support paths both pre- and post- blink move (e.g. if the root is "//web", then the layout tests directory is "//web/page_tests", both otherwise it's "//third_party/WebKit/LayoutTests".
Comment 1 by bugdroid1@chromium.org
, Apr 20 2017