Bug 1345109 - Delete 'JS_STANDALONE' from EmptyConfig when generating test metadata, r=mshal
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 07 Mar 2017 10:56:22 -0500
changeset 346543 2324b5d27792b17e19afe42d70c224deb52565aa
parent 346542 233d22402d7a65be5e9ac62141189ed70d182b88
child 346544 0a4073b4e2c29fc7890f5922075c0f25dfbba8ec
push id31471
push userkwierso@gmail.com
push dateThu, 09 Mar 2017 00:43:50 +0000
treeherdermozilla-central@193989276571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs1345109
milestone55.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 1345109 - Delete 'JS_STANDALONE' from EmptyConfig when generating test metadata, r=mshal EmptyConfig objects set JS_STANDALONE=1 by default. However, test tasks that need to run without an objdir need to be behind an "if not CONFIG['JS_STANDALONE']" condition to avoid causing bustage to sm-pkg task (js packaging). This patch explicitly deletes that default value, only when generating the TestManifestBackend. Ideally, the js/src packaging should have their own moz.build instead of re-using the root moz.build. But this is an easier fix in the short term to get the marionette-harness tests working again. MozReview-Commit-ID: 26lHLY6WlZK
build/gen_test_backend.py
moz.build
python/mozbuild/mozbuild/frontend/reader.py
--- a/build/gen_test_backend.py
+++ b/build/gen_test_backend.py
@@ -11,17 +11,24 @@ from mozbuild.frontend.reader import Bui
 
 
 def gen_test_backend():
     build_obj = MozbuildObject.from_environment()
     try:
         config = build_obj.config_environment
     except BuildEnvironmentNotFoundException:
         print("No build detected, test metadata may be incomplete.")
-        config = EmptyConfig(build_obj.topsrcdir)
+
+        # If 'JS_STANDALONE' is set, tests that don't require an objdir won't
+        # be picked up due to bug 1345209.
+        substs = EmptyConfig.default_substs
+        if 'JS_STANDALONE' in substs:
+            del substs['JS_STANDALONE']
+
+        config = EmptyConfig(build_obj.topsrcdir, substs)
         config.topobjdir = build_obj.topobjdir
 
     reader = BuildReader(config)
     emitter = TreeMetadataEmitter(config)
     backend = TestManifestBackend(config)
 
     context = reader.read_topsrcdir()
     data = emitter.emit(context, emitfn=emitter._process_test_manifests)
--- a/moz.build
+++ b/moz.build
@@ -21,16 +21,21 @@ if CONFIG['ENABLE_CLANG_PLUGIN']:
 DIRS += [
     'config',
     'python',
     'taskcluster',
     'testing/mozbase',
 ]
 
 if not CONFIG['JS_STANDALONE']:
+    # These python manifests are included here so they get picked up without an objdir
+    PYTHON_UNITTEST_MANIFESTS += [
+        'testing/marionette/harness/marionette_harness/tests/harness_unit/python.ini',
+    ]
+
     CONFIGURE_SUBST_FILES += [
         'tools/update-packaging/Makefile',
     ]
     CONFIGURE_DEFINE_FILES += [
         'mozilla-config.h',
     ]
     EXPORTS += [
         '!buildid.h',
@@ -80,17 +85,11 @@ if CONFIG['COMPILE_ENVIRONMENT']:
     DIRS += ['js/src']
 else:
     TEST_DIRS += ['js/src/tests']
 
 if not CONFIG['JS_STANDALONE'] and CONFIG['MOZ_BUILD_APP']:
     # Bring in the configuration for the configured application.
     include('/' + CONFIG['MOZ_BUILD_APP'] + '/app.mozbuild')
 
-if not CONFIG['JS_STANDALONE']:
-    # These python manifests are included here so they get picked up without an objdir
-    PYTHON_UNITTEST_MANIFESTS += [
-        'testing/marionette/harness/marionette_harness/tests/harness_unit/python.ini',
-    ]
-
 CONFIGURE_SUBST_FILES += ['.cargo/config']
 
 include('build/templates.mozbuild')
--- a/python/mozbuild/mozbuild/frontend/reader.py
+++ b/python/mozbuild/mozbuild/frontend/reader.py
@@ -108,31 +108,33 @@ class EmptyConfig(object):
         """A variation on ReadOnlyDefaultDict that populates during .get().
 
         This variation is needed because CONFIG uses .get() to access members.
         Without it, None (instead of our EmptyValue types) would be returned.
         """
         def get(self, key, default=None):
             return self[key]
 
-    def __init__(self, topsrcdir):
+    default_substs = {
+        # These 2 variables are used semi-frequently and it isn't worth
+        # changing all the instances.
+        b'MOZ_APP_NAME': b'empty',
+        b'MOZ_CHILD_PROCESS_NAME': b'empty',
+        # Set manipulations are performed within the moz.build files. But
+        # set() is not an exposed symbol, so we can't create an empty set.
+        b'NECKO_PROTOCOLS': set(),
+        # Needed to prevent js/src's config.status from loading.
+        b'JS_STANDALONE': b'1',
+    }
+
+    def __init__(self, topsrcdir, substs=None):
         self.topsrcdir = topsrcdir
         self.topobjdir = ''
 
-        self.substs = self.PopulateOnGetDict(EmptyValue, {
-            # These 2 variables are used semi-frequently and it isn't worth
-            # changing all the instances.
-            b'MOZ_APP_NAME': b'empty',
-            b'MOZ_CHILD_PROCESS_NAME': b'empty',
-            # Set manipulations are performed within the moz.build files. But
-            # set() is not an exposed symbol, so we can't create an empty set.
-            b'NECKO_PROTOCOLS': set(),
-            # Needed to prevent js/src's config.status from loading.
-            b'JS_STANDALONE': b'1',
-        })
+        self.substs = self.PopulateOnGetDict(EmptyValue, substs or self.default_substs)
         udict = {}
         for k, v in self.substs.items():
             if isinstance(v, str):
                 udict[k.decode('utf-8')] = v.decode('utf-8')
             else:
                 udict[k] = v
         self.substs_unicode = self.PopulateOnGetDict(EmptyValue, udict)
         self.defines = self.substs