Bug 1027215 - Add reftest manifests to build config; r=mshal
authorGregory Szorc <gps@mozilla.com>
Tue, 17 Jun 2014 17:59:03 -0700
changeset 211741 f6e2373c5b2a66472596f1b5d135e193982de8f6
parent 211740 ab997ac497a0bb14d6d91cddce91085a13275431
child 211742 2d9116d8711b89a6f88eb1ce5eba9813b0db326b
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs1027215
milestone33.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 1027215 - Add reftest manifests to build config; r=mshal reftest and crashtest manifests can now be added to the build configuration via REFTEST_MANIFESTS and CRASHTEST_MANIFESTS, respectively. The master manifest files have been added to layout/moz.build. This patch enables the deprecation of master reftest manifests but stops short of doing it. In the future, we could declare reftest and crashtest manifests in their nearest moz.build file and generate the master manifest (consisting of a bunch of "include" directives) as part of config.status.
layout/moz.build
python/mozbuild/mozbuild/backend/recursivemake.py
python/mozbuild/mozbuild/frontend/emitter.py
python/mozbuild/mozbuild/frontend/sandbox_symbols.py
python/mozbuild/mozbuild/test/frontend/data/test-manifest-keys-extracted/crashtest.list
python/mozbuild/mozbuild/test/frontend/data/test-manifest-keys-extracted/moz.build
python/mozbuild/mozbuild/test/frontend/data/test-manifest-keys-extracted/reftest.list
python/mozbuild/mozbuild/test/frontend/test_emitter.py
--- a/layout/moz.build
+++ b/layout/moz.build
@@ -29,8 +29,11 @@ DIRS += ['build', 'media']
 
 if CONFIG['MOZ_DEBUG']:
     TEST_DIRS += ['tools/layout-debug']
 
 MOCHITEST_MANIFESTS += [
     'reftests/fonts/mochitest.ini',
     'reftests/fonts/mplus/mochitest.ini',
 ]
+
+REFTEST_MANIFESTS += ['reftests/reftest.list']
+CRASHTEST_MANIFESTS += ['../testing/crashtest/crashtests.list']
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -8,16 +8,17 @@ import itertools
 import json
 import logging
 import os
 import types
 
 from collections import namedtuple
 
 import mozwebidlcodegen
+from reftest import ReftestManifest
 
 import mozbuild.makeutil as mozmakeutil
 from mozpack.copier import FilePurger
 from mozpack.manifests import (
     InstallManifest,
 )
 import mozpack.path as mozpath
 
@@ -1070,16 +1071,21 @@ class RecursiveMakeBackend(CommonBackend
             except ValueError:
                 if not obj.dupe_manifest:
                     raise
 
         m = self._test_manifests.setdefault(obj.flavor,
             (obj.install_prefix, set()))
         m[1].add(obj.manifest_obj_relpath)
 
+        if isinstance(obj.manifest, ReftestManifest):
+            # Mark included files as part of the build backend so changes
+            # result in re-config.
+            self.backend_input_files |= obj.manifest.manifests
+
     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))
 
     def _process_generated_include(self, generated_include, backend_file):
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -10,17 +10,17 @@ import os
 import traceback
 import sys
 import time
 
 from mach.mixin.logging import LoggingMixin
 
 import mozpack.path as mozpath
 import manifestparser
-
+import reftest
 import mozinfo
 
 from .data import (
     ConfigFileSubstitution,
     Defines,
     DirectoryTraversal,
     Exports,
     GeneratedEventWebIDLFile,
@@ -414,16 +414,21 @@ class TreeMetadataEmitter(LoggingMixin):
             XPCSHELL_TESTS=('xpcshell', 'xpcshell', '.', False),
         )
 
         for prefix, info in test_manifests.items():
             for path in sandbox.get('%s_MANIFESTS' % prefix, []):
                 for obj in self._process_test_manifest(sandbox, info, path):
                     yield obj
 
+        for flavor in ('crashtest', 'reftest'):
+            for path in sandbox.get('%s_MANIFESTS' % flavor.upper(), []):
+                for obj in self._process_reftest_manifest(sandbox, flavor, path):
+                    yield obj
+
         jar_manifests = sandbox.get('JAR_MANIFESTS', [])
         if len(jar_manifests) > 1:
             raise SandboxValidationError('While JAR_MANIFESTS is a list, '
                 'it is currently limited to one value.')
 
         for path in jar_manifests:
             yield JARManifest(sandbox, mozpath.join(sandbox['SRCDIR'], path))
 
@@ -596,16 +601,48 @@ class TreeMetadataEmitter(LoggingMixin):
                 obj.external_installs.add(mozpath.join(out_dir, f))
 
             yield obj
         except (AssertionError, Exception):
             raise SandboxValidationError('Error processing test '
                 'manifest file %s: %s' % (path,
                     '\n'.join(traceback.format_exception(*sys.exc_info()))))
 
+    def _process_reftest_manifest(self, sandbox, flavor, manifest_path):
+        manifest_path = mozpath.normpath(manifest_path)
+        manifest_full_path = mozpath.normpath(mozpath.join(
+            sandbox['SRCDIR'], manifest_path))
+        manifest_reldir = mozpath.dirname(mozpath.relpath(manifest_full_path,
+            sandbox['TOPSRCDIR']))
+
+        manifest = reftest.ReftestManifest()
+        manifest.load(manifest_full_path)
+
+        # reftest manifests don't come from manifest parser. But they are
+        # similar enough that we can use the same emitted objects. Note
+        # that we don't perform any installs for reftests.
+        obj = TestManifest(sandbox, manifest_full_path, manifest,
+                flavor=flavor, install_prefix='%s/' % flavor,
+                relpath=mozpath.join(manifest_reldir,
+                    mozpath.basename(manifest_path)))
+
+        for test in sorted(manifest.files):
+            obj.tests.append({
+                'path': test,
+                'here': mozpath.dirname(test),
+                'manifest': manifest_full_path,
+                'name': mozpath.basename(test),
+                'head': '',
+                'tail': '',
+                'support-files': '',
+                'subsuite': '',
+            })
+
+        yield obj
+
     def _emit_directory_traversal_from_sandbox(self, sandbox):
         o = DirectoryTraversal(sandbox)
         o.dirs = sandbox.get('DIRS', [])
         o.parallel_dirs = sandbox.get('PARALLEL_DIRS', [])
         o.tool_dirs = sandbox.get('TOOL_DIRS', [])
         o.test_dirs = sandbox.get('TEST_DIRS', [])
         o.test_tool_dirs = sandbox.get('TEST_TOOL_DIRS', [])
         o.is_tool_dir = sandbox.get('IS_TOOL_DIR', False)
--- a/python/mozbuild/mozbuild/frontend/sandbox_symbols.py
+++ b/python/mozbuild/mozbuild/frontend/sandbox_symbols.py
@@ -594,32 +594,44 @@ VARIABLES = {
     'A11Y_MANIFESTS': (StrictOrderingOnAppendList, list,
         """List of manifest files defining a11y tests.
         """, None),
 
     'BROWSER_CHROME_MANIFESTS': (StrictOrderingOnAppendList, list,
         """List of manifest files defining browser chrome tests.
         """, None),
 
+    'CRASHTEST_MANIFESTS': (StrictOrderingOnAppendList, list,
+        """List of manifest files defining crashtests.
+
+        These are commonly named crashtests.list.
+        """, None),
+
     'METRO_CHROME_MANIFESTS': (StrictOrderingOnAppendList, list,
         """List of manifest files defining metro browser chrome tests.
         """, None),
 
     'MOCHITEST_CHROME_MANIFESTS': (StrictOrderingOnAppendList, list,
         """List of manifest files defining mochitest chrome tests.
         """, None),
 
     'MOCHITEST_MANIFESTS': (StrictOrderingOnAppendList, list,
         """List of manifest files defining mochitest tests.
         """, None),
 
     'MOCHITEST_WEBAPPRT_CHROME_MANIFESTS': (StrictOrderingOnAppendList, list,
         """List of manifest files defining webapprt mochitest chrome tests.
         """, None),
 
+    'REFTEST_MANIFESTS': (StrictOrderingOnAppendList, list,
+        """List of manifest files defining reftests.
+
+        These are commonly named reftest.list.
+        """, None),
+
     'WEBRTC_SIGNALLING_TEST_MANIFESTS': (StrictOrderingOnAppendList, list,
         """List of manifest files defining WebRTC signalling tests.
         """, None),
 
     'XPCSHELL_TESTS_MANIFESTS': (StrictOrderingOnAppendList, list,
         """List of manifest files defining xpcshell tests.
         """, None),
 
new file mode 100644
--- /dev/null
+++ b/python/mozbuild/mozbuild/test/frontend/data/test-manifest-keys-extracted/crashtest.list
@@ -0,0 +1,1 @@
+== crashtest1.html crashtest1-ref.html
--- a/python/mozbuild/mozbuild/test/frontend/data/test-manifest-keys-extracted/moz.build
+++ b/python/mozbuild/mozbuild/test/frontend/data/test-manifest-keys-extracted/moz.build
@@ -2,8 +2,10 @@
 # http://creativecommons.org/publicdomain/zero/1.0/
 
 A11Y_MANIFESTS += ['a11y.ini']
 BROWSER_CHROME_MANIFESTS += ['browser.ini']
 METRO_CHROME_MANIFESTS += ['metro.ini']
 MOCHITEST_MANIFESTS += ['mochitest.ini']
 MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
 XPCSHELL_TESTS_MANIFESTS += ['xpcshell.ini']
+REFTEST_MANIFESTS += ['reftest.list']
+CRASHTEST_MANIFESTS += ['crashtest.list']
new file mode 100644
--- /dev/null
+++ b/python/mozbuild/mozbuild/test/frontend/data/test-manifest-keys-extracted/reftest.list
@@ -0,0 +1,1 @@
+== reftest1.html reftest1-ref.html
--- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py
+++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
@@ -374,17 +374,17 @@ class TestEmitterBasic(unittest.TestCase
 
     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)
+        self.assertEqual(len(objs), 8)
 
         metadata = {
             'a11y.ini': {
                 'flavor': 'a11y',
                 'installs': {
                     'a11y.ini': False,
                     'test_a11y.js': True,
                 },
@@ -431,16 +431,24 @@ class TestEmitterBasic(unittest.TestCase
                     'xpcshell.ini': False,
                     'test_xpcshell.js': True,
                     'head1': False,
                     'head2': False,
                     'tail1': False,
                     'tail2': False,
                 },
             },
+            'reftest.list': {
+                'flavor': 'reftest',
+                'installs': {},
+            },
+            'crashtest.list': {
+                'flavor': 'crashtest',
+                'installs': {},
+            },
         }
 
         for o in objs:
             m = metadata[mozpath.basename(o.manifest_relpath)]
 
             self.assertTrue(o.path.startswith(o.directory))
             self.assertEqual(o.flavor, m['flavor'])
             self.assertEqual(o.dupe_manifest, m.get('dupe', False))