Bug 994255: Add included and parent test manifest files to backend inputs list. r=gps draft
authorKris Maglione <maglione.k@gmail.com>
Fri, 18 Nov 2016 14:52:54 -0800
changeset 442591 ccdf62dde1d315495e7effbdd824c2a2c14099f2
parent 441511 f958c1dd30d0073fa48ae81ddde53eac379c4e20
child 537831 08e6a3711f5bcaadaa13bb1bcbd488d75a2325ab
push id36744
push usermaglione.k@gmail.com
push dateTue, 22 Nov 2016 20:41:30 +0000
reviewersgps
bugs994255
milestone53.0a1
Bug 994255: Add included and parent test manifest files to backend inputs list. r=gps MozReview-Commit-ID: EvMt0ojZGFr
python/mozbuild/mozbuild/backend/recursivemake.py
python/mozbuild/mozbuild/frontend/data.py
python/mozbuild/mozbuild/frontend/emitter.py
testing/mozbase/manifestparser/manifestparser/manifestparser.py
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -1041,18 +1041,19 @@ class RecursiveMakeBackend(CommonBackend
         else:
             backend_file.write('SIMPLE_PROGRAMS += %s\n' % obj.program)
 
     def _process_host_simple_program(self, program, backend_file):
         backend_file.write('HOST_SIMPLE_PROGRAMS += %s\n' % program)
 
     def _process_test_manifest(self, obj, backend_file):
         # Much of the logic in this function could be moved to CommonBackend.
-        self.backend_input_files.add(mozpath.join(obj.topsrcdir,
-            obj.manifest_relpath))
+        for source in obj.source_relpaths:
+            self.backend_input_files.add(mozpath.join(obj.topsrcdir,
+                source))
 
         # Don't allow files to be defined multiple times unless it is allowed.
         # We currently allow duplicates for non-test files or test files if
         # the manifest is listed as a duplicate.
         for source, (dest, is_test) in obj.installs.items():
             try:
                 self._install_manifests['_test_files'].add_symlink(source, dest)
             except ValueError:
--- a/python/mozbuild/mozbuild/frontend/data.py
+++ b/python/mozbuild/mozbuild/frontend/data.py
@@ -636,34 +636,39 @@ class TestManifest(ContextDerived):
         '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',
 
+        # The relative paths to all source files for this manifest.
+        'source_relpaths',
+
         # If this manifest is a duplicate of another one, this is the
         # manifestparser.TestManifest of the other one.
         'dupe_manifest',
     )
 
     def __init__(self, context, path, manifest, flavor=None,
-            install_prefix=None, relpath=None, dupe_manifest=False):
+            install_prefix=None, relpath=None, sources=(),
+            dupe_manifest=False):
         ContextDerived.__init__(self, context)
 
         assert flavor in all_test_flavors()
 
         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.source_relpaths = sources
         self.dupe_manifest = dupe_manifest
         self.installs = {}
         self.pattern_installs = []
         self.tests = []
         self.external_installs = set()
         self.deferred_installs = set()
 
 
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -1268,27 +1268,30 @@ class TreeMetadataEmitter(LoggingMixin):
 
     def _process_test_manifest(self, context, info, manifest_path, mpmanifest):
         flavor, install_root, install_subdir, package_tests = info
 
         path = mozpath.normpath(mozpath.join(context.srcdir, manifest_path))
         manifest_dir = mozpath.dirname(path)
         manifest_reldir = mozpath.dirname(mozpath.relpath(path,
             context.config.topsrcdir))
+        manifest_sources = [mozpath.relpath(pth, context.config.topsrcdir)
+                            for pth in mpmanifest.source_files]
         install_prefix = mozpath.join(install_root, install_subdir)
 
         try:
             if not mpmanifest.tests:
                 raise SandboxValidationError('Empty test manifest: %s'
                     % path, context)
 
             defaults = mpmanifest.manifest_defaults[os.path.normpath(path)]
             obj = TestManifest(context, path, mpmanifest, flavor=flavor,
                 install_prefix=install_prefix,
                 relpath=mozpath.join(manifest_reldir, mozpath.basename(path)),
+                sources=manifest_sources,
                 dupe_manifest='dupe-manifest' in defaults)
 
             filtered = mpmanifest.tests
 
             # Jetpack add-on tests are expected to be generated during the
             # build process so they won't exist here.
             if flavor != 'jetpack-addon':
                 missing = [t['name'] for t in filtered if not os.path.exists(t['path'])]
--- a/testing/mozbase/manifestparser/manifestparser/manifestparser.py
+++ b/testing/mozbase/manifestparser/manifestparser/manifestparser.py
@@ -70,16 +70,17 @@ class ManifestParser(object):
                                 test objects. Callers are expected to manage per-manifest
                                 defaults themselves via the manifest_defaults member
                                 variable in this case.
         """
         self._defaults = defaults or {}
         self._ancestor_defaults = {}
         self.tests = []
         self.manifest_defaults = {}
+        self.source_files = set()
         self.strict = strict
         self.rootdir = rootdir
         self.relativeRoot = None
         self.finder = finder
         self._handle_defaults = handle_defaults
         if manifests:
             self.read(*manifests)
 
@@ -120,16 +121,17 @@ class ManifestParser(object):
         if isinstance(filename, string):
             # If we're using mercurial as our filesystem via a finder
             # during manifest reading, the getcwd() calls that happen
             # with abspath calls will not be meaningful, so absolute
             # paths are required.
             if self.finder:
                 assert os.path.isabs(filename)
             filename = os.path.abspath(filename)
+            self.source_files.add(filename)
             if self.finder:
                 fp = self.finder.get(filename)
             else:
                 fp = open(filename)
             here = os.path.dirname(filename)
         else:
             fp = filename
             filename = here = None