Index: gst/gst.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/gst/gst.c,v
retrieving revision 1.90.4.1
diff -u -p -r1.90.4.1 gst.c
--- gst/gst.c	7 Apr 2003 16:41:38 -0000	1.90.4.1
+++ gst/gst.c	13 Apr 2003 21:47:48 -0000
@@ -394,8 +394,15 @@ init_pre (void)
   gst_registry_add_path (_global_registry, PLUGINS_DIR);
 #endif /* PLUGINS_USE_BUILDDIR */
 
-  homedir = g_get_home_dir ();
-  user_reg = g_strjoin ("/", homedir, LOCAL_REGISTRY_FILE, NULL);
+  if (g_getenv ("GST_REGISTRY"))
+  {
+    user_reg = g_strdup (g_getenv ("GST_REGISTRY"));
+  }
+  else
+  {
+    homedir = g_get_home_dir ();
+    user_reg = g_strjoin ("/", homedir, LOCAL_REGISTRY_FILE, NULL);
+  }
   _user_registry = gst_xml_registry_new ("user_registry", user_reg);
 
 #ifndef GST_DISABLE_REGISTRY
Index: testsuite/Makefile.am
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/testsuite/Makefile.am,v
retrieving revision 1.34.6.2
diff -u -p -r1.34.6.2 Makefile.am
--- testsuite/Makefile.am	1 Feb 2003 23:57:39 -0000	1.34.6.2
+++ testsuite/Makefile.am	13 Apr 2003 21:47:50 -0000
@@ -1,8 +1,8 @@
 # FIXME : threads bytestream
 SUBDIRS = caps plugin elements clock refcounting threads indexers ## cleanup dynparams
 
-GST_PLUGIN_PATH = $(shell cd $(top_builddir) && pwd)
-TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=`pwd`/test-registry.xml
+TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd)
+TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml
 
 if BUILD_FAILING_TESTS
 testprogs = test_gst_init
@@ -12,7 +12,10 @@ testprogs =
 inspectcheck = 
 endif
 
-TESTS = $(top_builddir)/tools/gst-register $(testprogs) $(inspectcheck)
+# since these TESTS are only run after recursing into subdirs,
+# gst-register should be run before that, in the first subdir that uses it
+# TESTS = $(top_builddir)/tools/gst-register $(testprogs) $(inspectcheck)
+TESTS = $(testprogs) $(inspectcheck)
 
 check_PROGRAMS = $(testprogs)
 
@@ -21,7 +24,7 @@ LIBS = $(GST_LIBS)
 AM_CFLAGS = $(GST_CFLAGS)
 
 # we makes them, we gots to clean them
-CLEANFILES = test-registry.xml elementstest-registry.xml threadstest-registry.xml
+CLEANFILES = test-registry.xml
 
 DIST_SUBDIRS = bytestream caps cleanup clock dynparams elements indexers \
 		plugin refcounting threads
Index: testsuite/caps/Makefile.am
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/testsuite/caps/Makefile.am,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile.am
--- testsuite/caps/Makefile.am	9 May 2002 16:44:22 -0000	1.3
+++ testsuite/caps/Makefile.am	13 Apr 2003 21:47:50 -0000
@@ -1,9 +1,12 @@
-GST_PLUGIN_PATH=$(shell cd $(top_builddir) && pwd)
-TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=$(GST_PLUGIN_PATH)/testsuite/test-registry.xml
+TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd)
+TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml
 
 testprogs = intersection compatibility normalisation
 
-TESTS = $(testprogs)
+# we run gst-register here, which is a HACK to generate the test registry
+# before we actually run the real tests
+# a better fix is welcome :)
+TESTS = $(top_builddir)/tools/gst-register $(testprogs)
 
 check_PROGRAMS = $(testprogs)
 
Index: testsuite/cleanup/Makefile.am
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/testsuite/cleanup/Makefile.am,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile.am
--- testsuite/cleanup/Makefile.am	1 Jul 2002 09:57:10 -0000	1.6
+++ testsuite/cleanup/Makefile.am	13 Apr 2003 21:47:50 -0000
@@ -1,3 +1,6 @@
+TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd)
+TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml
+
 if BUILD_FAILING_TESTS
 FAILING = cleanup3 cleanup4
 else
@@ -5,9 +8,6 @@ FAILING =
 endif
 
 testprogs = cleanup1 cleanup2 $(FAILING) cleanup5
-
-GST_PLUGIN_PATH = $(shell cd $(top_builddir) && pwd)
-TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=`pwd`/test-registry.xml
 
 TESTS = $(testprogs)
 
Index: testsuite/clock/Makefile.am
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/testsuite/clock/Makefile.am,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile.am
--- testsuite/clock/Makefile.am	2 Nov 2002 14:00:15 -0000	1.4
+++ testsuite/clock/Makefile.am	13 Apr 2003 21:47:50 -0000
@@ -1,5 +1,5 @@
-GST_PLUGIN_PATH=$(shell cd $(top_builddir) && pwd)
-TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=$(GST_PLUGIN_PATH)/testsuite/test-registry.xml
+TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd)
+TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml
 
 testprogs = clock1 clock2
 
Index: testsuite/elements/Makefile.am
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/testsuite/elements/Makefile.am,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile.am
--- testsuite/elements/Makefile.am	21 Jan 2003 20:26:06 -0000	1.14
+++ testsuite/elements/Makefile.am	13 Apr 2003 21:47:50 -0000
@@ -1,13 +1,12 @@
+TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd)
+TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml
+
 if BUILD_FAILING_TESTS
 tests_failing = fake
 else
 tests_failing =
 endif
 tests_working = name tee property
-
-GST_PLUGIN_PATH=$(shell cd $(top_builddir) && pwd)
-
-TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=`pwd`test-registry.xml
 
 TESTS = $(tests_working)
 
Index: testsuite/indexers/Makefile.am
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/testsuite/indexers/Makefile.am,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile.am
--- testsuite/indexers/Makefile.am	12 Jan 2003 13:27:02 -0000	1.3
+++ testsuite/indexers/Makefile.am	13 Apr 2003 21:47:50 -0000
@@ -1,3 +1,6 @@
+TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd)
+TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml
+
 testprogs = cache1 indexdump
 
 TESTS = $(testprogs)
Index: testsuite/plugin/Makefile.am
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/testsuite/plugin/Makefile.am,v
retrieving revision 1.19
diff -u -p -r1.19 Makefile.am
--- testsuite/plugin/Makefile.am	30 May 2002 13:52:13 -0000	1.19
+++ testsuite/plugin/Makefile.am	13 Apr 2003 21:47:50 -0000
@@ -1,7 +1,7 @@
-plugindir = $(shell cd $(top_builddir)/testsuite/plugin/ && pwd)
+TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd)
+TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml
 
-GST_PLUGIN_PATH=$(shell cd $(top_builddir) && pwd)
-TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=$(GST_PLUGIN_PATH)/testsuite/test-registry.xml
+plugindir = $(shell cd $(top_builddir)/testsuite/plugin/ && pwd)
 
 plugin_LTLIBRARIES = libtestplugin.la libtestplugin2.la
 
Index: testsuite/refcounting/Makefile.am
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/testsuite/refcounting/Makefile.am,v
retrieving revision 1.18
diff -u -p -r1.18 Makefile.am
--- testsuite/refcounting/Makefile.am	21 Jan 2003 22:22:13 -0000	1.18
+++ testsuite/refcounting/Makefile.am	13 Apr 2003 21:47:50 -0000
@@ -1,3 +1,6 @@
+TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd)
+TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml
+
 if BUILD_FAILING_TESTS
 tests_failing = element bin element_pad pad
 else
@@ -10,9 +13,6 @@ pad_SOURCES = pad.c mem.c
 
 element_pad_SOURCES = element_pad.c mem.c
 bin_SOURCES = bin.c mem.c
-
-GST_PLUGIN_PATH = $(shell cd $(top_builddir) && pwd)
-TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=`pwd`/test-registry.xml
 
 TESTS = $(tests_working)
 
Index: testsuite/threads/Makefile.am
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/testsuite/threads/Makefile.am,v
retrieving revision 1.10.4.3
diff -u -p -r1.10.4.3 Makefile.am
--- testsuite/threads/Makefile.am	1 Feb 2003 23:50:12 -0000	1.10.4.3
+++ testsuite/threads/Makefile.am	13 Apr 2003 21:47:50 -0000
@@ -1,3 +1,6 @@
+TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd)
+TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml
+
 testprogs = thread1 thread2 thread3 thread5
 testsfailing = threadb threadc threadd threade threadf thread4
 
@@ -6,10 +9,6 @@ TESTS = $(testprogs)
 check_PROGRAMS = $(testprogs)
 
 noinst_PROGRAMS = $(testsfailing)
-
-GST_PLUGIN_PATH=$(shell cd $(top_builddir) && pwd)
-
-TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=`pwd`test-registry.xml
 
 LDADD = $(GST_LIBS) 
 AM_CFLAGS = $(GST_CFLAGS)
