Bug 1338559 - Use the tier system to recurse for 'make check'; r?glandium draft
authorMike Shal <mshal@mozilla.com>
Fri, 03 Feb 2017 16:47:28 -0500
changeset 485396 5150167cdfe39ee0b998324b1f348509b192c1b2
parent 482882 e1a4314f8e6eae8bbc06394c14132a9c5011371b
child 546003 8327c6771e0e940dac2c92f5ab36073bb2fe1ff7
push id45717
push userbmo:mshal@mozilla.com
push dateThu, 16 Feb 2017 16:39:09 +0000
reviewersglandium
bugs1338559
milestone54.0a1
Bug 1338559 - Use the tier system to recurse for 'make check'; r?glandium This helps us avoid recursing over every directory when we only need to run 'make check' in a select few. MozReview-Commit-ID: BJ3hJBOneIz
config/baseconfig.mk
config/rules.mk
python/mozbuild/mozbuild/backend/recursivemake.py
--- a/config/baseconfig.mk
+++ b/config/baseconfig.mk
@@ -40,17 +40,17 @@ ifeq (a,$(firstword a$(subst /, ,$(srcdi
 $(error MSYS-style srcdir are not supported for Windows builds.)
 endif
 endif
 endif # WINNT
 
 ifndef INCLUDED_AUTOCONF_MK
 default::
 else
-TIERS := $(if $(MOZ_ARTIFACT_BUILDS),artifact )pre-export export $(if $(COMPILE_ENVIRONMENT),compile )misc libs tools
+TIERS := $(if $(MOZ_ARTIFACT_BUILDS),artifact )pre-export export $(if $(COMPILE_ENVIRONMENT),compile )misc libs tools$(if $(filter check recurse_check,$(MAKECMDGOALS)), check)
 endif
 
 # These defines are used to support the twin-topsrcdir model for comm-central.
 ifdef MOZILLA_SRCDIR
   MOZILLA_DIR = $(MOZILLA_SRCDIR)
 else
   MOZILLA_DIR = $(topsrcdir)
 endif
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -1546,22 +1546,16 @@ ifndef INCLUDED_DEBUGMAKE_MK #{
     include $(MOZILLA_DIR)/config/makefiles/debugmake.mk
   endif #}
 endif #}
 
 documentation:
 	@cd $(DEPTH)
 	$(DOXYGEN) $(DEPTH)/config/doxygen.cfg
 
-ifdef ENABLE_TESTS
-check::
-	$(LOOP_OVER_DIRS)
-endif
-
-
 FREEZE_VARIABLES = \
   CSRCS \
   CPPSRCS \
   EXPORTS \
   DIRS \
   LIBRARY \
   MODULE \
   $(NULL)
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -412,16 +412,17 @@ class RecursiveMakeBackend(CommonBackend
         self._traversal = RecursiveMakeTraversal()
         self._compile_graph = OrderedDefaultDict(set)
 
         self._no_skip = {
             'export': set(),
             'libs': set(),
             'misc': set(),
             'tools': set(),
+            'check': set(),
         }
 
     def summary(self):
         summary = super(RecursiveMakeBackend, self).summary()
         summary.extend('; {makefile_in:d} -> {makefile_out:d} Makefile',
                        makefile_in=self._makefile_in_count,
                        makefile_out=self._makefile_out_count)
         return summary
@@ -701,16 +702,17 @@ class RecursiveMakeBackend(CommonBackend
                 current = None
             return current, [], subdirs.dirs + subdirs.tests
 
         filters = [
             ('export', parallel_filter),
             ('libs', libs_filter),
             ('misc', parallel_filter),
             ('tools', tools_filter),
+            ('check', parallel_filter),
         ]
 
         root_deps_mk = Makefile()
 
         # Fill the dependencies for traversal of each tier.
         for tier, filter in filters:
             main, all_deps = \
                 self._traversal.compute_dependencies(filter)
@@ -843,30 +845,36 @@ class RecursiveMakeBackend(CommonBackend
                 obj.output_path = makefile
                 obj.input_path = makefile_in
                 obj.topsrcdir = backend_file.topsrcdir
                 obj.topobjdir = bf.environment.topobjdir
                 obj.config = bf.environment
                 self._create_makefile(obj, stub=stub)
                 with open(obj.output_path) as fh:
                     content = fh.read()
-                    # Skip every directory but those with a Makefile
-                    # containing a tools target, or XPI_PKGNAME or
-                    # INSTALL_EXTENSION_ID.
+                    # Directories with a Makefile containing a tools target, or
+                    # XPI_PKGNAME or INSTALL_EXTENSION_ID can't be skipped and
+                    # must run during the 'tools' tier.
                     for t in (b'XPI_PKGNAME', b'INSTALL_EXTENSION_ID',
                             b'tools'):
                         if t not in content:
                             continue
                         if t == b'tools' and not re.search('(?:^|\s)tools.*::', content, re.M):
                             continue
                         if objdir == self.environment.topobjdir:
                             continue
                         self._no_skip['tools'].add(mozpath.relpath(objdir,
                             self.environment.topobjdir))
 
+                    # Directories with a Makefile containing a check target
+                    # can't be skipped and must run during the 'check' tier.
+                    if re.search('(?:^|\s)check.*::', content, re.M):
+                        self._no_skip['check'].add(mozpath.relpath(objdir,
+                            self.environment.topobjdir))
+
                     # Detect any Makefile.ins that contain variables on the
                     # moz.build-only list
                     self._check_blacklisted_variables(makefile_in, content)
 
         self._fill_root_mk()
 
         # Make the master test manifest files.
         for flavor, t in self._test_manifests.items():