Bug 977275 - Add a horrible install-to-subdir hack in test manifests to support a goofy set of tests. r=gps
authorTed Mielczarek <ted@mielczarek.org>
Wed, 05 Mar 2014 15:51:39 -0500
changeset 172580 0b504e05ccc393779fae480968c0472e57271739
parent 172579 e95573e170752cf0bac7771487fadd56e337c97b
child 172581 eea5db7d83d84b7c76f9ac7478fcfa469ad12a47
push id26365
push userryanvm@gmail.com
push dateFri, 07 Mar 2014 20:37:53 +0000
treeherdermozilla-central@cd67334b34c5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs977275
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 977275 - Add a horrible install-to-subdir hack in test manifests to support a goofy set of tests. r=gps
python/mozbuild/mozbuild/backend/recursivemake.py
python/mozbuild/mozbuild/frontend/data.py
python/mozbuild/mozbuild/frontend/emitter.py
python/mozbuild/mozbuild/test/frontend/data/test-manifest-install-subdir/moz.build
python/mozbuild/mozbuild/test/frontend/data/test-manifest-install-subdir/subdir.ini
python/mozbuild/mozbuild/test/frontend/data/test-manifest-install-subdir/test_foo.html
python/mozbuild/mozbuild/test/frontend/test_emitter.py
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -1068,17 +1068,17 @@ class RecursiveMakeBackend(CommonBackend
             try:
                 self._install_manifests['tests'].add_optional_exists(dest)
             except ValueError:
                 if not obj.dupe_manifest:
                     raise
 
         m = self._test_manifests.setdefault(obj.flavor,
             (obj.install_prefix, set()))
-        m[1].add(obj.manifest_relpath)
+        m[1].add(obj.manifest_obj_relpath)
 
     def _process_local_include(self, local_include, backend_file):
         if local_include.startswith('/'):
             path = '$(topsrcdir)'
         else:
             path = '$(srcdir)/'
         backend_file.write('LOCAL_INCLUDES += -I%s%s\n' % (path, local_include))
 
--- a/python/mozbuild/mozbuild/frontend/data.py
+++ b/python/mozbuild/mozbuild/frontend/data.py
@@ -418,31 +418,35 @@ class TestManifest(SandboxDerived):
         'manifest',
 
         # List of tests. Each element is a dict of metadata.
         'tests',
 
         # The relative path of the parsed manifest within the srcdir.
         'manifest_relpath',
 
+        # The relative path of the parsed manifest within the objdir.
+        'manifest_obj_relpath',
+
         # If this manifest is a duplicate of another one, this is the
         # manifestparser.TestManifest of the other one.
         'dupe_manifest',
     )
 
     def __init__(self, sandbox, path, manifest, flavor=None,
             install_prefix=None, relpath=None, dupe_manifest=False):
         SandboxDerived.__init__(self, sandbox)
 
         self.path = path
         self.directory = mozpath.dirname(path)
         self.manifest = manifest
         self.flavor = flavor
         self.install_prefix = install_prefix
         self.manifest_relpath = relpath
+        self.manifest_obj_relpath = relpath
         self.dupe_manifest = dupe_manifest
         self.installs = {}
         self.pattern_installs = []
         self.tests = []
         self.external_installs = set()
 
 
 class LocalInclude(SandboxDerived):
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -483,16 +483,23 @@ class TreeMetadataEmitter(LoggingMixin):
 
                 missing = [t['name'] for t in filtered if not os.path.exists(t['path'])]
                 if missing:
                     raise SandboxValidationError('Test manifest (%s) lists '
                         'test that does not exist: %s' % (
                         path, ', '.join(missing)))
 
             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))
+
 
             # "head" and "tail" lists.
             # All manifests support support-files.
             #
             # Keep a set of already seen support file patterns, because
             # repeatedly processing the patterns from the default section
             # for every test is quite costly (see bug 922517).
             extras = (('head', set()),
copy from python/mozbuild/mozbuild/test/frontend/data/test-manifest-empty/moz.build
copy to python/mozbuild/mozbuild/test/frontend/data/test-manifest-install-subdir/moz.build
--- a/python/mozbuild/mozbuild/test/frontend/data/test-manifest-empty/moz.build
+++ b/python/mozbuild/mozbuild/test/frontend/data/test-manifest-install-subdir/moz.build
@@ -1,4 +1,4 @@
 # Any copyright is dedicated to the Public Domain.
 # http://creativecommons.org/publicdomain/zero/1.0/
 
-MOCHITEST_MANIFESTS += ['empty.ini']
+MOCHITEST_MANIFESTS += ['subdir.ini']
copy from python/mozbuild/mozbuild/test/frontend/data/test-manifest-empty/empty.ini
copy to python/mozbuild/mozbuild/test/frontend/data/test-manifest-install-subdir/subdir.ini
--- a/python/mozbuild/mozbuild/test/frontend/data/test-manifest-empty/empty.ini
+++ b/python/mozbuild/mozbuild/test/frontend/data/test-manifest-install-subdir/subdir.ini
@@ -1,2 +1,5 @@
 [DEFAULT]
-foo = bar
+install-to-subdir = subdir
+support-files = support.txt
+
+[test_foo.html]
new file mode 100644
--- /dev/null
+++ b/python/mozbuild/mozbuild/test/frontend/data/test-manifest-install-subdir/test_foo.html
@@ -0,0 +1,1 @@
+<html></html>
--- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py
+++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
@@ -343,16 +343,34 @@ class TestEmitterBasic(unittest.TestCase
         self.assertEqual(len(o.installs), 2)
         expected = [
             mozpath.normpath(mozpath.join(o.install_prefix, "../.well-known/foo.txt")),
             mozpath.join(o.install_prefix, "absolute-support.ini"),
         ]
         paths = sorted([v[0] for v in o.installs.values()])
         self.assertEqual(paths, expected)
 
+    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_keys_extracted(self):
         """Ensure all metadata from test manifests is extracted."""
         reader = self.reader('test-manifest-keys-extracted')
 
         objs = [o for o in self.read_topsrcdir(reader)
                 if isinstance(o, TestManifest)]
 
         self.assertEqual(len(objs), 6)