Bug 793928: Ship the Add-on SDK APIs as part of the platform. r=gps
authorDave Townsend <dtownsend@oxymoronical.com>
Fri, 01 Feb 2013 11:20:17 -0800
changeset 130503 729d655f29f6fe09bd65ba1fe861b1051da480d4
parent 130502 a874d2756f6530a8ee7c8dc6dbcb7102944d5127
child 130504 fb6692f7e52183f619a64896aa0968116e7d7640
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
reviewersgps
bugs793928
milestone21.0a1
Bug 793928: Ship the Add-on SDK APIs as part of the platform. r=gps
.hgignore
addon-sdk/Makefile.in
addon-sdk/mach_commands.py
mach
testing/testsuite-targets.mk
testing/xpcshell/xpcshell.ini
toolkit/toolkit-makefiles.sh
toolkit/toolkit-tiers.mk
--- a/.hgignore
+++ b/.hgignore
@@ -46,8 +46,11 @@
 \.project$
 \.cproject$
 \.settings/
 
 # Python stuff installed at build time.
 ^python/psutil/.*\.so
 ^python/psutil/.*\.pyd
 ^python/psutil/build/
+
+# Git repositories
+.git/
new file mode 100644
--- /dev/null
+++ b/addon-sdk/Makefile.in
@@ -0,0 +1,40 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DEPTH     = @DEPTH@
+topsrcdir = @top_srcdir@
+srcdir    = @srcdir@
+VPATH     = @srcdir@
+
+include $(topsrcdir)/config/config.mk
+
+TEST_DIRS += test
+
+COMMONJS_FILES = \
+  source/lib/toolkit \
+  source/lib/sdk \
+  $(NULL)
+
+COMMONJS_DEST = $(FINAL_TARGET)/modules/commonjs
+INSTALL_TARGETS += COMMONJS
+
+include $(topsrcdir)/config/rules.mk
+
+TEST_FILES = \
+  source/app-extension \
+  source/bin \
+  source/data \
+  source/python-lib \
+  source/test \
+  source/package.json \
+  source/mapping.json \
+  $(NULL)
+
+# Remove this once the test harness uses the APIs built into Firefox
+TEST_FILES += source/lib
+
+PKG_STAGE = $(DIST)/test-package-stage
+
+stage-tests-package:: $(TEST_FILES)
+	$(INSTALL) $^ $(PKG_STAGE)/jetpack
new file mode 100644
--- /dev/null
+++ b/addon-sdk/mach_commands.py
@@ -0,0 +1,37 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Integrates the xpcshell test runner with mach.
+
+import os
+import sys
+
+from mozbuild.base import (
+    MachCommandBase,
+    MozbuildObject,
+)
+
+from mach.decorators import (
+    CommandArgument,
+    CommandProvider,
+    Command,
+)
+
+class JetpackRunner(MozbuildObject):
+    """Run jetpack tests."""
+    def run_tests(self, **kwargs):
+        self._run_make(target='jetpack-tests')
+
+@CommandProvider
+class MachCommands(MachCommandBase):
+    @Command('jetpack-test', help='Runs the jetpack test suite.')
+    def run_jetpack_test(self, **params):
+        # We should probably have a utility function to ensure the tree is
+        # ready to run tests. Until then, we just create the state dir (in
+        # case the tree wasn't built with mach).
+        self._ensure_state_subdir_exists('.')
+
+        jetpack = self._spawn(JetpackRunner)
+
+        jetpack.run_tests(**params)
--- a/mach
+++ b/mach
@@ -33,16 +33,17 @@ SEARCH_PATHS = [
     'testing/xpcshell',
     'testing/mozbase/mozprocess',
     'testing/mozbase/mozfile',
     'testing/mozbase/mozinfo',
 ]
 
 # Individual files providing mach commands.
 MACH_MODULES = [
+    'addon-sdk/mach_commands.py',
     'layout/tools/reftest/mach_commands.py',
     'python/mozboot/mozboot/mach_commands.py',
     'python/mozbuild/mozbuild/config.py',
     'python/mozbuild/mozbuild/mach_commands.py',
     'python/mozbuild/mozbuild/frontend/mach_commands.py',
     'testing/mochitest/mach_commands.py',
     'testing/xpcshell/mach_commands.py',
 ]
--- a/testing/testsuite-targets.mk
+++ b/testing/testsuite-targets.mk
@@ -339,16 +339,19 @@ REMOTE_CPPUNITTESTS = \
 cppunittests-remote: DM_TRANS?=adb
 cppunittests-remote:
 	@if [ "${TEST_DEVICE}" != "" -o "$(DM_TRANS)" = "adb" ]; \
           then $(call REMOTE_CPPUNITTESTS); \
         else \
           echo "please prepare your host with environment variables for TEST_DEVICE"; \
         fi
 
+jetpack-tests:
+	$(PYTHON) $(topsrcdir)/addon-sdk/source/bin/cfx -b $(browser_path) --parseable testpkgs
+
 # Package up the tests and test harnesses
 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
 
 ifndef UNIVERSAL_BINARY
 PKG_STAGE = $(DIST)/test-package-stage
 package-tests: \
   stage-mochitest \
   stage-reftest \
@@ -425,16 +428,17 @@ stage-jstests: make-stage-dir
 stage-android: make-stage-dir
 	$(NSINSTALL) $(DEPTH)/build/mobile/sutagent/android/sutAgentAndroid.apk $(PKG_STAGE)/bin
 	$(NSINSTALL) $(DEPTH)/build/mobile/sutagent/android/watcher/Watcher.apk $(PKG_STAGE)/bin
 	$(NSINSTALL) $(DEPTH)/build/mobile/sutagent/android/fencp/FenCP.apk $(PKG_STAGE)/bin
 	$(NSINSTALL) $(DEPTH)/build/mobile/sutagent/android/ffxcp/FfxCP.apk $(PKG_STAGE)/bin
 
 stage-jetpack: make-stage-dir
 	$(NSINSTALL) $(topsrcdir)/testing/jetpack/jetpack-location.txt $(PKG_STAGE)/jetpack
+	$(MAKE) -C $(DEPTH)/addon-sdk stage-tests-package
 
 stage-peptest: make-stage-dir
 	$(MAKE) -C $(DEPTH)/testing/peptest stage-package
 
 stage-tps: make-stage-dir
 	$(NSINSTALL) -D $(PKG_STAGE)/tps/tests
 	@(cd $(topsrcdir)/testing/tps && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/tps && tar -xf -)
 	@(cd $(topsrcdir)/services/sync/tps && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/tps && tar -xf -)
--- a/testing/xpcshell/xpcshell.ini
+++ b/testing/xpcshell/xpcshell.ini
@@ -133,16 +133,17 @@ skip-if = os == "win" || os == "mac" || 
 [include:chrome/test/unit_ipc/xpcshell.ini]
 [include:extensions/cookie/test/unit_ipc/xpcshell.ini]
 [include:ipc/testshell/tests/xpcshell.ini]
 [include:modules/libpref/test/unit_ipc/xpcshell.ini]
 [include:netwerk/test/unit_ipc/xpcshell.ini]
 [include:netwerk/cookie/test/unit_ipc/xpcshell.ini]
 [include:toolkit/components/contentprefs/tests/unit_ipc/xpcshell.ini]
 [include:toolkit/addon-sdk/test/unit/xpcshell.ini]
+[include:addon-sdk/test/unit/xpcshell.ini]
 [include:uriloader/exthandler/tests/unit_ipc/xpcshell.ini]
 
 [include:modules/libmar/tests/unit/xpcshell.ini]
 skip-if = os == "android"
 
 [include:b2g/components/test/unit/xpcshell.ini]
 
 [include:tools/profiler/tests/xpcshell.ini]
--- a/toolkit/toolkit-makefiles.sh
+++ b/toolkit/toolkit-makefiles.sh
@@ -444,16 +444,17 @@ MAKEFILES_embedding="
   embedding/components/webbrowserpersist/public/Makefile
   embedding/components/webbrowserpersist/src/Makefile
   embedding/components/windowwatcher/Makefile
   embedding/components/windowwatcher/public/Makefile
   embedding/components/windowwatcher/src/Makefile
 "
 
 MAKEFILES_xulapp="
+  addon-sdk/Makefile
   toolkit/Makefile
   toolkit/library/Makefile
   toolkit/crashreporter/client/Makefile
   toolkit/content/Makefile
   toolkit/components/aboutmemory/Makefile
   toolkit/components/alerts/Makefile
   toolkit/components/apppicker/Makefile
   toolkit/components/Makefile
@@ -714,16 +715,17 @@ fi
 
 
 #
 # Tests
 #
 
 if [ "$ENABLE_TESTS" ]; then
   add_makefiles "
+    addon-sdk/test/Makefile
     caps/tests/mochitest/Makefile
     chrome/test/Makefile
     content/base/test/Makefile
     content/base/test/chrome/Makefile
     content/base/test/websocket_hybi/Makefile
     content/canvas/test/Makefile
     content/canvas/test/crossorigin/Makefile
     content/canvas/test/webgl/Makefile
--- a/toolkit/toolkit-tiers.mk
+++ b/toolkit/toolkit-tiers.mk
@@ -305,16 +305,18 @@ endif
 
 ifndef MOZ_ENABLE_LIBCONIC
 # if libconic is present, it will do its own network monitoring
 ifdef MOZ_ENABLE_DBUS
 tier_platform_dirs    += toolkit/system/dbus
 endif
 endif
 
+tier_platform_dirs += addon-sdk
+
 ifdef MOZ_MAPINFO
 tier_platform_dirs	+= tools/codesighs
 endif
 
 ifdef ENABLE_MARIONETTE
 tier_platform_dirs += testing/marionette
 endif