bug 421611 - need to be able to run tests on an arbitrary build. add a package target for mochitest. r=bsmedberg
authorTed Mielczarek <ted.mielczarek@gmail.com>
Mon, 02 Feb 2009 08:53:24 -0500
changeset 24527 078ad879e689a1259ff016d64635e36b3858e622
parent 24526 ad08e07cb8e6eac1b38c11540fb87d13388be5db
child 24528 35108a6dd8a8096ddaa0592f85d95296434e33a7
push id5091
push usertmielczarek@mozilla.com
push dateMon, 02 Feb 2009 13:54:22 +0000
treeherdermozilla-central@078ad879e689 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs421611
milestone1.9.2a1pre
bug 421611 - need to be able to run tests on an arbitrary build. add a package target for mochitest. r=bsmedberg
testing/mochitest/Makefile.in
testing/testsuite-targets.mk
toolkit/mozapps/installer/package-name.mk
toolkit/mozapps/installer/packager.mk
--- a/testing/mochitest/Makefile.in
+++ b/testing/mochitest/Makefile.in
@@ -141,8 +141,45 @@ runtests.py: runtests.py.in
 automation.py: $(topsrcdir)/build/pgo/automation.py.in
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
 	$(TEST_DRIVER_PPARGS) $(DEFINES) $(ACDEFINES) $^ > $@
 
 GARBAGE += runtests.py automation.py
 
 libs:: $(_SERV_FILES)
 	$(INSTALL) $^ $(_DEST_DIR)
+
+# Binaries 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) \
+  certutil$(BIN_SUFFIX) \
+  pk12util$(BIN_SUFFIX) \
+  $(NULL)
+
+# 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/
+else
+TEST_HARNESS_PLUGINS := \
+  $(DLL_PREFIX)nptest$(DLL_SUFFIX)
+endif
+
+# Rules for staging the necessary harness bits for a test package
+PKG_STAGE = $(DIST)/test-package-stage
+
+stage-package:
+	$(NSINSTALL) -D $(PKG_STAGE)/mochitest && $(NSINSTALL) -D $(PKG_STAGE)/plugins
+	@(cd $(DEPTH)/_tests/testing/mochitest/ && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/mochitest && tar -xf -)
+	@(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/certs && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/certs && tar -xf -)
+ifdef MOZ_PLUGINS
+	@(cd $(DIST)/bin/plugins && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_PLUGINS)) | (cd $(PKG_STAGE)/plugins && tar -xf -)
+endif
--- a/testing/testsuite-targets.mk
+++ b/testing/testsuite-targets.mk
@@ -65,9 +65,24 @@ mochitest-plain:
 mochitest-chrome:
 	$(RUN_MOCHITEST) --chrome $(MOCHITEST_PATH)
 	$(CHECK_TEST_ERROR)
 
 mochitest-a11y:
 	$(RUN_MOCHITEST) --a11y $(MOCHITEST_PATH)
 	$(CHECK_TEST_ERROR)
 
-.PHONY: mochitest mochitest-plain mochitest-chrome mochitest-a11y
+# Package up the tests and test harnesses
+include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
+
+PKG_STAGE = $(DIST)/test-package-stage
+
+package-tests: stage-mochitest
+	@(cd $(PKG_STAGE) && tar $(TAR_CREATE_FLAGS) - *) | bzip2 -f > $(DIST)/$(PKG_PATH)$(TEST_PACKAGE)
+
+make-stage-dir:
+	rm -rf $(PKG_STAGE) && $(NSINSTALL) -D $(PKG_STAGE) && $(NSINSTALL) -D $(PKG_STAGE)/bin && $(NSINSTALL) -D $(PKG_STAGE)/bin/components && $(NSINSTALL) -D $(PKG_STAGE)/certs
+
+stage-mochitest: make-stage-dir
+	$(MAKE) -C $(DEPTH)/testing/mochitest stage-package
+
+.PHONY: mochitest mochitest-plain mochitest-chrome mochitest-a11y \
+  package-tests make-stage-dir stage-mochitest
--- a/toolkit/mozapps/installer/package-name.mk
+++ b/toolkit/mozapps/installer/package-name.mk
@@ -142,8 +142,10 @@ PKG_UPDATE_PATH = update/$(PKG_PATH)
 COMPLETE_MAR = $(PKG_UPDATE_PATH)$(PKG_UPDATE_BASENAME).complete.mar
 PKG_LANGPACK_BASENAME = $(AB_CD)
 PKG_LANGPACK_PATH = $(MOZ_PKG_PLATFORM)/xpi/
 LANGPACK = $(PKG_LANGPACK_PATH)$(PKG_LANGPACK_BASENAME).xpi
 PKG_SRCPACK_BASENAME = $(MOZ_PKG_APPNAME_LC)-$(MOZ_PKG_VERSION).source
 PKG_SRCPACK_PATH = source/
 
 endif # MOZ_PKG_PRETTYNAMES
+
+TEST_PACKAGE = $(PKG_BASENAME).tests.tar.bz2
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -489,19 +489,20 @@ endif
 # in their filenames and GNU Make's $(wildcard) function doesn't properly
 # deal with them.
 empty :=
 space = $(empty) $(empty)
 QUOTED_WILDCARD = $(if $(wildcard $(subst $(space),?,$(1))),"$(1)")
 
 upload:
 	$(PYTHON) $(topsrcdir)/build/upload.py --base-path $(DIST) \
-    	$(call QUOTED_WILDCARD,$(DIST)/$(PACKAGE)) \
+		$(call QUOTED_WILDCARD,$(DIST)/$(PACKAGE)) \
 		$(call QUOTED_WILDCARD,$(INSTALLER_PACKAGE)) \
 		$(call QUOTED_WILDCARD,$(DIST)/$(COMPLETE_MAR)) \
+		$(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(TEST_PACKAGE)) \
 		$(if $(UPLOAD_EXTRA_FILES), $(foreach f, $(UPLOAD_EXTRA_FILES), $(wildcard $(DIST)/$(f))))
 
 ifndef MOZ_PKG_SRCDIR
 MOZ_PKG_SRCDIR = $(topsrcdir)
 endif
 
 CREATE_SOURCE_TAR = $(TAR) -c --owner=0 --group=0 --numeric-owner \
   --mode="go-w" --exclude=".hg*" --exclude="CVS" --exclude=".cvs*" -f