Bug 1603844 - Remove ability to 'install-to-subdir' from test objects, r=firefox-build-system-reviewers,rstewart

There was only a single use of 'install-to-subdir' in all our manifests (which
was removed in the previous commit). All the comments around it suggest that it
was a giant hack. Removing it cleans up a lot of complexity and saves me the
trouble of needing to support it in the new sourcedir based TestResolver.

Differential Revision: https://phabricator.services.mozilla.com/D57170

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew Halberstadt 2019-12-18 16:48:00 +00:00
Родитель bedbb20cee
Коммит b9e9d2e942
8 изменённых файлов: 9 добавлений и 66 удалений

Просмотреть файл

@ -1570,12 +1570,6 @@ class TreeMetadataEmitter(LoggingMixin):
path, ', '.join(missing)), context)
out_dir = mozpath.join(install_prefix, manifest_reldir)
if 'install-to-subdir' in defaults:
# This is terrible, but what are you going to do?
out_dir = mozpath.join(out_dir, defaults['install-to-subdir'])
obj.manifest_obj_relpath = mozpath.join(manifest_reldir,
defaults['install-to-subdir'],
mozpath.basename(path))
def process_support_files(test):
install_info = self._test_files_converter.convert_support_files(

Просмотреть файл

@ -1,4 +1,3 @@
[DEFAULT]
install-to-subdir = subdir
[include:common.ini]

Просмотреть файл

@ -1,4 +0,0 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
MOCHITEST_MANIFESTS += ['subdir.ini']

Просмотреть файл

@ -1,5 +0,0 @@
[DEFAULT]
install-to-subdir = subdir
support-files = support.txt
[test_foo.html]

Просмотреть файл

@ -1 +0,0 @@
<html></html>

Просмотреть файл

@ -802,24 +802,6 @@ class TestEmitterBasic(unittest.TestCase):
'entry in support-files not present in the srcdir'):
self.read_topsrcdir(reader)
def test_test_manifest_install_to_subdir(self):
""" """
reader = self.reader('test-manifest-install-subdir')
objs = self.read_topsrcdir(reader)
self.assertEqual(len(objs), 1)
o = objs[0]
self.assertEqual(len(o.installs), 3)
self.assertEqual(o.manifest_relpath, "subdir.ini")
self.assertEqual(o.manifest_obj_relpath, "subdir/subdir.ini")
expected = [
mozpath.normpath(mozpath.join(o.install_prefix, "subdir/subdir.ini")),
mozpath.normpath(mozpath.join(o.install_prefix, "subdir/support.txt")),
mozpath.normpath(mozpath.join(o.install_prefix, "subdir/test_foo.html")),
]
paths = sorted([v[0] for v in o.installs.values()])
self.assertEqual(paths, expected)
def test_test_manifest_install_includes(self):
"""Ensure that any [include:foo.ini] are copied to the objdir."""
reader = self.reader('test-manifest-install-includes')
@ -829,11 +811,11 @@ class TestEmitterBasic(unittest.TestCase):
o = objs[0]
self.assertEqual(len(o.installs), 3)
self.assertEqual(o.manifest_relpath, "mochitest.ini")
self.assertEqual(o.manifest_obj_relpath, "subdir/mochitest.ini")
self.assertEqual(o.manifest_obj_relpath, "mochitest.ini")
expected = [
mozpath.normpath(mozpath.join(o.install_prefix, "subdir/common.ini")),
mozpath.normpath(mozpath.join(o.install_prefix, "subdir/mochitest.ini")),
mozpath.normpath(mozpath.join(o.install_prefix, "subdir/test_foo.html")),
mozpath.normpath(mozpath.join(o.install_prefix, "common.ini")),
mozpath.normpath(mozpath.join(o.install_prefix, "mochitest.ini")),
mozpath.normpath(mozpath.join(o.install_prefix, "test_foo.html")),
]
paths = sorted([v[0] for v in o.installs.values()])
self.assertEqual(paths, expected)

Просмотреть файл

@ -122,8 +122,8 @@ class SupportFilesConverter(object):
# manifest_dir - Absoulute path to the (srcdir) directory containing the
# manifest that included this test
# out_dir - The path relative to $objdir/_tests used as the destination for the
# test, based on the relative path to the manifest in the srcdir,
# the install_root, and 'install-to-subdir', if present in the manifest.
# test, based on the relative path to the manifest in the srcdir and
# the install_root.
info = TestInstallInfo()
for field, seen in self._fields:
value = test.get(field, '')
@ -133,8 +133,6 @@ class SupportFilesConverter(object):
# and globally, where they are permitted. If a support file appears multiple
# times for a single test, there are unnecessary entries in the manifest. But
# many entries will be shared across tests that share defaults.
# We need to memoize on the basis of both the path and the output
# directory for the benefit of tests specifying 'install-to-subdir'.
key = field, pattern, out_dir
if key in info.seen:
raise ValueError(
@ -242,11 +240,6 @@ def _make_install_manifest(topsrcdir, topobjdir, test_objs):
file_relpath = o['file_relpath']
source = mozpath.join(topsrcdir, file_relpath)
dest = mozpath.join(root, prefix, file_relpath)
if 'install-to-subdir' in o:
out_dir = mozpath.join(out_dir, o['install-to-subdir'])
manifest_relpath = mozpath.relpath(source, mozpath.dirname(manifest_path))
dest = mozpath.join(out_dir, manifest_relpath)
install_info.installs.append((source, dest))
install_info |= converter.convert_support_files(o, root,
manifest_dir,

Просмотреть файл

@ -328,28 +328,14 @@ def get_suite_definition(flavor, subsuite=None, strict=False):
return suite_name, suite
def rewrite_test_base(test, new_base, honor_install_to_subdir=False):
def rewrite_test_base(test, new_base):
"""Rewrite paths in a test to be under a new base path.
This is useful for running tests from a separate location from where they
were defined.
honor_install_to_subdir and the underlying install-to-subdir field are a
giant hack intended to work around the restriction where the mochitest
runner can't handle single test files with multiple configurations. This
argument should be removed once the mochitest runner talks manifests
(bug 984670).
"""
test['here'] = mozpath.join(new_base, test['dir_relpath'])
if honor_install_to_subdir and test.get('install-to-subdir'):
manifest_relpath = mozpath.relpath(test['path'],
mozpath.dirname(test['manifest']))
test['path'] = mozpath.join(new_base, test['dir_relpath'],
test['install-to-subdir'], manifest_relpath)
else:
test['path'] = mozpath.join(new_base, test['file_relpath'])
return test
@ -743,8 +729,7 @@ class TestResolver(MozbuildObject):
if rewrite_base:
rewrite_base = os.path.join(self.topobjdir, os.path.normpath(rewrite_base))
yield rewrite_test_base(test, rewrite_base,
honor_install_to_subdir=True)
yield rewrite_test_base(test, rewrite_base)
else:
yield test