Bug 1208320 - Produce common tests archive via Python; r=glandium
authorGregory Szorc <gps@mozilla.com>
Wed, 30 Sep 2015 17:38:53 -0700
changeset 286632 6d4afcd9ba64eaa8c2eec65a201957db02690511
parent 286631 ca68c9413276cba0f9c934fde56c9d4c5f7883b5
child 286633 8957d96ac8f87af30b329532f13bc35df439d449
push id8654
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:48:40 +0000
treeherdermozilla-aurora@bc4551debe17 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1208320
milestone44.0a1
Bug 1208320 - Produce common tests archive via Python; r=glandium This doesn't change I/O or copy behavior at all. But it does remove a one-off make rule.
python/mozbuild/mozbuild/action/test_archive.py
testing/testsuite-targets.mk
--- a/python/mozbuild/mozbuild/action/test_archive.py
+++ b/python/mozbuild/mozbuild/action/test_archive.py
@@ -6,29 +6,45 @@
 #
 # Ideally, the data in this file should be defined in moz.build files.
 # It is defined inline because this was easiest to make test archive
 # generation faster.
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import argparse
+import itertools
 import os
 import sys
 
 from mozpack.files import FileFinder
 from mozpack.mozjar import JarWriter
 import mozpack.path as mozpath
 
 import buildconfig
 
 STAGE = mozpath.join(buildconfig.topobjdir, 'dist', 'test-stage')
 
 
 ARCHIVE_FILES = {
+    'common': [
+        {
+            'source': STAGE,
+            'base': '',
+            'pattern': '**',
+            'ignore': [
+                'cppunittest/**',
+                'mochitest/**',
+                'reftest/**',
+                'talos/**',
+                'web-platform/**',
+                'xpcshell/**',
+            ],
+        },
+    ],
     'mochitest': [
         {
             'source': buildconfig.topobjdir,
             'base': '_tests/testing',
             'pattern': 'mochitest/**',
         },
         {
             'source': STAGE,
@@ -74,16 +90,31 @@ ARCHIVE_FILES = {
             'source': STAGE,
             'base': '',
             'pattern': 'xpcshell/**',
         },
     ],
 }
 
 
+# "common" is our catch all archive and it ignores things from other archives.
+# Verify nothing sneaks into ARCHIVE_FILES without a corresponding exclusion
+# rule in the "common" archive.
+for k, v in ARCHIVE_FILES.items():
+    # Skip mozharness because it isn't staged.
+    if k in ('common', 'mozharness'):
+        continue
+
+    ignores = set(itertools.chain(*(e.get('ignore', [])
+                                  for e in ARCHIVE_FILES['common'])))
+
+    if not any(p.startswith('%s/' % k) for p in ignores):
+        raise Exception('"common" ignore list probably should contain %s' % k)
+
+
 def find_files(archive):
     for entry in ARCHIVE_FILES[archive]:
         source = entry['source']
         base = entry['base']
         pattern = entry['pattern']
         dest = entry.get('dest')
         ignore = list(entry.get('ignore', []))
         ignore.append('**/.mkdir.done')
--- a/testing/testsuite-targets.mk
+++ b/testing/testsuite-targets.mk
@@ -393,16 +393,17 @@ stage-all: stage-steeplechase
 endif
 
 TEST_PKGS := \
   cppunittest \
   reftest \
   $(NULL)
 
 PYTHON_TEST_PKGS := \
+  common \
   mochitest \
   talos \
   web-platform \
   xpcshell \
   $(NULL)
 
 ALL_TEST_PKGS := $(TEST_PKGS) $(PYTHON_TEST_PKGS)
 
@@ -432,22 +433,16 @@ package-tests-prepare-dest:
 	$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
 
 package-tests-mozharness: package-tests-prepare-dest
 	$(call py_action,test_archive, \
 		mozharness \
 		$(abspath $(DIST))/$(PKG_PATH)/mozharness.zip)
 package-tests: package-tests-mozharness
 
-package-tests-common: stage-all package-tests-prepare-dest
-	cd $(abspath $(PKG_STAGE)) && \
-	  zip -rq9D '$(abspath $(DIST))/$(PKG_PATH)$(TEST_PACKAGE)' \
-	  * -x \*/.mkdir.done \*.pyc $(foreach name,$(ALL_TEST_PKGS),$(name)\*)
-package-tests: package-tests-common
-
 define package_archive
 package-tests-$(1): stage-all package-tests-prepare-dest
 	rm -f '$$(DIST)/$$(PKG_PATH)$$(PKG_BASENAME).$(1).tests.zip' && \
 		cd $$(abspath $(PKG_STAGE)) && \
 		zip -rq9D '$$(abspath $$(DIST))/$$(PKG_PATH)$$(PKG_BASENAME).$(1).tests.zip' \
 		$(1) -x \*/.mkdir.done \*.pyc ;
 .PHONY += package-tests-$(1)
 package-tests: package-tests-$(1)