Bug 1250961 - Move testing/mochitest/Makefile.in to moz.build. r=gps
authorChris Manchester <cmanchester@mozilla.com>
Fri, 26 Feb 2016 13:20:31 -0800
changeset 322244 9b1dd851e86ffff396ec48703a4ff057319052c2
parent 322243 542d4cda794bb670b1483e9151c34fb06b8ce8fb
child 322245 c24b8d2ceb0705bfddbc9cfd324e9c1bf1be1d64
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1250961
milestone47.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 1250961 - Move testing/mochitest/Makefile.in to moz.build. r=gps MozReview-Commit-ID: LwQH49FLfY2
python/mozbuild/mozbuild/action/test_archive.py
testing/mochitest/Makefile.in
testing/testsuite-targets.mk
--- a/python/mozbuild/mozbuild/action/test_archive.py
+++ b/python/mozbuild/mozbuild/action/test_archive.py
@@ -20,16 +20,62 @@ from mozbuild.util import ensureParentDi
 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')
 
+TEST_HARNESS_BINS = [
+    'BadCertServer',
+    'GenerateOCSPResponse',
+    'OCSPStaplingServer',
+    'SmokeDMD',
+    'certutil',
+    'crashinject',
+    'fileid',
+    'minidumpwriter',
+    'pk12util',
+    'screenshot',
+    'screentopng',
+    'ssltunnel',
+    'xpcshell',
+]
+
+# The fileid utility depends on mozglue. See bug 1069556.
+TEST_HARNESS_DLLS = [
+    'crashinjectdll',
+    'mozglue'
+]
+
+TEST_PLUGIN_DLLS = [
+    'npctrltest',
+    'npsecondtest',
+    'npswftest',
+    'nptest',
+    'nptestjava',
+    'npthirdtest',
+]
+
+TEST_PLUGIN_DIRS = [
+    'JavaTest.plugin/**',
+    'SecondTest.plugin/**',
+    'Test.plugin/**',
+    'ThirdTest.plugin/**',
+    'npctrltest.plugin/**',
+    'npswftest.plugin/**',
+]
+
+GMP_TEST_PLUGIN_DIRS = [
+    'gmp-clearkey/**',
+    'gmp-fake/**',
+    'gmp-fakeopenh264/**',
+]
+
 
 ARCHIVE_FILES = {
     'common': [
         {
             'source': STAGE,
             'base': '',
             'pattern': '**',
             'ignore': [
@@ -115,16 +161,72 @@ ARCHIVE_FILES = {
             'dest': 'tps/tests',
         },
         {
             'source': buildconfig.topsrcdir,
             'base': 'testing/web-platform/tests/tools/wptserve',
             'pattern': '**',
             'dest': 'tools/wptserve',
         },
+        {
+            'source': buildconfig.topobjdir,
+            'base': 'dist/bin',
+            'patterns': [
+                '%s%s' % (f, buildconfig.substs['BIN_SUFFIX'])
+                for f in TEST_HARNESS_BINS
+            ] + [
+                '%s%s%s' % (buildconfig.substs['DLL_PREFIX'], f, buildconfig.substs['DLL_SUFFIX'])
+                for f in TEST_HARNESS_DLLS
+            ],
+            'dest': 'bin',
+        },
+        {
+            'source': buildconfig.topobjdir,
+            'base': 'dist/plugins',
+            'patterns': [
+                '%s%s%s' % (buildconfig.substs['DLL_PREFIX'], f, buildconfig.substs['DLL_SUFFIX'])
+                for f in TEST_PLUGIN_DLLS
+            ],
+            'dest': 'bin/plugins',
+        },
+        {
+            'source': buildconfig.topobjdir,
+            'base': 'dist/plugins',
+            'patterns': TEST_PLUGIN_DIRS,
+            'dest': 'bin/plugins',
+        },
+        {
+            'source': buildconfig.topobjdir,
+            'base': 'dist/bin',
+            'patterns': GMP_TEST_PLUGIN_DIRS,
+            'dest': 'bin/plugins',
+        },
+        {
+            'source': buildconfig.topobjdir,
+            'base': 'dist/bin',
+            'patterns': [
+                'dmd.py',
+                'fix_linux_stack.py',
+                'fix_macosx_stack.py',
+                'fix_stack_using_bpsyms.py',
+            ],
+            'dest': 'bin',
+        },
+        {
+            'source': buildconfig.topobjdir,
+            'base': 'dist/bin/components',
+            'pattern': 'test_necko.xpt',
+            'dest': 'bin/components',
+        },
+        {
+            'source': buildconfig.topsrcdir,
+            'base': 'build/pgo/certs',
+            'pattern': '**',
+            'dest': 'certs',
+        }
     ],
     'cppunittest': [
         {
             'source': STAGE,
             'base': '',
             'pattern': 'cppunittest/**',
         },
         # We don't ship these files if startup cache is disabled, which is
@@ -173,16 +275,22 @@ ARCHIVE_FILES = {
             'base': '_tests/testing',
             'pattern': 'mochitest/**',
         },
         {
             'source': STAGE,
             'base': '',
             'pattern': 'mochitest/**',
         },
+        {
+            'source': buildconfig.topobjdir,
+            'base': '',
+            'pattern': 'mozinfo.json',
+            'dest': 'mochitest'
+        }
     ],
     'mozharness': [
         {
             'source': buildconfig.topsrcdir,
             'base': 'testing',
             'pattern': 'mozharness/**',
         },
     ],
@@ -265,33 +373,37 @@ for k, v in ARCHIVE_FILES.items():
         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.get('base', '')
         pattern = entry.get('pattern')
+        patterns = entry.get('patterns', [])
+        if pattern:
+            patterns.append(pattern)
         dest = entry.get('dest')
         ignore = list(entry.get('ignore', []))
         ignore.append('**/.mkdir.done')
         ignore.append('**/*.pyc')
 
         common_kwargs = {
             'find_executables': False,
             'find_dotfiles': True,
             'ignore': ignore,
         }
 
         finder = FileFinder(os.path.join(source, base), **common_kwargs)
 
-        for p, f in finder.find(pattern):
-            if dest:
-                p = mozpath.join(dest, p)
-            yield p, f
+        for pattern in patterns:
+            for p, f in finder.find(pattern):
+                if dest:
+                    p = mozpath.join(dest, p)
+                yield p, f
 
 
 def find_reftest_dirs(topsrcdir, manifests):
     from reftest import ReftestManifest
 
     dirs = set()
     for p in manifests:
         m = ReftestManifest()
--- a/testing/mochitest/Makefile.in
+++ b/testing/mochitest/Makefile.in
@@ -10,101 +10,16 @@ include $(topsrcdir)/config/rules.mk
 # We're installing to _tests/testing/mochitest, so this is the depth
 # necessary for relative objdir paths.
 TARGET_DEPTH = ../../..
 include $(topsrcdir)/build/automation-build.mk
 
 libs:: 
 	(cd $(DIST)/xpi-stage && tar $(TAR_CREATE_FLAGS) - mochijar) | (cd $(_DEST_DIR) && tar -xf -)
 
-# Binaries and scripts that don't get packaged with the build,
-# but that we need for the test harness
-TEST_HARNESS_BINS := \
-  xpcshell$(BIN_SUFFIX) \
-  ssltunnel$(BIN_SUFFIX) \
-  fileid$(BIN_SUFFIX) \
-  certutil$(BIN_SUFFIX) \
-  pk12util$(BIN_SUFFIX) \
-  BadCertServer$(BIN_SUFFIX) \
-  OCSPStaplingServer$(BIN_SUFFIX) \
-  GenerateOCSPResponse$(BIN_SUFFIX) \
-  fix_stack_using_bpsyms.py \
-  $(NULL)
-
-ifeq ($(OS_ARCH),WINNT)
-TEST_HARNESS_BINS += \
-  crashinject$(BIN_SUFFIX) \
-  crashinjectdll$(DLL_SUFFIX) \
-  minidumpwriter$(BIN_SUFFIX) \
-  $(NULL)
-endif
-
-# The fileid utility depends on mozglue. See bug 1069556.
-ifeq ($(OS_ARCH),Darwin)
-TEST_HARNESS_BINS += \
-  fix_macosx_stack.py \
-  $(DLL_PREFIX)mozglue$(DLL_SUFFIX)
-endif
-
-ifeq ($(OS_ARCH),Linux)
-TEST_HARNESS_BINS += fix_linux_stack.py
-endif
-
-ifdef MOZ_X11
-ifneq (,$(filter gtk%,$(MOZ_WIDGET_TOOLKIT)))
-TEST_HARNESS_BINS += screentopng
-endif
-endif
-
-ifeq (windows,$(MOZ_WIDGET_TOOLKIT))
-TEST_HARNESS_BINS += screenshot$(BIN_SUFFIX)
-endif
-
-ifdef MOZ_DMD
-TEST_HARNESS_BINS += \
-  dmd.py \
-  SmokeDMD$(BIN_SUFFIX) \
-  $(NULL)
-endif
-
-# Components / typelibs that don't get packaged with
-# the build, but that we need for the test harness.
-TEST_HARNESS_COMPONENTS := \
-  test_necko.xpt \
-  $(NULL)
-
-# We need the test plugin as some tests rely on it
-ifeq (Darwin,$(OS_TARGET))
-TEST_HARNESS_PLUGINS := \
-  Test.plugin/ \
-  SecondTest.plugin/ \
-  ThirdTest.plugin/ \
-  npswftest.plugin/ \
-  npctrltest.plugin/ \
-  JavaTest.plugin/
-else
-TEST_HARNESS_PLUGINS := \
-  $(DLL_PREFIX)nptest$(DLL_SUFFIX) \
-  $(DLL_PREFIX)npsecondtest$(DLL_SUFFIX) \
-  $(DLL_PREFIX)npthirdtest$(DLL_SUFFIX) \
-  $(DLL_PREFIX)nptestjava$(DLL_SUFFIX) \
-  $(DLL_PREFIX)npswftest$(DLL_SUFFIX) \
-  $(DLL_PREFIX)npctrltest$(DLL_SUFFIX)
-endif
-
-# Rules for staging the necessary harness bits for a test package
-PKG_STAGE = $(DIST)/test-stage
-DIST_BIN = $(DIST)/bin
-
-GMP_TEST_PLUGIN_DIRS := \
-  $(DIST_BIN)/gmp-fake \
-  $(DIST_BIN)/gmp-fakeopenh264 \
-  $(DIST_BIN)/gmp-clearkey \
-  $(NULL)
-
 $(_DEST_DIR):
 	$(NSINSTALL) -D $@
 
 # On Android only, include a release signed Robocop APK in the test package.
 ifeq ($(MOZ_BUILD_APP),mobile/android)
 include $(topsrcdir)/config/android-common.mk
 
 ifndef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE
@@ -114,18 +29,8 @@ robocop_apk := $(topobjdir)/gradle/build
 endif
 
 stage-package-android:
 	$(NSINSTALL) -D $(_DEST_DIR)
 	$(call RELEASE_SIGN_ANDROID_APK,$(robocop_apk),$(_DEST_DIR)/robocop.apk)
 
 stage-package: stage-package-android
 endif
-
-stage-package:
-	$(NSINSTALL) -D $(PKG_STAGE)/mochitest && $(NSINSTALL) -D $(PKG_STAGE)/bin/plugins && $(NSINSTALL) -D $(DIST)/plugins
-	cp $(DEPTH)/mozinfo.json $(PKG_STAGE)/mochitest
-	@cp $(DEPTH)/mozinfo.json $(PKG_STAGE)/mochitest
-	@(cd $(DIST_BIN) && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_BINS)) | (cd $(PKG_STAGE)/bin && tar -xf -)
-	@(cd $(DIST_BIN)/components && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_COMPONENTS)) | (cd $(PKG_STAGE)/bin/components && tar -xf -)
-	(cd $(topsrcdir)/build/pgo && tar $(TAR_CREATE_FLAGS) - certs) | (cd $(PKG_STAGE) && tar -xf -)
-	@(cd $(DIST)/plugins && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_PLUGINS)) | (cd $(PKG_STAGE)/bin/plugins && tar -xf -)
-	$(foreach x,$(GMP_TEST_PLUGIN_DIRS),cp -RL $(x) $(PKG_STAGE)/bin/plugins;)
--- a/testing/testsuite-targets.mk
+++ b/testing/testsuite-targets.mk
@@ -271,18 +271,18 @@ stage-config: make-stage-dir
 	@(cd $(topsrcdir)/testing/config && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/config && tar -xf -)
 
 stage-mach: make-stage-dir
 	@(cd $(topsrcdir)/python/mach && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/tools/mach && tar -xf -)
 	cp $(topsrcdir)/testing/tools/mach_test_package_bootstrap.py $(PKG_STAGE)/tools/mach_bootstrap.py
 	cp $(topsrcdir)/mach $(PKG_STAGE)
 
 stage-mochitest: make-stage-dir
+ifeq ($(MOZ_BUILD_APP),mobile/android)
 	$(MAKE) -C $(DEPTH)/testing/mochitest stage-package
-ifeq ($(MOZ_BUILD_APP),mobile/android)
 	$(NSINSTALL) $(DEPTH)/mobile/android/base/fennec_ids.txt $(PKG_STAGE)/mochitest
 endif
 
 stage-xpcshell: make-stage-dir
 	$(MAKE) -C $(DEPTH)/testing/xpcshell stage-package
 
 stage-jstests: make-stage-dir
 	$(MAKE) -C $(DEPTH)/js/src/tests stage-package