Bug 948278 - Avoid piggy-backing into the build system for the reftest addon. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 16 Dec 2014 15:07:01 +0900
changeset 247389 78a5cadec4fc9d91ae6c6ae2080531b7e06dd963
parent 247388 29ed7a01c8159ded4d93d90c980c80756153712b
child 247390 2187c2cdeea9297104f2faf08689cc819aa4bc14
push id698
push userjlund@mozilla.com
push dateMon, 23 Mar 2015 22:08:11 +0000
treeherdermozilla-release@b0c0ae7b02a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs948278
milestone37.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 948278 - Avoid piggy-backing into the build system for the reftest addon. r=ted This makes the reftest addon use the httpd server as a js module instead of a XPCOM component.
layout/tools/reftest/Makefile.in
layout/tools/reftest/jar.mn
layout/tools/reftest/moz.build
layout/tools/reftest/reftest.js
netwerk/test/httpserver/Makefile.in
netwerk/test/httpserver/jar.mn
netwerk/test/httpserver/moz.build
testing/config/mozharness/android_arm_config.py
testing/config/mozharness/android_x86_config.py
testing/testsuite-targets.mk
--- a/layout/tools/reftest/Makefile.in
+++ b/layout/tools/reftest/Makefile.in
@@ -1,37 +1,21 @@
 # vim: set shiftwidth=8 tabstop=8 autoindent noexpandtab copyindent:
 # 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/.
 
-ifdef XPI_NAME
-NO_JS_MANIFEST = 1
 DIST_FILES = install.rdf
 
 ifeq ($(MOZ_BUILD_APP),mobile/android)
-DEFINES += -DBOOTSTRAP
 DIST_FILES += bootstrap.js
 endif
 
-ifeq ($(MOZ_BUILD_APP),b2g/dev)
-DEFINES += -DBOOTSTRAP
-DEFINES += -DREFTEST_B2G
-endif
-
-ifeq ($(MOZ_BUILD_APP),b2g)
-DEFINES += -DBOOTSTRAP
-DEFINES += -DREFTEST_B2G
-endif
-
 # Used in install.rdf
 USE_EXTENSION_MANIFEST=1
-else
-EXTRA_COMPONENTS += reftest-cmdline.manifest
-endif
 
 _DEST_DIR = $(DEPTH)/_tests/reftest
 
 _HARNESS_FILES = \
   $(srcdir)/runreftest.py \
   $(srcdir)/remotereftest.py \
   $(srcdir)/runreftestb2g.py \
   $(srcdir)/b2g_desktop.py \
@@ -57,33 +41,25 @@ endif
 PP_TARGETS += _HARNESS_PP_FILES
 
 include $(topsrcdir)/config/rules.mk
 
 # We're installing to _tests/reftest
 TARGET_DEPTH = ../..
 include $(topsrcdir)/build/automation-build.mk
 
-# We want to get an extension-packaged version of reftest as well, 
-# so this seems to be the simplest way to make that happen.
-ifndef XPI_NAME
-make-xpi:
-	+$(MAKE) -C $(DEPTH)/netwerk/test/httpserver misc libs XPI_NAME=reftest
-	+$(MAKE) misc libs XPI_NAME=reftest
-copy-harness: make-xpi
-libs:: copy-harness
-endif
-
 $(_DEST_DIR):
 	$(NSINSTALL) -D $@
 
 $(_HARNESS_FILES): $(_DEST_DIR)
 
 # copy harness and the reftest extension bits to $(_DEST_DIR)
-copy-harness: $(_HARNESS_FILES) $(addprefix $(_DEST_DIR)/,$(_HARNESS_PP_FILES))
+# This needs to happen after jar.mn handling from rules.mk included above.
+# The order of the :: rules ensures that.
+libs:: $(_HARNESS_FILES) $(addprefix $(_DEST_DIR)/,$(_HARNESS_PP_FILES))
 	$(INSTALL) $(_HARNESS_FILES) $(_DEST_DIR)
 	(cd $(DIST)/xpi-stage && tar $(TAR_CREATE_FLAGS) - reftest) | (cd $(_DEST_DIR) && tar -xf -)
 
 PKG_STAGE = $(DIST)/test-stage
 
 # stage harness and tests for packaging
 stage-package:
 	$(NSINSTALL) -D $(PKG_STAGE)/reftest && $(NSINSTALL) -D $(PKG_STAGE)/reftest/tests
--- a/layout/tools/reftest/jar.mn
+++ b/layout/tools/reftest/jar.mn
@@ -1,14 +1,10 @@
 reftest.jar:
 % content reftest %content/
 *  content/reftest-content.js (reftest-content.js)
+  content/httpd.jsm (../../../netwerk/test/httpserver/httpd.js)
 #ifdef BOOTSTRAP
 *  content/reftest.jsm (reftest.js)
 #else
 *  content/reftest.js (reftest.js)
   content/reftest.xul (reftest.xul)
-#ifdef XPI_NAME
-%  component {32530271-8c1b-4b7d-a812-218e42c6bb23} components/reftest-cmdline.js
-%  contract @mozilla.org/commandlinehandler/general-startup;1?type=reftest {32530271-8c1b-4b7d-a812-218e42c6bb23}
-%  category command-line-handler m-reftest @mozilla.org/commandlinehandler/general-startup;1?type=reftest
 #endif
-#endif
--- a/layout/tools/reftest/moz.build
+++ b/layout/tools/reftest/moz.build
@@ -1,11 +1,19 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
-EXTRA_PP_COMPONENTS += [
-    'reftest-cmdline.js',
-]
+if CONFIG['MOZ_BUILD_APP'] in ('b2g', 'b2g/dev', 'mobile/android'):
+    DEFINES['BOOTSTRAP'] = True
+    if CONFIG['MOZ_BUILD_APP'] in ('b2g', 'b2g/dev'):
+        DEFINES['REFTEST_B2G'] = True
+else:
+    EXTRA_PP_COMPONENTS += [
+        'reftest-cmdline.js',
+        'reftest-cmdline.manifest',
+    ]
 
 JAR_MANIFESTS += ['jar.mn']
+
+XPI_NAME = 'reftest'
--- a/layout/tools/reftest/reftest.js
+++ b/layout/tools/reftest/reftest.js
@@ -32,16 +32,17 @@ const NS_NETWORK_PROTOCOL_CONTRACTID_PRE
 const NS_XREAPPINFO_CONTRACTID =
           "@mozilla.org/xre/app-info;1";
 const NS_DIRECTORY_SERVICE_CONTRACTID =
           "@mozilla.org/file/directory_service;1";
 const NS_OBSERVER_SERVICE_CONTRACTID =
           "@mozilla.org/observer-service;1";
 
 Components.utils.import("resource://gre/modules/FileUtils.jsm");
+Components.utils.import("chrome://reftest/content/httpd.jsm", this);
 
 var gLoadTimeout = 0;
 var gTimeoutHook = null;
 var gRemote = false;
 var gIgnoreWindowSize = false;
 var gShuffle = false;
 var gTotalChunks = 0;
 var gThisChunk = 0;
@@ -392,27 +393,17 @@ function InitAndStartRefTests()
     gIOService = CC[IO_SERVICE_CONTRACTID].getService(CI.nsIIOService);
     gDebug = CC[DEBUG_CONTRACTID].getService(CI.nsIDebug2);
 
     RegisterProcessCrashObservers();
 
     if (gRemote) {
         gServer = null;
     } else {
-        // not all gecko applications autoregister xpcom components
-        if (CC["@mozilla.org/server/jshttp;1"] === undefined) {
-            var file = CC["@mozilla.org/file/directory_service;1"].
-                        getService(CI.nsIProperties).get("ProfD", CI.nsIFile);
-            file.appendRelativePath("extensions/reftest@mozilla.org/chrome.manifest");
-
-            registrar = Components.manager.QueryInterface(CI.nsIComponentRegistrar);
-            registrar.autoRegister(file);
-        }
-        gServer = CC["@mozilla.org/server/jshttp;1"].
-                      createInstance(CI.nsIHttpServer);
+        gServer = new HttpServer();
     }
     try {
         if (gServer)
             StartHTTPServer();
     } catch (ex) {
         //gBrowser.loadURI('data:text/plain,' + ex);
         ++gTestResults.Exception;
         gDumpLog("REFTEST TEST-UNEXPECTED-FAIL | | EXCEPTION: " + ex + "\n");
--- a/netwerk/test/httpserver/Makefile.in
+++ b/netwerk/test/httpserver/Makefile.in
@@ -1,16 +1,7 @@
 # vim: noexpandtab ts=8 sw=8
 #
 # 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/.
 
 NO_INTERFACES_MANIFEST = 1
-
-ifdef XPI_NAME
-NO_JS_MANIFEST = 1
-USE_EXTENSION_MANIFEST = 1
-else
-EXTRA_COMPONENTS += \
-                   httpd.manifest \
-                   $(NULL)
-endif
deleted file mode 100644
--- a/netwerk/test/httpserver/jar.mn
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifdef XPI_NAME
-httpd.jar:
-%  component {54ef6f81-30af-4b1d-ac55-8ba811293e41} components/httpd.js
-%  contract @mozilla.org/server/jshttp;1 {54ef6f81-30af-4b1d-ac55-8ba811293e41}
-%  interfaces components/test_necko.xpt
-#endif
--- a/netwerk/test/httpserver/moz.build
+++ b/netwerk/test/httpserver/moz.build
@@ -9,15 +9,14 @@ XPIDL_SOURCES += [
 ]
 
 XPIDL_MODULE = 'test_necko'
 
 XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell.ini']
 
 EXTRA_COMPONENTS += [
     'httpd.js',
+    'httpd.manifest',
 ]
 
 TESTING_JS_MODULES += [
     'httpd.js',
 ]
-
-JAR_MANIFESTS += ['jar.mn']
--- a/testing/config/mozharness/android_arm_config.py
+++ b/testing/config/mozharness/android_arm_config.py
@@ -54,48 +54,48 @@ config = {
         "reftest": {
             "run_filename": "remotereftest.py",
             "testsdir": "reftest",
             "options": [ "--app=%(app)s", "--ignore-window-size",
                 "--bootstrap",
                 "--remote-webserver=%(remote_webserver)s", "--xre-path=%(xre_path)s",
                 "--utility-path=%(utility_path)s", "--deviceIP=%(device_ip)s",
                 "--devicePort=%(device_port)s", "--http-port=%(http_port)s",
-                "--ssl-port=%(ssl_port)s", "--httpd-path", "reftest/components",
+                "--ssl-port=%(ssl_port)s", "--httpd-path", "%(modules_dir)s",
                 "--symbols-path=%(symbols_path)s",
                 # Bug 1064002 - Land once mozharness changes land
                 #"--total-chunks=16",
                 #"tests/layout/reftests/reftest.list",
             ],
         },
         # Bug 1064002 - Not yet in use
         "crashtest": {
             "run_filename": "remotereftest.py",
             "testsdir": "reftest",
             "options": [ "--app=%(app)s", "--ignore-window-size",
                 "--bootstrap",
                 "--remote-webserver=%(remote_webserver)s", "--xre-path=%(xre_path)s",
                 "--utility-path=%(utility_path)s", "--deviceIP=%(device_ip)s",
                 "--devicePort=%(device_port)s", "--http-port=%(http_port)s",
-                "--ssl-port=%(ssl_port)s", "--httpd-path", "reftest/components",
+                "--ssl-port=%(ssl_port)s", "--httpd-path", "%(modules_dir)s",
                 "--symbols-path=%(symbols_path)s",
                 "--total-chunks=2",
                 "tests/testing/crashtest/crashtests.list",
             ],
         },
         # Bug 1064002 - Not yet in use
         "jsreftest": {
             "run_filename": "remotereftest.py",
             "testsdir": "reftest",
             "options": [ "--app=%(app)s", "--ignore-window-size",
                 "--bootstrap",
                 "--remote-webserver=%(remote_webserver)s", "--xre-path=%(xre_path)s",
                 "--utility-path=%(utility_path)s", "--deviceIP=%(device_ip)s",
                 "--devicePort=%(device_port)s", "--http-port=%(http_port)s",
-                "--ssl-port=%(ssl_port)s", "--httpd-path", "reftest/components",
+                "--ssl-port=%(ssl_port)s", "--httpd-path", "%(modules_dir)s",
                 "--symbols-path=%(symbols_path)s",
                 "../jsreftest/tests/jstests.list",
                 "--total-chunks=6",
                 "--extra-profile-file=jsreftest/tests/user.js",
             ],
         },
         "xpcshell": {
             "run_filename": "remotexpcshelltests.py",
--- a/testing/config/mozharness/android_x86_config.py
+++ b/testing/config/mozharness/android_x86_config.py
@@ -17,17 +17,17 @@ config = {
         },
         "reftest": {
             "run_filename": "remotereftest.py",
             "options": [ "--app=%(app)s", "--ignore-window-size",
                 "--bootstrap",
                 "--remote-webserver=%(remote_webserver)s", "--xre-path=%(xre_path)s",
                 "--utility-path=%(utility_path)s", "--deviceIP=%(device_ip)s",
                 "--devicePort=%(device_port)s", "--http-port=%(http_port)s",
-                "--ssl-port=%(ssl_port)s", "--httpd-path", "reftest/components",
+                "--ssl-port=%(ssl_port)s", "--httpd-path", "%(modules_dir)s",
                 "--symbols-path=%(symbols_path)s",
             ],
         },
         "xpcshell": {
             "run_filename": "remotexpcshelltests.py",
             "options": ["--deviceIP=%(device_ip)s", "--devicePort=%(device_port)s",
                 "--xre-path=%(xre_path)s", "--testing-modules-dir=%(modules_dir)s",
                 "--apk=%(installer_path)s", "--no-logfiles",
--- a/testing/testsuite-targets.mk
+++ b/testing/testsuite-targets.mk
@@ -190,23 +190,23 @@ endif
 # Usage: |make [EXTRA_TEST_ARGS=...] *test|.
 RUN_REFTEST = rm -f ./$@.log && $(PYTHON) _tests/reftest/runreftest.py \
   --extra-profile-file=$(DIST)/plugins \
   $(SYMBOLS_PATH) $(EXTRA_TEST_ARGS) $(1) | tee ./$@.log
 
 REMOTE_REFTEST = rm -f ./$@.log && $(PYTHON) _tests/reftest/remotereftest.py \
   --dm_trans=$(DM_TRANS) --ignore-window-size \
   --app=$(TEST_PACKAGE_NAME) --deviceIP=${TEST_DEVICE} --xre-path=${MOZ_HOST_BIN} \
-  --httpd-path=_tests/reftest/reftest/components \
+  --httpd-path=_tests/modules \
   $(SYMBOLS_PATH) $(EXTRA_TEST_ARGS) '$(1)' | tee ./$@.log
 
 RUN_REFTEST_B2G = rm -f ./$@.log && $(PYTHON) _tests/reftest/runreftestb2g.py \
   --remote-webserver=10.0.2.2 --b2gpath=${B2G_PATH} --adbpath=${ADB_PATH} \
   --xre-path=${MOZ_HOST_BIN} $(SYMBOLS_PATH) --ignore-window-size \
-  --httpd-path=_tests/reftest/reftest/components \
+  --httpd-path=_tests/modules \
   $(EXTRA_TEST_ARGS) '$(1)' | tee ./$@.log
 
 ifeq ($(OS_ARCH),WINNT) #{
 # GPU-rendered shadow layers are unsupported here
 OOP_CONTENT = --setpref=layers.async-pan-zoom.enabled=true --setpref=browser.tabs.remote.autostart=true --setpref=layers.acceleration.disabled=true
 GPU_RENDERING =
 else
 OOP_CONTENT = --setpref=layers.async-pan-zoom.enabled=true --setpref=browser.tabs.remote.autostart=true