Bug 702388 - Convert Makefiles to use |TEST_DIRS += foo| r=khuey
authorPanagiotis Koutsourakis <panagiotis.koutsourakis@gmail.com>
Sat, 04 Feb 2012 17:32:24 +0000
changeset 86191 064aba8b26f27c1318be817d277d90ad1b98b581
parent 86190 543de57b25f3874b9943c0f7952a72e6b3dcc25a
child 86192 001b3e1ec98fb0b41f67aba49f77ef6f5c8a61b8
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerskhuey
bugs702388
milestone13.0a1
Bug 702388 - Convert Makefiles to use |TEST_DIRS += foo| r=khuey Files named Makefile.in containing the expression DIRS += <foo> or DIRS = <foo> inside the conditional expression ifdef ENABLE_TESTS ... endif are changed to TEST_DIRS += tests outside any conditional expression. The files ./layout/Makefile.in ./layout/Makefile.in ./layout/style/Makefile.in ./rdf/Makefile.in ./security/manager/Makefile.in ./content/Makefile.in ./content/smil/Makefile.in ./content/xul/templates/Makefile.in ./content/xul/content/Makefile.in ./content/base/Makefile.in ./content/media/Makefile.in ./parser/htmlparser/Makefile.in ./dom/sms/Makefile.in ./js/jsd/Makefile.in ./js/xpconnect/Makefile.in ./widget/Makefile.in ./widget/windows/Makefile.in ./Makefile.in ./startupcache/Makefile.in ./storage/Makefile.in ./gfx/Makefile.in ./intl/strres/Makefile.in ./intl/uconv/Makefile.in ./intl/unicharutil/Makefile.in ./intl/lwbrk/Makefile.in ./embedding/Makefile.in ./modules/libjar/Makefile.in ./modules/libpref/Makefile.in ./build/Makefile.in ./build/win32/Makefile.in ./xpcom/Makefile.in ./extensions/spellcheck/hunspell/Makefile.in ./extensions/cookie/Makefile.in ./netwerk/Makefile.in ./netwerk/streamconv/Makefile.in ./editor/txmgr/Makefile.in ./toolkit/mozapps/shared/Makefile.in ./toolkit/mozapps/update/Makefile.in ./toolkit/library/Makefile.in ./toolkit/library/Makefile.in ./toolkit/crashreporter/Makefile.in ./toolkit/components/perf/Makefile.in ./toolkit/components/perf/Makefile.in ./toolkit/components/feeds/Makefile.in ./toolkit/components/url-classifier/Makefile.in contain the string ifdef ENABLE_TESTS but have some other statement inside (e.g. TOOL_DIRS += <foo> etc) and they remain unchanged by this patch.
accessible/Makefile.in
browser/base/Makefile.in
browser/components/certerror/Makefile.in
browser/components/dirprovider/Makefile.in
browser/components/feeds/Makefile.in
browser/components/places/Makefile.in
browser/components/preferences/Makefile.in
browser/components/privatebrowsing/Makefile.in
browser/components/safebrowsing/Makefile.in
browser/components/search/Makefile.in
browser/components/shell/Makefile.in
browser/components/tabview/Makefile.in
browser/devtools/highlighter/Makefile.in
browser/devtools/scratchpad/Makefile.in
browser/devtools/shared/Makefile.in
browser/devtools/sourceeditor/Makefile.in
browser/devtools/styleeditor/Makefile.in
browser/devtools/tilt/Makefile.in
browser/fuel/Makefile.in
browser/modules/Makefile.in
build/Makefile.in
caps/Makefile.in
chrome/Makefile.in
content/canvas/Makefile.in
content/events/Makefile.in
content/html/content/Makefile.in
content/html/content/test/Makefile.in
content/html/document/Makefile.in
content/svg/content/Makefile.in
content/xbl/Makefile.in
content/xml/document/Makefile.in
content/xslt/Makefile.in
content/xtf/Makefile.in
content/xul/document/Makefile.in
docshell/Makefile.in
dom/Makefile.in
dom/battery/Makefile.in
dom/indexedDB/Makefile.in
dom/ipc/Makefile.in
dom/network/Makefile.in
dom/plugins/test/Makefile.in
dom/src/Makefile.in
dom/src/json/Makefile.in
dom/src/jsurl/Makefile.in
dom/workers/Makefile.in
editor/composer/Makefile.in
editor/libeditor/base/Makefile.in
editor/libeditor/html/Makefile.in
editor/libeditor/text/Makefile.in
extensions/spellcheck/Makefile.in
extensions/universalchardet/Makefile.in
image/Makefile.in
intl/locale/Makefile.in
js/src/Makefile.in
layout/base/Makefile.in
layout/forms/Makefile.in
layout/generic/Makefile.in
layout/tables/Makefile.in
mobile/android/chrome/Makefile.in
mobile/xul/chrome/Makefile.in
modules/libjar/zipwriter/Makefile.in
parser/xml/Makefile.in
security/manager/ssl/Makefile.in
services/crypto/Makefile.in
services/crypto/component/Makefile.in
services/sync/Makefile.in
testing/xpcshell/Makefile.in
toolkit/components/alerts/Makefile.in
toolkit/components/autocomplete/Makefile.in
toolkit/components/commandlines/Makefile.in
toolkit/components/contentprefs/Makefile.in
toolkit/components/ctypes/Makefile.in
toolkit/components/downloads/Makefile.in
toolkit/components/microformats/Makefile.in
toolkit/components/passwordmgr/Makefile.in
toolkit/components/places/Makefile.in
toolkit/components/prompts/Makefile.in
toolkit/components/satchel/Makefile.in
toolkit/components/search/Makefile.in
toolkit/components/telemetry/Makefile.in
toolkit/components/urlformatter/Makefile.in
toolkit/components/viewsource/Makefile.in
toolkit/content/Makefile.in
toolkit/mozapps/downloads/Makefile.in
toolkit/mozapps/extensions/Makefile.in
toolkit/mozapps/plugins/Makefile.in
toolkit/profile/Makefile.in
toolkit/themes/pinstripe/Makefile.in
toolkit/xre/Makefile.in
uriloader/exthandler/Makefile.in
--- a/accessible/Makefile.in
+++ b/accessible/Makefile.in
@@ -40,14 +40,12 @@ topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH   = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE	= accessibility
 DIRS    = public src build
 
-ifdef ENABLE_TESTS
-DIRS    += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
 
--- a/browser/base/Makefile.in
+++ b/browser/base/Makefile.in
@@ -44,19 +44,17 @@ VPATH   = @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
 abs_srcdir = $(call core_abspath,$(srcdir))
 
 CHROME_DEPS += $(abs_srcdir)/content/overrides/app-license.html
 
-ifdef ENABLE_TESTS
-DIRS += content/test
-endif
+TEST_DIRS += content/test
 
 include $(topsrcdir)/config/rules.mk
 
 PRE_RELEASE_SUFFIX := ""
 
 DEFINES += \
 	-DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
 	-DAPP_LICENSE_BLOCK=$(abs_srcdir)/content/overrides/app-license.html \
--- a/browser/components/certerror/Makefile.in
+++ b/browser/components/certerror/Makefile.in
@@ -38,13 +38,11 @@
 
 DEPTH     = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/components/dirprovider/Makefile.in
+++ b/browser/components/dirprovider/Makefile.in
@@ -40,19 +40,17 @@ topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = browserdir
 LIBRARY_NAME = browserdir_s
 
-ifdef ENABLE_TESTS
-DIRS = tests
-endif
+TEST_DIRS += tests
 
 FORCE_STATIC_LIB = 1
 
 # Because we are an application component, link against the CRT statically
 # (on Windows, but only if we're not building our own CRT for jemalloc)
 ifndef MOZ_MEMORY
 USE_STATIC_LIBS      = 1
 endif
--- a/browser/components/feeds/Makefile.in
+++ b/browser/components/feeds/Makefile.in
@@ -38,13 +38,11 @@ DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = public src
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/components/places/Makefile.in
+++ b/browser/components/places/Makefile.in
@@ -40,15 +40,13 @@ DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = src
 
-ifdef ENABLE_TESTS
-	DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
 
 XPIDL_FLAGS += -I$(topsrcdir)/browser/components/
--- a/browser/components/preferences/Makefile.in
+++ b/browser/components/preferences/Makefile.in
@@ -38,19 +38,17 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
 
 DEFINES += \
 	-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
 	-DMOZ_MACBUNDLE_NAME=$(MOZ_MACBUNDLE_NAME) \
 	$(NULL)
 
--- a/browser/components/privatebrowsing/Makefile.in
+++ b/browser/components/privatebrowsing/Makefile.in
@@ -41,13 +41,11 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = privatebrowsing
 
 DIRS = src
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/components/safebrowsing/Makefile.in
+++ b/browser/components/safebrowsing/Makefile.in
@@ -38,19 +38,17 @@
 
 DEPTH     = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-DIRS += content/test
-endif
+TEST_DIRS += content/test
 
 ifdef MOZILLA_OFFICIAL
 DEFINES += -DOFFICIAL_BUILD=1
 endif
 
 EXTRA_COMPONENTS = \
   src/nsSafebrowsingApplication.manifest \
   $(NULL)
--- a/browser/components/search/Makefile.in
+++ b/browser/components/search/Makefile.in
@@ -38,13 +38,11 @@
 
 DEPTH     = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-DIRS = test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/components/shell/Makefile.in
+++ b/browser/components/shell/Makefile.in
@@ -39,13 +39,11 @@ DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = public src
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/components/tabview/Makefile.in
+++ b/browser/components/tabview/Makefile.in
@@ -38,16 +38,14 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-	DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
 
 libs::
 	$(NSINSTALL) $(srcdir)/modules/* $(FINAL_TARGET)/modules/tabview
--- a/browser/devtools/highlighter/Makefile.in
+++ b/browser/devtools/highlighter/Makefile.in
@@ -47,13 +47,11 @@ include $(DEPTH)/config/autoconf.mk
 EXTRA_JS_MODULES = \
 	inspector.jsm \
 	domplate.jsm \
 	InsideOutBox.jsm \
 	TreePanel.jsm \
 	highlighter.jsm \
 	$(NULL)
 
-ifdef ENABLE_TESTS
- 	DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/devtools/scratchpad/Makefile.in
+++ b/browser/devtools/scratchpad/Makefile.in
@@ -38,16 +38,14 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-	DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
 
 libs::
 	$(NSINSTALL) $(srcdir)/*.jsm $(FINAL_TARGET)/modules/devtools
--- a/browser/devtools/shared/Makefile.in
+++ b/browser/devtools/shared/Makefile.in
@@ -40,16 +40,14 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-	DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
 
 libs::
 	$(NSINSTALL) $(srcdir)/*.jsm $(FINAL_TARGET)/modules/devtools
--- a/browser/devtools/sourceeditor/Makefile.in
+++ b/browser/devtools/sourceeditor/Makefile.in
@@ -39,19 +39,17 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-	DIRS += test
-endif
+TEST_DIRS += test
 
 EXTRA_JS_MODULES = \
 	source-editor.jsm \
 	source-editor-orion.jsm \
 	source-editor-textarea.jsm \
 	source-editor-ui.jsm \
 	$(NULL)
 
--- a/browser/devtools/styleeditor/Makefile.in
+++ b/browser/devtools/styleeditor/Makefile.in
@@ -37,16 +37,14 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
 
 libs::
 	$(NSINSTALL) $(srcdir)/*.jsm $(FINAL_TARGET)/modules/devtools
--- a/browser/devtools/tilt/Makefile.in
+++ b/browser/devtools/tilt/Makefile.in
@@ -37,17 +37,15 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-	DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
 
 libs::
 	$(NSINSTALL) $(srcdir)/*.jsm $(FINAL_TARGET)/modules/devtools
 	$(NSINSTALL) $(srcdir)/*.js $(FINAL_TARGET)/modules/devtools
--- a/browser/fuel/Makefile.in
+++ b/browser/fuel/Makefile.in
@@ -39,14 +39,12 @@ DEPTH     = ../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = public src
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
 
--- a/browser/modules/Makefile.in
+++ b/browser/modules/Makefile.in
@@ -39,19 +39,17 @@ DEPTH   = ../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH   = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/config.mk
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 EXTRA_JS_MODULES = \
 	openLocationLastURL.jsm \
 	NetworkPrioritizer.jsm \
 	NewTabUtils.jsm \
 	offlineAppCache.jsm \
 	TelemetryTimestamps.jsm \
 	$(NULL)
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -50,27 +50,25 @@ DIRS		= unix
 endif
 
 ifeq (WINNT,$(OS_ARCH))
 DIRS = win32
 endif
 
 DIRS += pgo
 
-ifdef ENABLE_TESTS
-  DIRS += autoconf/test
+TEST_DIRS += autoconf/test
 ifeq (android,$(MOZ_WIDGET_TOOLKIT))
-  DIRS += mobile/sutagent/android \
+TEST_DIRS += mobile/sutagent/android \
           mobile/sutagent/android/watcher \
           mobile/sutagent/android/ffxcp \
           mobile/sutagent/android/fencp \
           mobile/robocop \
           $(NULL)
 endif
-endif
 
 ifdef MOZ_APP_BASENAME
 DIST_FILES = application.ini
 
 ifdef LIBXUL_SDK
 GRE_MILESTONE = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build Milestone)
 APP_INI_DEPS = $(LIBXUL_DIST)/bin/platform.ini
 else
--- a/caps/Makefile.in
+++ b/caps/Makefile.in
@@ -40,14 +40,12 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= caps
 DIRS		= idl include src
 
-ifdef ENABLE_TESTS
-DIRS += tests/mochitest
-endif
+TEST_DIRS += tests/mochitest
 
 include $(topsrcdir)/config/rules.mk
 
--- a/chrome/Makefile.in
+++ b/chrome/Makefile.in
@@ -39,14 +39,12 @@ DEPTH		= ..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = public src
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
 
--- a/content/canvas/Makefile.in
+++ b/content/canvas/Makefile.in
@@ -40,14 +40,12 @@ DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 PARALLEL_DIRS	= public src
 
-ifdef ENABLE_TESTS
-DIRS		+= test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
 
--- a/content/events/Makefile.in
+++ b/content/events/Makefile.in
@@ -39,14 +39,12 @@ DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 PARALLEL_DIRS	= public src
 
-ifdef ENABLE_TESTS
-DIRS		+= test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
 
--- a/content/html/content/Makefile.in
+++ b/content/html/content/Makefile.in
@@ -39,14 +39,12 @@ DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 PARALLEL_DIRS	= public src
 
-ifdef ENABLE_TESTS
-DIRS		+= test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
 
--- a/content/html/content/test/Makefile.in
+++ b/content/html/content/test/Makefile.in
@@ -38,28 +38,26 @@
 DEPTH          = ../../../..
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
 relativesrcdir = content/html/content/test
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
 # This extra subdirectory is needed due to the nature of this test.
 # With the bug, the test loads the base URL of the bug649134/file_*.sjs
 # files, and the mochitest server responds with the contents of index.html if
 # it exists in that case, which we use to detect failure.
 # We can't have index.html in this directory because it would prevent
 # running the tests here.
-DIRS		+= bug649134
+TEST_DIRS += bug649134
 
 # For form-related test suite.
-DIRS		+= forms
-endif
+TEST_DIRS += forms
 
 include $(topsrcdir)/config/rules.mk
 
 _TEST_FILES = \
 		test_hidden.html \
 		test_bug589.html \
 		test_bug691.html \
 		nnc_lockup.gif \
--- a/content/html/document/Makefile.in
+++ b/content/html/document/Makefile.in
@@ -39,14 +39,12 @@ DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 PARALLEL_DIRS	= public src
 
-ifdef ENABLE_TESTS
-DIRS		+= test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
 
--- a/content/svg/content/Makefile.in
+++ b/content/svg/content/Makefile.in
@@ -40,14 +40,12 @@ DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 PARALLEL_DIRS		= src
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
 
--- a/content/xbl/Makefile.in
+++ b/content/xbl/Makefile.in
@@ -39,13 +39,11 @@ DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 PARALLEL_DIRS	= public src builtin
 
-ifdef ENABLE_TESTS
-DIRS		+= test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/content/xml/document/Makefile.in
+++ b/content/xml/document/Makefile.in
@@ -39,14 +39,12 @@ DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 PARALLEL_DIRS	= public resources src
 
-ifdef ENABLE_TESTS
-DIRS            += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
 
--- a/content/xslt/Makefile.in
+++ b/content/xslt/Makefile.in
@@ -39,14 +39,12 @@ DEPTH = ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 PARALLEL_DIRS = public src
 
-ifdef ENABLE_TESTS
-DIRS += tests/buster \
-	tests/mochitest
-endif
+TEST_DIRS += tests/buster \
+             tests/mochitest
 
 include $(topsrcdir)/config/rules.mk
--- a/content/xtf/Makefile.in
+++ b/content/xtf/Makefile.in
@@ -39,13 +39,11 @@ DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 PARALLEL_DIRS	=  public src
 
-ifdef ENABLE_TESTS
-DIRS  += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/content/xul/document/Makefile.in
+++ b/content/xul/document/Makefile.in
@@ -40,14 +40,12 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= xuldoc
 PARALLEL_DIRS	= public src
 
-ifdef ENABLE_TESTS
-DIRS		+= test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
 
--- a/docshell/Makefile.in
+++ b/docshell/Makefile.in
@@ -46,13 +46,11 @@ include $(DEPTH)/config/autoconf.mk
 MODULE = docshell
 DIRS = \
 	base \
 	shistory \
 	build \
 	resources/content \
 	$(NULL)
 
-ifdef ENABLE_TESTS
-DIRS		+= test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/dom/Makefile.in
+++ b/dom/Makefile.in
@@ -92,16 +92,14 @@ DIRS += \
 
 ifdef MOZ_B2G_RIL
 DIRS += \
   telephony \
   wifi \
   $(NULL)
 endif
 
-ifdef ENABLE_TESTS
-DIRS += tests
+TEST_DIRS += tests
 ifneq (,$(filter gtk2 cocoa windows android qt os2,$(MOZ_WIDGET_TOOLKIT)))
-DIRS += plugins/test
-endif
+TEST_DIRS += plugins/test
 endif
 
 include $(topsrcdir)/config/rules.mk
--- a/dom/battery/Makefile.in
+++ b/dom/battery/Makefile.in
@@ -63,15 +63,13 @@ LOCAL_INCLUDES = \
   -I$(topsrcdir)/content/events/src \
   $(NULL)
 
 XPIDLSRCS = \
   nsIDOMBatteryManager.idl \
   nsIDOMNavigatorBattery.idl \
   $(NULL)
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 include $(topsrcdir)/config/rules.mk
--- a/dom/indexedDB/Makefile.in
+++ b/dom/indexedDB/Makefile.in
@@ -116,15 +116,13 @@ XPIDLSRCS = \
   nsIIDBObjectStore.idl \
   nsIIDBRequest.idl \
   nsIIDBTransaction.idl \
   nsIIDBVersionChangeEvent.idl \
   nsIIDBOpenDBRequest.idl \
   nsIIndexedDatabaseManager.idl \
   $(NULL)
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 include $(topsrcdir)/config/rules.mk
--- a/dom/ipc/Makefile.in
+++ b/dom/ipc/Makefile.in
@@ -42,20 +42,18 @@ VPATH = @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = dom
 LIBRARY_NAME = domipc_s
 LIBXUL_LIBRARY = 1
 FORCE_STATIC_LIB = 1
 EXPORT_LIBRARY = 1
 
-ifdef ENABLE_TESTS
 ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-DIRS += tests
-endif
+TEST_DIRS += tests
 endif
 
 EXPORTS = TabMessageUtils.h PCOMContentPermissionRequestChild.h
 
 EXPORTS_NAMESPACES = mozilla/dom
 
 EXPORTS_mozilla/dom = \
   ContentChild.h \
--- a/dom/network/Makefile.in
+++ b/dom/network/Makefile.in
@@ -38,13 +38,11 @@ DEPTH            = ../..
 topsrcdir        = @top_srcdir@
 srcdir           = @srcdir@
 VPATH            = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 PARALLEL_DIRS = interfaces src
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
--- a/dom/plugins/test/Makefile.in
+++ b/dom/plugins/test/Makefile.in
@@ -48,14 +48,12 @@ MODULE = test_plugin
 
 DIRS = testplugin
 
 XPCSHELL_TESTS = \
   unit \
   $(NULL)
 
 ifneq (,$(filter gtk2 cocoa windows,$(MOZ_WIDGET_TOOLKIT)))
-ifdef ENABLE_TESTS
-DIRS  += mochitest
-endif
+TEST_DIRS += mochitest
 endif
 
 include $(topsrcdir)/config/rules.mk
--- a/dom/src/Makefile.in
+++ b/dom/src/Makefile.in
@@ -39,13 +39,11 @@ DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS		= jsurl events storage offline json geolocation notification
 
-ifdef ENABLE_TESTS
-DIRS		+= foo
-endif
+TEST_DIRS += foo
 
 include $(topsrcdir)/config/rules.mk
--- a/dom/src/json/Makefile.in
+++ b/dom/src/json/Makefile.in
@@ -57,13 +57,11 @@ EXPORTS = nsJSON.h \
 FORCE_STATIC_LIB = 1
 
 LOCAL_INCLUDES = \
 		-I$(srcdir)/../base \
 		-I$(topsrcdir)/content/events/src
 
 DEFINES += -D_IMPL_NS_LAYOUT
 
-ifdef ENABLE_TESTS
-  DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/dom/src/jsurl/Makefile.in
+++ b/dom/src/jsurl/Makefile.in
@@ -63,14 +63,12 @@ LOCAL_INCLUDES += \
 		-I$(topsrcdir)/dom/base \
 		-I$(topsrcdir)/netwerk/base/src \
 
 ifdef BUILD_DEBUG_GC
 DEFINES		+= -DDEBUG_GC
 endif
 
 DIRS            = $(NULL)
-ifdef ENABLE_TESTS
-DIRS            += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
 
--- a/dom/workers/Makefile.in
+++ b/dom/workers/Makefile.in
@@ -75,13 +75,11 @@ CPPSRCS = \
 
 LOCAL_INCLUDES = \
   -I$(topsrcdir)/content/base/src \
   -I$(topsrcdir)/content/events/src \
   -I$(topsrcdir)/dom/base \
   -I$(topsrcdir)/xpcom/build \
   $(NULL)
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/editor/composer/Makefile.in
+++ b/editor/composer/Makefile.in
@@ -39,19 +39,17 @@ DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS		= public src
 
-ifdef ENABLE_TESTS
-DIRS		+= test
-endif
+TEST_DIRS += test
 
 # Enable Editor API Logging!
 ENABLE_EDITOR_API_LOG=1
 
 ifdef ENABLE_EDITOR_API_LOG
 DEFINES += -DENABLE_EDITOR_API_LOG
 endif
 
--- a/editor/libeditor/base/Makefile.in
+++ b/editor/libeditor/base/Makefile.in
@@ -38,19 +38,17 @@
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 FAIL_ON_WARNINGS = 1
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-DIRS            += tests
-endif
+TEST_DIRS += tests
 
 MODULE		= editor
 LIBRARY_NAME	= editorbase_s
 LIBXUL_LIBRARY	= 1
 
 
 # Internal header files, needed by other editor sublibs:
 INTERNAL_HDR_DIR = ../internal
--- a/editor/libeditor/html/Makefile.in
+++ b/editor/libeditor/html/Makefile.in
@@ -38,19 +38,17 @@
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 FAIL_ON_WARNINGS = 1
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-DIRS            += tests
-endif
+TEST_DIRS += tests
 
 MODULE		= editor
 LIBRARY_NAME	= htmleditor_s
 LIBXUL_LIBRARY	= 1
 
 
 # Building the full blown HTML Editor  so add its source files and objects:
 
--- a/editor/libeditor/text/Makefile.in
+++ b/editor/libeditor/text/Makefile.in
@@ -38,19 +38,17 @@
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 FAIL_ON_WARNINGS = 1
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-DIRS            += tests
-endif
+TEST_DIRS += tests
 
 MODULE		= editor
 LIBRARY_NAME	= texteditor_s
 LIBXUL_LIBRARY	= 1
 
 
 CPPSRCS		=                           \
 		nsPlaintextDataTransfer.cpp \
--- a/extensions/spellcheck/Makefile.in
+++ b/extensions/spellcheck/Makefile.in
@@ -39,13 +39,11 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= spellchecker
 DIRS		= idl locales hunspell src
 
-ifdef ENABLE_TESTS
-DIRS += tests/chrome
-endif
+TEST_DIRS += tests/chrome
 
 include $(topsrcdir)/config/rules.mk
--- a/extensions/universalchardet/Makefile.in
+++ b/extensions/universalchardet/Makefile.in
@@ -40,14 +40,12 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= universalchardet
 DIRS		= src
 
-ifdef ENABLE_TESTS
-DIRS		+= tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
 
--- a/image/Makefile.in
+++ b/image/Makefile.in
@@ -41,17 +41,15 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= imglib2
 
 PARALLEL_DIRS		= public src decoders encoders
 
-ifdef ENABLE_TESTS
-DIRS  += test
-endif
+TEST_DIRS += test
 
 DIRS		+= build
 
 include $(topsrcdir)/config/rules.mk
 
 
--- a/intl/locale/Makefile.in
+++ b/intl/locale/Makefile.in
@@ -42,14 +42,12 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= locale
 DIRS		= public idl src
 
-ifdef ENABLE_TESTS
-DIRS		+= tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
 
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -56,24 +56,20 @@ endif
 
 # editline needs to get built before the shell
 ifndef JS_DISABLE_SHELL
 DIRS += shell
 endif
 
 # FIXME: bug 530688 covers getting these working on Android
 ifneq ($(OS_ARCH),ANDROID)
-ifdef ENABLE_TESTS
-DIRS += jsapi-tests
-endif
+TEST_DIRS += jsapi-tests
 endif
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 MODULE		    = js
 LIBRARY_NAME	    = mozjs
 STATIC_LIBRARY_NAME = js_static
 GRE_MODULE	    = 1
 
 LIBS		= $(NSPR_LIBS) 
 
--- a/layout/base/Makefile.in
+++ b/layout/base/Makefile.in
@@ -37,19 +37,17 @@
 
 DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-DIRS		+= tests
-endif
+TEST_DIRS += tests
 
 MODULE		= layout
 XPIDL_MODULE	= layout_base
 GRE_MODULE	= 1
 LIBRARY_NAME	= gkbase_s
 LIBXUL_LIBRARY	= 1
 
 
--- a/layout/forms/Makefile.in
+++ b/layout/forms/Makefile.in
@@ -39,19 +39,17 @@ DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = $(NULL)
 
-ifdef ENABLE_TESTS
-DIRS		+= test
-endif
+TEST_DIRS += test
 
 MODULE		= layout
 XPIDL_MODULE	= layout_forms
 LIBRARY_NAME	= gkforms_s
 LIBXUL_LIBRARY	= 1
 
 XPIDLSRCS       = nsICapturePicker.idl
 
--- a/layout/generic/Makefile.in
+++ b/layout/generic/Makefile.in
@@ -36,19 +36,17 @@
 
 DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-DIRS		+= test
-endif
+TEST_DIRS += test
 
 MODULE		= layout
 LIBRARY_NAME	= gkgeneric_s
 LIBXUL_LIBRARY	= 1
 
 
 
 EXPORTS		= \
--- a/layout/tables/Makefile.in
+++ b/layout/tables/Makefile.in
@@ -67,19 +67,18 @@ CPPSRCS		= \
 		nsTableRowFrame.cpp \
 		nsTableRowGroupFrame.cpp \
 		nsTablePainter.cpp \
 		$(NULL)
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
-ifdef ENABLE_TESTS
-DIRS  = test
-endif
+TEST_DIRS += test
+
 
 include $(topsrcdir)/config/rules.mk
 
 DEFINES         += -DDEBUG_TABLE_STRATEGY_off -D_IMPL_NS_LAYOUT
 
 LOCAL_INCLUDES	= \
 		-I$(srcdir)/../base \
 		-I$(srcdir)/../generic \
--- a/mobile/android/chrome/Makefile.in
+++ b/mobile/android/chrome/Makefile.in
@@ -43,13 +43,11 @@ VPATH     = @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 DEFINES += -DAB_CD=$(MOZ_UI_LOCALE) \
            -DPACKAGE=browser \
            -DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
            $(NULL)
 
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
--- a/mobile/xul/chrome/Makefile.in
+++ b/mobile/xul/chrome/Makefile.in
@@ -43,13 +43,11 @@ VPATH     = @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 DEFINES += -DAB_CD=$(MOZ_UI_LOCALE) \
            -DPACKAGE=browser \
            -DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
            $(NULL)
 
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
--- a/modules/libjar/zipwriter/Makefile.in
+++ b/modules/libjar/zipwriter/Makefile.in
@@ -41,13 +41,11 @@ srcdir                = @srcdir@
 VPATH                 = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE                = zipwriter
 
 DIRS                  = public src
 
-ifdef ENABLE_TESTS
-DIRS                 += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/parser/xml/Makefile.in
+++ b/parser/xml/Makefile.in
@@ -38,13 +38,11 @@ DEPTH           = ../..
 topsrcdir       = @top_srcdir@
 srcdir          = @srcdir@
 VPATH           = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS            = public src
 
-ifdef ENABLE_TESTS
-DIRS  += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/security/manager/ssl/Makefile.in
+++ b/security/manager/ssl/Makefile.in
@@ -41,13 +41,11 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= pipnss
 DIRS		= src public
 
-ifdef ENABLE_TESTS
-DIRS		+= tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
--- a/services/crypto/Makefile.in
+++ b/services/crypto/Makefile.in
@@ -43,13 +43,11 @@ VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = services-crypto
 
 libs::
 	$(PYTHON) $(topsrcdir)/config/nsinstall.py $(srcdir)/modules/* $(FINAL_TARGET)/modules/services-crypto
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
--- a/services/crypto/component/Makefile.in
+++ b/services/crypto/component/Makefile.in
@@ -58,13 +58,11 @@ IS_COMPONENT   = 1
 MODULE_NAME    = nsServicesCryptoModule
 LIBXUL_LIBRARY = 1
 MOZILLA_INTERNAL_API = 1
 
 CPPSRCS = \
   nsSyncJPAKE.cpp \
   $(NULL)
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
--- a/services/sync/Makefile.in
+++ b/services/sync/Makefile.in
@@ -81,13 +81,11 @@ ifndef NO_DIST_INSTALL
 	for i in $$files; do \
 		src=$(srcdir)/modules/$$i; \
 		dest=$(FINAL_TARGET)/modules/services-sync/$$i; \
 		$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(SYNC_PP_DEFINES) $$src > $$dest ; \
 	done
 endif
 
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
--- a/testing/xpcshell/Makefile.in
+++ b/testing/xpcshell/Makefile.in
@@ -42,19 +42,17 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= testing_xpcshell
 
 # Here's how you let the build system know there are tests in the
 # "example" folder:
-ifdef ENABLE_TESTS
-DIRS  += example
-endif
+TEST_DIRS += example
 
 include $(topsrcdir)/config/rules.mk
 
 # Harness files from the srcdir
 TEST_HARNESS_FILES := \
   runxpcshelltests.py \
   remotexpcshelltests.py \
   head.js \
--- a/toolkit/components/alerts/Makefile.in
+++ b/toolkit/components/alerts/Makefile.in
@@ -60,18 +60,16 @@ ifneq (,$(filter cocoa, $(MOZ_WIDGET_TOO
 XPIDLSRCS += nsINotificationsList.idl
 # mac/growl needs to be first for linking to work!
 DIRS += \
   mac/growl \
   mac \
   $(NULL)
 endif
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 ifneq (,$(filter $(MOZ_WIDGET_TOOLKIT),windows gtk2 qt android))
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 endif
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/autocomplete/Makefile.in
+++ b/toolkit/components/autocomplete/Makefile.in
@@ -59,13 +59,11 @@ XPIDLSRCS = \
   nsIAutoCompleteSimpleResult.idl \
   $(NULL)
 
 CPPSRCS = \
   nsAutoCompleteController.cpp \
   nsAutoCompleteSimpleResult.cpp \
   $(NULL)
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/commandlines/Makefile.in
+++ b/toolkit/components/commandlines/Makefile.in
@@ -57,13 +57,11 @@ XPIDLSRCS = \
   nsICommandLineRunner.idl \
   nsICommandLineValidator.idl \
   $(NULL)
 
 CPPSRCS = \
   nsCommandLine.cpp \
   $(NULL)
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/contentprefs/Makefile.in
+++ b/toolkit/components/contentprefs/Makefile.in
@@ -40,13 +40,11 @@ srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = contentprefs
 
 EXTRA_COMPONENTS = nsContentPrefService.js nsContentPrefService.manifest
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/ctypes/Makefile.in
+++ b/toolkit/components/ctypes/Makefile.in
@@ -55,13 +55,11 @@ LIBRARY_NAME = jsctypes
 LIBXUL_LIBRARY = 1
 EXPORT_LIBRARY = 1
 IS_COMPONENT = 1
 
 CPPSRCS = \
     ctypes.cpp \
     $(NULL)
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/downloads/Makefile.in
+++ b/toolkit/components/downloads/Makefile.in
@@ -70,13 +70,11 @@ ifndef MOZ_SUITE
 # XXX - Until Suite builds off XULRunner we can't guarantee our implementation
 # of nsIDownloadManagerUI overrides toolkit's.
 EXTRA_COMPONENTS = \
   nsDownloadManagerUI.js \
   nsDownloadManagerUI.manifest \
   $(NULL)
 endif
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/microformats/Makefile.in
+++ b/toolkit/components/microformats/Makefile.in
@@ -40,13 +40,11 @@ srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = microformats
 
 EXTRA_JS_MODULES = Microformats.js
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/passwordmgr/Makefile.in
+++ b/toolkit/components/passwordmgr/Makefile.in
@@ -60,13 +60,11 @@ EXTRA_COMPONENTS = \
   nsLoginInfo.js \
   nsLoginManager.js \
   nsLoginManagerPrompter.js \
   passwordmgr.manifest \
   storage-Legacy.js \
   storage-mozStorage.js \
   $(NULL)
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/places/Makefile.in
+++ b/toolkit/components/places/Makefile.in
@@ -123,18 +123,16 @@ endif
 EXTRA_JS_MODULES = \
   PlacesDBUtils.jsm \
   $(NULL)
 
 EXTRA_PP_JS_MODULES = \
   PlacesUtils.jsm \
   $(NULL)
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 
 endif
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/prompts/Makefile.in
+++ b/toolkit/components/prompts/Makefile.in
@@ -38,13 +38,11 @@ DEPTH     = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = src
 
-ifdef ENABLE_TESTS
-DIRS  += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/satchel/Makefile.in
+++ b/toolkit/components/satchel/Makefile.in
@@ -71,13 +71,11 @@ EXTRA_COMPONENTS = \
   nsInputListAutoComplete.js \
   satchel.manifest \
   $(NULL)
 
 EXTRA_JS_MODULES = \
   nsFormAutoCompleteResult.jsm \
   $(NULL)
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/search/Makefile.in
+++ b/toolkit/components/search/Makefile.in
@@ -44,13 +44,11 @@ VPATH     = @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 EXTRA_COMPONENTS = toolkitsearch.manifest
 EXTRA_PP_COMPONENTS = nsSearchService.js \
 	nsSearchSuggestions.js
 
 DEFINES += -DMOZ_DISTRIBUTION_ID=$(MOZ_DISTRIBUTION_ID)
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/telemetry/Makefile.in
+++ b/toolkit/components/telemetry/Makefile.in
@@ -74,15 +74,13 @@ CPPSRCS = \
   Telemetry.cpp \
   $(NULL)
 
 EXTRA_DSO_LDOPTS += \
   $(MOZ_COMPONENT_LIBS) \
   $(MOZ_JS_LIBS) \
   $(NULL)
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/config/rules.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
--- a/toolkit/components/urlformatter/Makefile.in
+++ b/toolkit/components/urlformatter/Makefile.in
@@ -51,13 +51,11 @@ XPIDLSRCS = \
 EXTRA_COMPONENTS = \
   nsURLFormatter.manifest \
   $(NULL)
 
 EXTRA_PP_COMPONENTS = \
   nsURLFormatter.js \
   $(NULL)
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/viewsource/Makefile.in
+++ b/toolkit/components/viewsource/Makefile.in
@@ -38,13 +38,11 @@
 
 DEPTH     = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-ifdef ENABLE_TESTS
-DIRS = test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/content/Makefile.in
+++ b/toolkit/content/Makefile.in
@@ -76,19 +76,17 @@ SOURCE_REPO := $(shell cd $(topsrcdir) &
 ifeq (http,$(patsubst http%,http,$(SOURCE_REPO)))
 DEFINES += -DSOURCE_REPO="$(SOURCE_REPO)"
 endif
 
 ifdef MOZ_TOOLKIT_SEARCH
 DEFINES += -DMOZ_TOOLKIT_SEARCH
 endif
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 EXTRA_JS_MODULES = \
   Geometry.jsm \
   InlineSpellChecker.jsm \
   PopupNotifications.jsm \
   Dict.jsm \
   PropertyListUtils.jsm \
   $(NULL)
--- a/toolkit/mozapps/downloads/Makefile.in
+++ b/toolkit/mozapps/downloads/Makefile.in
@@ -54,13 +54,11 @@ EXTRA_JS_MODULES = \
   $(NULL)
 
 ifeq ($(OS_ARCH),WINNT)
 EXTRA_JS_MODULES += \
   DownloadTaskbarProgress.jsm \
   $(NULL)
 endif
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/mozapps/extensions/Makefile.in
+++ b/toolkit/mozapps/extensions/Makefile.in
@@ -71,19 +71,17 @@ EXTRA_PP_JS_MODULES = \
   $(NULL)
 
 EXTRA_JS_MODULES = \
   ChromeManifestParser.jsm \
   LightweightThemeManager.jsm \
   SpellCheckDictionaryBootstrap.js \
   $(NULL)
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 EXTRA_DSO_LDOPTS = \
   $(MOZ_JS_LIBS) \
   $(MOZ_UNICHARUTIL_LIBS) \
   $(MOZ_COMPONENT_LIBS) \
   $(NULL)
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/mozapps/plugins/Makefile.in
+++ b/toolkit/mozapps/plugins/Makefile.in
@@ -39,13 +39,11 @@ DEPTH   = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH   = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 EXTRA_COMPONENTS = pluginGlue.manifest
 
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
+TEST_DIRS += tests
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/profile/Makefile.in
+++ b/toolkit/profile/Makefile.in
@@ -63,16 +63,14 @@ LOCAL_INCLUDES = \
   -I$(srcdir)/../xre \
   -I$(topsrcdir)/profile/dirserviceprovider/src \
   $(NULL)
 
 DEFINES += -DIMPL_XREAPI
 
 GARBAGE += nsProfileLock.cpp
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/rules.mk
 
 export:: $(topsrcdir)/profile/dirserviceprovider/src/nsProfileLock.cpp
 	$(INSTALL) $^ .
--- a/toolkit/themes/pinstripe/Makefile.in
+++ b/toolkit/themes/pinstripe/Makefile.in
@@ -43,13 +43,11 @@ VPATH     = @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 DIRS	= global mozapps
 
 ifdef MOZ_HELP_VIEWER
 DIRS	+= help
 endif
 
-ifdef ENABLE_TESTS
-DIRS  += mochitests
-endif
+TEST_DIRS += mochitests
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/xre/Makefile.in
+++ b/toolkit/xre/Makefile.in
@@ -175,19 +175,17 @@ SHARED_LIBRARY_LIBS += \
   $(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/solaris/handler/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \
   $(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/$(LIB_PREFIX)minidump_file_writer_s.$(LIB_SUFFIX) \
   $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/$(LIB_PREFIX)breakpad_common_s.$(LIB_SUFFIX) \
   $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/solaris/$(LIB_PREFIX)breakpad_solaris_common_s.$(LIB_SUFFIX) \
   $(NULL)
 endif
 endif
 
-ifdef ENABLE_TESTS
-DIRS += test
-endif
+TEST_DIRS += test
 
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES += \
   -I$(topsrcdir)/dom/ipc \
   -I$(topsrcdir)/toolkit/crashreporter \
--- a/uriloader/exthandler/Makefile.in
+++ b/uriloader/exthandler/Makefile.in
@@ -39,19 +39,17 @@ DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
        $(NULL)
 
-ifdef ENABLE_TESTS
-  DIRS += tests
-endif
+TEST_DIRS += tests
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
 OSDIR		= os2
 else
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
 OSDIR		= win
 else
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)