Bug 586754 xpcshell tests should use relativesrcdir instead of $MODULE r=:Mitch a=NPOTB
authorJoel Maher <jmaher@mozilla.com>
Fri, 20 Aug 2010 09:32:58 -0700
changeset 51032 d62bc37cb42efe8dafa403bc7bc8652c31d43589
parent 51031 38cc0d7d66672bdc7cdd877f9f6c579038c86260
child 51033 fae9fc14a22a9fd70f56544181e689b1af72f0f6
push idunknown
push userunknown
push dateunknown
reviewersNPOTB
bugs586754
milestone2.0b5pre
Bug 586754 xpcshell tests should use relativesrcdir instead of $MODULE r=:Mitch a=NPOTB
browser/components/places/tests/Makefile.in
browser/components/places/tests/unit/head_bookmarks.js
chrome/test/Makefile.in
config/rules.mk
content/test/Makefile.in
content/xtf/test/Makefile.in
dom/tests/Makefile.in
embedding/Makefile.in
gfx/tests/Makefile.in
intl/locale/src/unix/tests/Makefile.in
intl/locale/tests/Makefile.in
intl/locale/tests_multilocale/Makefile.in
intl/strres/tests/Makefile.in
intl/uconv/tests/Makefile.in
intl/unicharutil/tests/Makefile.in
ipc/testshell/Makefile.in
js/jetpack/tests/Makefile.in
js/src/config/rules.mk
js/src/xpconnect/tests/Makefile.in
modules/libjar/test/Makefile.in
modules/libjar/zipwriter/test/Makefile.in
modules/libpref/test/Makefile.in
modules/plugin/test/Makefile.in
netwerk/cookie/Makefile.in
netwerk/test/Makefile.in
netwerk/test/httpserver/Makefile.in
parser/xml/test/Makefile.in
rdf/tests/Makefile.in
security/manager/ssl/tests/Makefile.in
storage/test/Makefile.in
testing/xpcshell/example/Makefile.in
toolkit/components/autocomplete/tests/Makefile.in
toolkit/components/commandlines/test/Makefile.in
toolkit/components/contentprefs/tests/Makefile.in
toolkit/components/ctypes/tests/Makefile.in
toolkit/components/downloads/test/Makefile.in
toolkit/components/places/tests/Makefile.in
toolkit/components/urlformatter/tests/Makefile.in
toolkit/content/tests/Makefile.in
toolkit/crashreporter/test/Makefile.in
toolkit/mozapps/downloads/tests/Makefile.in
toolkit/mozapps/extensions/test/Makefile.in
toolkit/mozapps/update/test/Makefile.in
toolkit/mozapps/update/test_timermanager/Makefile.in
uriloader/exthandler/tests/Makefile.in
xpcom/tests/Makefile.in
--- a/browser/components/places/tests/Makefile.in
+++ b/browser/components/places/tests/Makefile.in
@@ -35,16 +35,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = browser/components/places/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= test_browser_places
 
 XPCSHELL_TESTS = unit
 
 DIRS = browser chrome perf
--- a/browser/components/places/tests/unit/head_bookmarks.js
+++ b/browser/components/places/tests/unit/head_bookmarks.js
@@ -40,17 +40,17 @@
 const Ci = Components.interfaces;
 const Cc = Components.classes;
 const Cr = Components.results;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 
 // Import common head.
-let (commonFile = do_get_file("../../test_places/head_common.js", false)) {
+let (commonFile = do_get_file("../../../../../toolkit/components/places/tests/head_common.js", false)) {
   let uri = Services.io.newFileURI(commonFile);
   Services.scriptloader.loadSubScript(uri.spec, this);
 }
 
 // Put any other stuff relative to this test folder below.
 
 
 XPCOMUtils.defineLazyGetter(this, "PlacesUIUtils", function() {
--- a/chrome/test/Makefile.in
+++ b/chrome/test/Makefile.in
@@ -33,16 +33,17 @@
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH = ../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
+relativesrcdir = chrome/test
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = test_chrome
 
 XPCSHELL_TESTS = unit \
                  $(NULL)
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -142,82 +142,82 @@ endif
 
 ################################################################################
 # Testing frameworks support
 ################################################################################
 
 ifdef ENABLE_TESTS
 
 ifdef XPCSHELL_TESTS
-ifndef MODULE
-$(error Must define MODULE when defining XPCSHELL_TESTS.)
-endif
+#ifndef MODULE
+#$(error Must define MODULE when defining XPCSHELL_TESTS.)
+#endif
 
 testxpcobjdir = $(DEPTH)/_tests/xpcshell
 
 # Test file installation
 ifneq (,$(filter WINNT os2-emx,$(HOST_OS_ARCH)))
 # Windows and OS/2 nsinstall can't recursively copy directories, so use nsinstall.py
 TEST_INSTALLER = $(PYTHON) $(topsrcdir)/config/nsinstall.py
 else
 TEST_INSTALLER = $(INSTALL)
 endif
 
 define _INSTALL_TESTS
-$(TEST_INSTALLER) $(wildcard $(srcdir)/$(dir)/*) $(testxpcobjdir)/$(MODULE)/$(dir)
+$(TEST_INSTALLER) $(wildcard $(srcdir)/$(dir)/*) $(testxpcobjdir)/$(relativesrcdir)/$(dir)
 
 endef # do not remove the blank line!
 
 SOLO_FILE ?= $(error Specify a test filename in SOLO_FILE when using check-interactive or check-one)
 
 libs::
 	$(foreach dir,$(XPCSHELL_TESTS),$(_INSTALL_TESTS))
 	$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py \
           $(testxpcobjdir)/all-test-dirs.list \
-          $(addprefix $(MODULE)/,$(XPCSHELL_TESTS))
+          $(addprefix $(relativesrcdir)/,$(XPCSHELL_TESTS))
 
 testxpcsrcdir = $(topsrcdir)/testing/xpcshell
 
 # Execute all tests in the $(XPCSHELL_TESTS) directories.
 # See also testsuite-targets.mk 'xpcshell-tests' target for global execution.
 xpcshell-tests:
 	$(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
           -I$(topsrcdir)/build \
           $(testxpcsrcdir)/runxpcshelltests.py \
           --symbols-path=$(DIST)/crashreporter-symbols \
           $(EXTRA_TEST_ARGS) \
           $(DIST)/bin/xpcshell \
-          $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
+          $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
 
 # Execute a single test, specified in $(SOLO_FILE), but don't automatically
 # start the test. Instead, present the xpcshell prompt so the user can
 # attach a debugger and then start the test.
 check-interactive:
 	$(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
           -I$(topsrcdir)/build \
           $(testxpcsrcdir)/runxpcshelltests.py \
           --symbols-path=$(DIST)/crashreporter-symbols \
           --test-path=$(SOLO_FILE) \
           --profile-name=$(MOZ_APP_NAME) \
           --interactive \
           $(DIST)/bin/xpcshell \
-          $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
+          $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
 
 # Execute a single test, specified in $(SOLO_FILE)
 check-one:
 	$(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
           -I$(topsrcdir)/build \
           $(testxpcsrcdir)/runxpcshelltests.py \
           --symbols-path=$(DIST)/crashreporter-symbols \
           --test-path=$(SOLO_FILE) \
           --profile-name=$(MOZ_APP_NAME) \
           --verbose \
           $(EXTRA_TEST_ARGS) \
           $(DIST)/bin/xpcshell \
-          $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
+          $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
 
 endif # XPCSHELL_TESTS
 
 ifdef CPP_UNIT_TESTS
 
 # Compile the tests to $(DIST)/bin.  Make lots of niceties available by default
 # through TestHarness.h, by modifying the list of includes and the libs against
 # which stuff links.
--- a/content/test/Makefile.in
+++ b/content/test/Makefile.in
@@ -35,16 +35,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = content/test
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= test_content
 
 XPCSHELL_TESTS  = unit
 
 include $(topsrcdir)/config/rules.mk
--- a/content/xtf/test/Makefile.in
+++ b/content/xtf/test/Makefile.in
@@ -44,16 +44,17 @@
 # for detailed instructions.
 #
 
 # Note: DEPTH should be set to the relative path to mozilla/
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = content/xtf/test
 
 include $(DEPTH)/config/autoconf.mk
 
 # Note: set the test module's name to test_<yourmodule>
 MODULE		= test_xtf
 
 XPCSHELL_TESTS  = unit
 
--- a/dom/tests/Makefile.in
+++ b/dom/tests/Makefile.in
@@ -34,16 +34,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = dom/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = test_dom
 
 DIRS		+= mochitest \
 		$(NULL)
 XPCSHELL_TESTS = unit
--- a/embedding/Makefile.in
+++ b/embedding/Makefile.in
@@ -35,16 +35,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = embedding
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE       = embed
 
 DIRS = base components browser
 
 ifdef ENABLE_TESTS
--- a/gfx/tests/Makefile.in
+++ b/gfx/tests/Makefile.in
@@ -34,16 +34,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = gfx/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= gfx
 MOZILLA_INTERNAL_API = 1
 
 XPCSHELL_TESTS = unit
 
--- a/intl/locale/src/unix/tests/Makefile.in
+++ b/intl/locale/src/unix/tests/Makefile.in
@@ -34,15 +34,16 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = intl/locale/src/unix/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE          = test_intl_locale_unix
 XPCSHELL_TESTS  = unit
 
 include $(topsrcdir)/config/rules.mk
--- a/intl/locale/tests/Makefile.in
+++ b/intl/locale/tests/Makefile.in
@@ -34,15 +34,16 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = intl/locale/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE          = test_intl_locale
 XPCSHELL_TESTS  = unit
 
 include $(topsrcdir)/config/rules.mk
--- a/intl/locale/tests_multilocale/Makefile.in
+++ b/intl/locale/tests_multilocale/Makefile.in
@@ -34,15 +34,16 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = intl/locale/tests_multilocale
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE          = test_intl_locale_multilocale
 XPCSHELL_TESTS  = unit
 
 include $(topsrcdir)/config/rules.mk
--- a/intl/strres/tests/Makefile.in
+++ b/intl/strres/tests/Makefile.in
@@ -34,16 +34,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = intl/strres/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		 = test_intl_strres
 
 XPCSHELL_TESTS	 = unit
 
 include $(topsrcdir)/config/rules.mk
--- a/intl/uconv/tests/Makefile.in
+++ b/intl/uconv/tests/Makefile.in
@@ -34,16 +34,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = intl/uconv/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE          = test_intl_uconv
 XPCSHELL_TESTS	= unit
 
 ifndef MOZ_ENABLE_LIBXUL
 MOZILLA_INTERNAL_API = 1
--- a/intl/unicharutil/tests/Makefile.in
+++ b/intl/unicharutil/tests/Makefile.in
@@ -34,16 +34,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = intl/unicharutil/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= test_intl_unicharutil
 XPCSHELL_TESTS	= unit
 
 
 CPPSRCS		= UnicharSelfTest.cpp \
--- a/ipc/testshell/Makefile.in
+++ b/ipc/testshell/Makefile.in
@@ -33,16 +33,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH = ../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
+relativesrcdir = ipc/testshell
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = ipcshell
 LIBRARY_NAME = ipcshell_s
 FORCE_STATIC_LIB = 1
 LIBXUL_LIBRARY = 1
 EXPORT_LIBRARY = 1
--- a/js/jetpack/tests/Makefile.in
+++ b/js/jetpack/tests/Makefile.in
@@ -34,16 +34,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH     = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
+relativesrcdir = js/jetpack/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = test_jetpack
 
 XPCSHELL_TESTS = unit
 
 include $(topsrcdir)/config/config.mk
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -142,82 +142,82 @@ endif
 
 ################################################################################
 # Testing frameworks support
 ################################################################################
 
 ifdef ENABLE_TESTS
 
 ifdef XPCSHELL_TESTS
-ifndef MODULE
-$(error Must define MODULE when defining XPCSHELL_TESTS.)
-endif
+#ifndef MODULE
+#$(error Must define MODULE when defining XPCSHELL_TESTS.)
+#endif
 
 testxpcobjdir = $(DEPTH)/_tests/xpcshell
 
 # Test file installation
 ifneq (,$(filter WINNT os2-emx,$(HOST_OS_ARCH)))
 # Windows and OS/2 nsinstall can't recursively copy directories, so use nsinstall.py
 TEST_INSTALLER = $(PYTHON) $(topsrcdir)/config/nsinstall.py
 else
 TEST_INSTALLER = $(INSTALL)
 endif
 
 define _INSTALL_TESTS
-$(TEST_INSTALLER) $(wildcard $(srcdir)/$(dir)/*) $(testxpcobjdir)/$(MODULE)/$(dir)
+$(TEST_INSTALLER) $(wildcard $(srcdir)/$(dir)/*) $(testxpcobjdir)/$(relativesrcdir)/$(dir)
 
 endef # do not remove the blank line!
 
 SOLO_FILE ?= $(error Specify a test filename in SOLO_FILE when using check-interactive or check-one)
 
 libs::
 	$(foreach dir,$(XPCSHELL_TESTS),$(_INSTALL_TESTS))
 	$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py \
           $(testxpcobjdir)/all-test-dirs.list \
-          $(addprefix $(MODULE)/,$(XPCSHELL_TESTS))
+          $(addprefix $(relativesrcdir)/,$(XPCSHELL_TESTS))
 
 testxpcsrcdir = $(topsrcdir)/testing/xpcshell
 
 # Execute all tests in the $(XPCSHELL_TESTS) directories.
 # See also testsuite-targets.mk 'xpcshell-tests' target for global execution.
 xpcshell-tests:
 	$(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
           -I$(topsrcdir)/build \
           $(testxpcsrcdir)/runxpcshelltests.py \
           --symbols-path=$(DIST)/crashreporter-symbols \
           $(EXTRA_TEST_ARGS) \
           $(DIST)/bin/xpcshell \
-          $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
+          $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
 
 # Execute a single test, specified in $(SOLO_FILE), but don't automatically
 # start the test. Instead, present the xpcshell prompt so the user can
 # attach a debugger and then start the test.
 check-interactive:
 	$(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
           -I$(topsrcdir)/build \
           $(testxpcsrcdir)/runxpcshelltests.py \
           --symbols-path=$(DIST)/crashreporter-symbols \
           --test-path=$(SOLO_FILE) \
           --profile-name=$(MOZ_APP_NAME) \
           --interactive \
           $(DIST)/bin/xpcshell \
-          $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
+          $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
 
 # Execute a single test, specified in $(SOLO_FILE)
 check-one:
 	$(PYTHON) -u $(topsrcdir)/config/pythonpath.py \
           -I$(topsrcdir)/build \
           $(testxpcsrcdir)/runxpcshelltests.py \
           --symbols-path=$(DIST)/crashreporter-symbols \
           --test-path=$(SOLO_FILE) \
           --profile-name=$(MOZ_APP_NAME) \
           --verbose \
           $(EXTRA_TEST_ARGS) \
           $(DIST)/bin/xpcshell \
-          $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(MODULE)/$(dir))
+          $(foreach dir,$(XPCSHELL_TESTS),$(testxpcobjdir)/$(relativesrcdir)/$(dir))
 
 endif # XPCSHELL_TESTS
 
 ifdef CPP_UNIT_TESTS
 
 # Compile the tests to $(DIST)/bin.  Make lots of niceties available by default
 # through TestHarness.h, by modifying the list of includes and the libs against
 # which stuff links.
--- a/js/src/xpconnect/tests/Makefile.in
+++ b/js/src/xpconnect/tests/Makefile.in
@@ -35,16 +35,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = js/src/xpconnect/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= TestXPC
 SIMPLE_PROGRAMS = TestXPC$(BIN_SUFFIX)
 
 
 DIRS		= idl mochitest chrome
--- a/modules/libjar/test/Makefile.in
+++ b/modules/libjar/test/Makefile.in
@@ -35,16 +35,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = modules/libjar/test
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= test_libjar
 
 XPCSHELL_TESTS = unit
 
 DIRS		= mochitest chrome
--- a/modules/libjar/zipwriter/test/Makefile.in
+++ b/modules/libjar/zipwriter/test/Makefile.in
@@ -34,16 +34,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH          = ../../../..
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
+relativesrcdir = modules/libjar/zipwriter/test
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE         = test_zipwriter
 
 XPCSHELL_TESTS = \
   unit \
   $(NULL)
--- a/modules/libpref/test/Makefile.in
+++ b/modules/libpref/test/Makefile.in
@@ -35,16 +35,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = modules/libpref/test
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= test_libpref
 
 XPCSHELL_TESTS = unit
 
 include $(topsrcdir)/config/rules.mk
--- a/modules/plugin/test/Makefile.in
+++ b/modules/plugin/test/Makefile.in
@@ -35,16 +35,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = modules/plugin/test
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = test_plugin
 
 DIRS = testplugin
 
 XPCSHELL_TESTS = \
--- a/netwerk/cookie/Makefile.in
+++ b/netwerk/cookie/Makefile.in
@@ -35,16 +35,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH     = ../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
+relativesrcdir = netwerk/cookie
 
 include $(DEPTH)/config/autoconf.mk
 
 # export required interfaces, even if --disable-cookies has been given
 MODULE       = necko
 XPIDL_MODULE = necko_cookie
 GRE_MODULE   = 1
 
--- a/netwerk/test/Makefile.in
+++ b/netwerk/test/Makefile.in
@@ -35,16 +35,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = netwerk/test
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= test_necko
 
 DIRS            = \
                   httpserver \
                   browser \
@@ -114,11 +115,11 @@ check::
 libs:: $(_RES_FILES)
 	$(INSTALL) $^ $(DIST)/bin/res
 install:: $(_RES_FILES)
 	$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/res
 
 # One of the xpcshell unit tests needs this file, so make sure it winds
 #  up in the test directory.
 libs::
-	$(NSINSTALL) -D $(DEPTH)/_tests/xpcshell/$(MODULE)/unit/data
+	$(NSINSTALL) -D $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit/data
 	$(INSTALL) $(topsrcdir)/netwerk/dns/effective_tld_names.dat \
-          $(DEPTH)/_tests/xpcshell/$(MODULE)/unit/
+          $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit/
--- a/netwerk/test/httpserver/Makefile.in
+++ b/netwerk/test/httpserver/Makefile.in
@@ -37,16 +37,17 @@
 # ***** END LICENSE BLOCK *****
 
 $(warning httpserver XPI_NAME=$(XPI_NAME))
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = netwerk/test/httpserver
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE          = test_necko
 NO_INTERFACES_MANIFEST = 1
 
 EXTRA_COMPONENTS = \
                    httpd.js \
--- a/parser/xml/test/Makefile.in
+++ b/parser/xml/test/Makefile.in
@@ -44,16 +44,17 @@
 # for detailed instructions.
 #
 
 # Note: DEPTH should be set to the relative path to mozilla/
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = parser/xml/test
 
 include $(DEPTH)/config/autoconf.mk
 
 # Note: set the test module's name to test_<yourmodule>
 MODULE		= test_xmlreader
 
 XPCSHELL_TESTS  = unit
 
--- a/rdf/tests/Makefile.in
+++ b/rdf/tests/Makefile.in
@@ -34,16 +34,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = rdf/tests
 
 MODULE = test_rdf
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS		= rdfcat rdfpoll triplescat
 
 XPCSHELL_TESTS = unit
--- a/security/manager/ssl/tests/Makefile.in
+++ b/security/manager/ssl/tests/Makefile.in
@@ -35,14 +35,15 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = security/manager/ssl/tests
 
 MODULE		= pipnss
 DIRS		= mochitest
 XPCSHELL_TESTS  = unit
 
 include $(topsrcdir)/config/rules.mk
--- a/storage/test/Makefile.in
+++ b/storage/test/Makefile.in
@@ -36,16 +36,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = storage/test
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = test_storage
 
 XPCSHELL_TESTS = unit
 
 CPP_UNIT_TESTS = \
--- a/testing/xpcshell/example/Makefile.in
+++ b/testing/xpcshell/example/Makefile.in
@@ -45,16 +45,17 @@
 # for detailed instructions.
 #
 
 # Note: DEPTH should be set to the relative path to mozilla/
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = testing/xpcshell/example
 
 include $(DEPTH)/config/autoconf.mk
 
 # Note: set the test module's name to test_<yourmodule>
 MODULE		= test_testing_xpcshell_example
 
 # This is a list of directories containing tests to run, separated by spaces.
 # Most likely, tho, you won't use more than one directory here.
--- a/toolkit/components/autocomplete/tests/Makefile.in
+++ b/toolkit/components/autocomplete/tests/Makefile.in
@@ -35,16 +35,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = toolkit/components/autocomplete/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= test_autocomplete
 
 XPCSHELL_TESTS = unit
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/commandlines/test/Makefile.in
+++ b/toolkit/components/commandlines/test/Makefile.in
@@ -36,16 +36,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = toolkit/components/commandlines/test
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= test_harness_commandlines
 
 XPCSHELL_TESTS = \
                  unit \
                  $(NULL)
--- a/toolkit/components/contentprefs/tests/Makefile.in
+++ b/toolkit/components/contentprefs/tests/Makefile.in
@@ -35,16 +35,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = toolkit/components/contentprefs/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= test_toolkit_contentprefs
 
 ifdef MOZ_PHOENIX
 XPCSHELL_TESTS = unit
 endif
--- a/toolkit/components/ctypes/tests/Makefile.in
+++ b/toolkit/components/ctypes/tests/Makefile.in
@@ -35,16 +35,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH = ../../../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
+relativesrcdir = toolkit/components/ctypes/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = jsctypes-test
 LIBRARY_NAME = jsctypes-test
 SHORT_LIBNAME = jscttest
 FORCE_SHARED_LIB = 1
 NO_DIST_INSTALL = 1
@@ -66,20 +67,20 @@ XPCSHELL_TESTS = unit
 _CHROME_TEST_FILES = \
   xpcshellTestHarnessAdaptor.js \
   ctypes_worker.js \
   test_ctypes.xul \
   $(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
-xpctestdir = $(testxpcobjdir)/$(MODULE)/unit
+xpctestdir = $(testxpcobjdir)/$(relativesrcdir)/unit
 
 chrometestdir = \
-  $(DEPTH)/_tests/testing/mochitest/chrome/toolkit/components/$(MODULE)
+  $(DEPTH)/_tests/testing/mochitest/chrome/toolkit/components/$(relativesrcdir)
 
 # preprocess and install our unit test into the appropriate directory,
 # and install the test library as well. the xpcshell test rules will
 # install the .js.in from the tests srcdir, so remove it when we're done.
 libs:: unit/test_jsctypes.js.in
 	$(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) \
 	  $^ > $(xpctestdir)/test_jsctypes.js
 	$(TEST_INSTALLER) $(SHARED_LIBRARY) $(xpctestdir)
--- a/toolkit/components/downloads/test/Makefile.in
+++ b/toolkit/components/downloads/test/Makefile.in
@@ -35,16 +35,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH   = ../../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH   = @srcdir@
+relativesrcdir = toolkit/components/downloads/test
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = test_dm
 
 XPCSHELL_TESTS = \
   unit \
   schema_migration \
--- a/toolkit/components/places/tests/Makefile.in
+++ b/toolkit/components/places/tests/Makefile.in
@@ -82,9 +82,9 @@ TOOL_DIRS = \
   $(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
 libs:: $(MOCHI_TESTS)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
 
 libs:: $(XPCSHELL_TESTS_COMMON)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/xpcshell/$(MODULE)
+	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/xpcshell/$(relativesrcdir)
--- a/toolkit/components/urlformatter/tests/Makefile.in
+++ b/toolkit/components/urlformatter/tests/Makefile.in
@@ -33,16 +33,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = toolkit/components/urlformatter/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = test_urlformatter
 
 XPCSHELL_TESTS = unit
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/content/tests/Makefile.in
+++ b/toolkit/content/tests/Makefile.in
@@ -35,16 +35,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = toolkit/content/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= test_toolkit_general
 
 XPCSHELL_TESTS = unit
 
 DIRS = chrome widgets
--- a/toolkit/crashreporter/test/Makefile.in
+++ b/toolkit/crashreporter/test/Makefile.in
@@ -91,11 +91,11 @@ ifneq (mobile,$(MOZ_BUILD_APP))
   browser/browser_aboutCrashesResubmit.js \
   $(NULL)
 
 libs::  $(_BROWSER_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)/browser
 endif
 
 libs:: $(SHARED_LIBRARY) $(XPIDL_GEN_DIR)/$(XPIDL_MODULE).xpt
-	$(NSINSTALL) -D $(DEPTH)/_tests/xpcshell/$(MODULE)/unit/components
-	$(INSTALL) $^ $(DEPTH)/_tests/xpcshell/$(MODULE)/unit/components
-	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $(srcdir)/testcrasher.manifest > $(DEPTH)/_tests/xpcshell/$(MODULE)/unit/components/testcrasher.manifest
+	$(NSINSTALL) -D $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit/components
+	$(INSTALL) $^ $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit/components
+	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $(srcdir)/testcrasher.manifest > $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit/components/testcrasher.manifest
--- a/toolkit/mozapps/downloads/tests/Makefile.in
+++ b/toolkit/mozapps/downloads/tests/Makefile.in
@@ -36,16 +36,18 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH          = ../../../..
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
+relativesrcdir = toolkit/mozapps/downloads/tests
+
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = test_downloads
 
 XPCSHELL_TESTS = \
   unit \
   $(NULL)
 
--- a/toolkit/mozapps/extensions/test/Makefile.in
+++ b/toolkit/mozapps/extensions/test/Makefile.in
@@ -35,19 +35,20 @@
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH = ../../../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 ADDONSRC = $(srcdir)/addons
-TESTROOT = $(CURDIR)/$(DEPTH)/_tests/xpcshell/$(MODULE)
+relativesrcdir = toolkit/mozapps/extensions/test
+
+TESTROOT = $(CURDIR)/$(DEPTH)/_tests/xpcshell/$(relativesrcdir)
 TESTXPI = $(TESTROOT)/xpcshell/addons
-relativesrcdir  = toolkit/mozapps/extensions/test
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = test_extensionmanager
 
 ifneq (mobile,$(MOZ_BUILD_APP))
  DIRS +=  \
     xpinstall \
--- a/toolkit/mozapps/update/test/Makefile.in
+++ b/toolkit/mozapps/update/test/Makefile.in
@@ -34,30 +34,29 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH     = ../../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
+relativesrcdir = toolkit/mozapps/update/test
 
 include $(DEPTH)/config/autoconf.mk
 
-MODULE = test_update
-
 DIRS = \
   chrome \
   $(NULL)
 
 XPCSHELL_TESTS = \
   unit \
   $(NULL)
 
-TESTROOT = $(call core_abspath,$(DEPTH))/_tests/xpcshell/$(MODULE)
+TESTROOT = $(call core_abspath,$(DEPTH))/_tests/xpcshell/$(relativesrcdir)
 
 CPPSRCS = \
   TestAUSReadStrings.cpp \
   $(NULL)
 
 SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=$(BIN_SUFFIX))
 
 INI_TEST_FILES = \
--- a/toolkit/mozapps/update/test_timermanager/Makefile.in
+++ b/toolkit/mozapps/update/test_timermanager/Makefile.in
@@ -34,16 +34,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH = ../../../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
+relativesrcdir = toolkit/mozapps/update/test_timermanager
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = test_timermanager
 
 XPCSHELL_TESTS = unit
 
 include $(topsrcdir)/config/rules.mk
--- a/uriloader/exthandler/tests/Makefile.in
+++ b/uriloader/exthandler/tests/Makefile.in
@@ -35,16 +35,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH           = ../../..
 topsrcdir       = @top_srcdir@
 srcdir          = @srcdir@
 VPATH           = @srcdir@
+relativesrcdir = uriloader/exthandler/tests
 
 DIRS += mochitest \
         $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE          = test_uriloader_exthandler
 
@@ -65,9 +66,9 @@ LIBS +=		\
 include $(topsrcdir)/config/rules.mk
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 export PERSONAL_MAILCAP=$(shell cd $(srcdir) && pwd)/mailcap
 endif
 
 # need the executable for running the xpcshell unit tests
 libs::
-	$(INSTALL) $(SIMPLE_PROGRAMS) $(DEPTH)/_tests/xpcshell/$(MODULE)/unit
+	$(INSTALL) $(SIMPLE_PROGRAMS) $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit
--- a/xpcom/tests/Makefile.in
+++ b/xpcom/tests/Makefile.in
@@ -34,16 +34,17 @@
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
+relativesrcdir = xpcom/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= xpcom
 
 ifndef MOZ_ENABLE_LIBXUL
 MOZILLA_INTERNAL_API = 1
 endif
@@ -167,17 +168,17 @@ endif
 
 LOCAL_INCLUDES	= \
                 -I$(srcdir)/../ds \
 		-I$(srcdir)/services \
 		$(NULL)
 
 libs::
 	$(INSTALL) $(srcdir)/test.properties $(DIST)/bin/res
-	$(INSTALL) $(SIMPLE_PROGRAMS) $(DEPTH)/_tests/xpcshell/$(MODULE)/unit
+	$(INSTALL) $(SIMPLE_PROGRAMS) $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit
 
 # Copy TestHarness.h into its own module, for ease of setting up includes
 # correctly.
 export::
 	$(NSINSTALL) -D $(DIST)/include/testing
 	$(INSTALL) $(srcdir)/TestHarness.h $(DIST)/include/testing
 
 install::