Backed out changeset 2912b402523d (bug 968245) for multiple test failures; CLOSED TREE
authorEd Morley <emorley@mozilla.com>
Tue, 25 Feb 2014 17:05:52 +0000
changeset 170766 0a53f6e5853d364a789bb0dd804c6825935f560f
parent 170765 9a8a8a73df7136fd6fa01a54db441b89bcbe1df3
child 170767 df11c3ce02de8e4c3a2257e568209b8e1595802b
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
bugs968245
milestone30.0a1
backs out2912b402523d8dce3afa51c7100e73b11a01d476
Backed out changeset 2912b402523d (bug 968245) for multiple test failures; CLOSED TREE
configure.in
python/mozbuild/mozbuild/backend/common.py
python/mozbuild/mozbuild/config_status.py
python/mozbuild/mozbuild/mozinfo.py
python/mozbuild/mozbuild/test/backend/common.py
python/mozbuild/mozbuild/test/backend/data/mozinfo/moz.build
python/mozbuild/mozbuild/test/backend/test_recursivemake.py
--- a/configure.in
+++ b/configure.in
@@ -9069,14 +9069,16 @@ if ! test -e js; then
     mkdir js
 fi
 
 AC_OUTPUT_SUBDIRS(js/src)
 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
 
 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
 
+export WRITE_MOZINFO=1
 dnl we need to run config.status after js/src subconfigure because we're
 dnl traversing its moz.build and we need its config.status for that.
 dnl However, writing our own config.status needs to happen before
 dnl subconfigures because the setup surrounding subconfigures alters
 dnl many AC_SUBSTed variables.
 MOZ_RUN_CONFIG_STATUS()
+unset WRITE_MOZINFO
--- a/python/mozbuild/mozbuild/backend/common.py
+++ b/python/mozbuild/mozbuild/backend/common.py
@@ -20,17 +20,17 @@ from ..frontend.data import (
     GeneratedWebIDLFile,
     PreprocessedTestWebIDLFile,
     PreprocessedWebIDLFile,
     TestManifest,
     TestWebIDLFile,
     XPIDLFile,
     WebIDLFile,
 )
-from ..mozinfo import write_mozinfo
+
 from ..util import DefaultOnReadDict
 
 
 class XPIDLManager(object):
     """Helps manage XPCOM IDLs in the context of the build system."""
     def __init__(self, config):
         self.config = config
         self.topsrcdir = config.topsrcdir
@@ -167,18 +167,16 @@ class CommonBackend(BuildBackend):
     """Holds logic common to all build backends."""
 
     def _init(self):
         self._idl_manager = XPIDLManager(self.environment)
         self._test_manager = TestManager(self.environment)
         self._webidls = WebIDLCollection()
         self._configs = set()
 
-        self._write_mozinfo = True # For testing
-
     def consume_object(self, obj):
         self._configs.add(obj.config)
 
         if isinstance(obj, TestManifest):
             for test in obj.tests:
                 self._test_manager.add(test, flavor=obj.flavor,
                     topsrcdir=obj.topsrcdir)
 
@@ -234,23 +232,16 @@ class CommonBackend(BuildBackend):
         if len(self._idl_manager.idls):
             self._handle_idl_manager(self._idl_manager)
 
         self._handle_webidl_collection(self._webidls)
 
         for config in self._configs:
             self.backend_input_files.add(config.source)
 
-        # Write out a JSON file used by test harnesses, other parts of
-        # automation.
-        if self._write_mozinfo and 'JS_STANDALONE' not in self.environment.substs:
-            path = mozpath.join(self.environment.topobjdir, 'mozinfo.json')
-            with self._write_file(path) as fh:
-                write_mozinfo(fh, self.environment, os.environ)
-
         # Write out a machine-readable file describing every test.
         path = mozpath.join(self.environment.topobjdir, 'all-tests.json')
         with self._write_file(path) as fh:
             json.dump(self._test_manager.tests_by_path, fh, sort_keys=True,
                 indent=2)
 
     def _create_config_header(self, obj):
         '''Creates the given config header. A config header is generated by
--- a/python/mozbuild/mozbuild/config_status.py
+++ b/python/mozbuild/mozbuild/config_status.py
@@ -15,16 +15,17 @@ import sys
 from optparse import OptionParser
 
 from mach.logging import LoggingManager
 from mozbuild.backend.configenvironment import ConfigEnvironment
 from mozbuild.backend.recursivemake import RecursiveMakeBackend
 from mozbuild.base import MachCommandConditions
 from mozbuild.frontend.emitter import TreeMetadataEmitter
 from mozbuild.frontend.reader import BuildReader
+from mozbuild.mozinfo import write_mozinfo
 
 
 log_manager = LoggingManager()
 
 
 ANDROID_ECLIPSE_ADVERTISEMENT = '''
 =============
 ADVERTISEMENT
@@ -101,16 +102,21 @@ def config_status(topobjdir='.', topsrcd
 
     # Without -n, the current directory is meant to be the top object directory
     if not options.not_topobjdir:
         topobjdir = os.path.abspath('.')
 
     env = ConfigEnvironment(topsrcdir, topobjdir, defines=defines,
             non_global_defines=non_global_defines, substs=substs, source=source)
 
+    # mozinfo.json only needs written if configure changes and configure always
+    # passes this environment variable.
+    if 'WRITE_MOZINFO' in os.environ:
+        write_mozinfo(os.path.join(topobjdir, 'mozinfo.json'), env, os.environ)
+
     # Make an appropriate backend instance, defaulting to RecursiveMakeBackend.
     backend_cls = RecursiveMakeBackend
     if options.backend == 'AndroidEclipse':
         from mozbuild.backend.android_eclipse import AndroidEclipseBackend
         if not MachCommandConditions.is_android(env):
             raise Exception('The Android Eclipse backend is not available with this configuration.')
         backend_cls = AndroidEclipseBackend
     elif options.backend == 'VisualStudio':
--- a/python/mozbuild/mozbuild/mozinfo.py
+++ b/python/mozbuild/mozbuild/mozinfo.py
@@ -93,14 +93,13 @@ def build_dict(config, env=os.environ):
 def write_mozinfo(file, config, env=os.environ):
     """Write JSON data about the configuration specified in config and an
     environment variable dict to |file|, which may be a filename or file-like
     object.
     See build_dict for information about what  environment variables are used,
     and what keys are produced.
     """
     build_conf = build_dict(config, env)
-    args = {'indent': 2, 'sort_keys': True}
     if isinstance(file, basestring):
         with open(file, "w") as f:
-            json.dump(build_conf, f, **args)
+            json.dump(build_conf, f)
     else:
-        json.dump(build_conf, file, **args)
+        json.dump(build_conf, file)
--- a/python/mozbuild/mozbuild/test/backend/common.py
+++ b/python/mozbuild/mozbuild/test/backend/common.py
@@ -63,28 +63,16 @@ CONFIGS = DefaultOnReadDict({
     },
     'visual-studio': {
         'defines': [],
         'non_global_defines': [],
         'substs': [
             ('MOZ_APP_NAME', 'my_app'),
         ],
     },
-    'mozinfo': {
-        'defines': [],
-        'non_global_defines': [],
-        'substs': [
-            ('WRITE_MOZINFO', '1'),
-
-            # Some variables required for mozinfo generation.
-            ('TARGET_CPU', 'dummy'),
-            ('OS_TARGET', 'dummy'),
-            ('MOZ_WIDGET_TOOLKIT', 'dummy'),
-        ],
-    },
 }, global_default={
     'defines': [],
     'non_global_defines': [],
     'substs': [],
 })
 
 
 class BackendTester(unittest.TestCase):
@@ -105,22 +93,19 @@ class BackendTester(unittest.TestCase):
 
     def _emit(self, name, env=None):
         env = env or self._get_environment(name)
         reader = BuildReader(env)
         emitter = TreeMetadataEmitter(env)
 
         return env, emitter.emit(reader.read_topsrcdir())
 
-    def _consume(self, name, cls, env=None, write_mozinfo=False):
+    def _consume(self, name, cls, env=None):
         env, objs = self._emit(name, env=env)
         backend = cls(env)
-        # Don't write mozinfo.json by default since it requires certain
-        # environment variables.
-        backend._write_mozinfo = write_mozinfo
         backend.consume(objs)
 
         return env
 
     def _tree_paths(self, topdir, filename):
         for dirpath, dirnames, filenames in os.walk(topdir):
             for f in filenames:
                 if f == filename:
deleted file mode 100644
--- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
+++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
@@ -225,17 +225,16 @@ class TestRecursiveMakeBackend(BackendTe
         makefile_path = mozpath.join(env.topobjdir, 'Makefile')
         backend_path = mozpath.join(env.topobjdir, 'backend.mk')
         makefile_mtime = os.path.getmtime(makefile_path)
         backend_mtime = os.path.getmtime(backend_path)
 
         reader = BuildReader(env)
         emitter = TreeMetadataEmitter(env)
         backend = RecursiveMakeBackend(env)
-        backend._write_mozinfo = False
         backend.consume(emitter.emit(reader.read_topsrcdir()))
 
         self.assertEqual(os.path.getmtime(makefile_path), makefile_mtime)
         self.assertEqual(os.path.getmtime(backend_path), backend_mtime)
 
     def test_substitute_config_files(self):
         """Ensure substituted config files are produced."""
         env = self._consume('substitute_config_files', RecursiveMakeBackend)
@@ -471,17 +470,16 @@ class TestRecursiveMakeBackend(BackendTe
 
         self.assertTrue(os.path.exists(manifest_path))
         self._consume('stub0', RecursiveMakeBackend, env)
         self.assertFalse(os.path.exists(manifest_path))
 
     def test_install_manifests_written(self):
         env, objs = self._emit('stub0')
         backend = RecursiveMakeBackend(env)
-        backend._write_mozinfo = False
 
         m = InstallManifest()
         backend._install_manifests['testing'] = m
         m.add_symlink(__file__, 'self')
         backend.consume(objs)
 
         man_dir = mozpath.join(env.topobjdir, '_build_manifests', 'install')
         self.assertTrue(os.path.isdir(man_dir))
@@ -670,17 +668,11 @@ class TestRecursiveMakeBackend(BackendTe
 
         self.assertIn('ANDROID_ECLIPSE_PROJECT_submain: subtarget1 subtarget2', lines)
 
         for project_name in ['submain', 'sublibrary']:
             # Destination and install manifest are relative to topobjdir.
             stem = '%s/android_eclipse/%s' % (env.topobjdir, project_name)
             self.assertIn(command_template % (stem, stem), lines)
 
-    def test_mozinfo(self):
-        env = self._consume('mozinfo', RecursiveMakeBackend, write_mozinfo=True)
-
-        self.assertTrue(os.path.exists(os.path.join(env.topobjdir,
-            'mozinfo.json')))
-
 
 if __name__ == '__main__':
     main()