[grilo-plugins/tmdb-test] tests: local-metadata: Use the built plugin instead of installed



commit 9f804694eac0745c798d5ab17f92b3911c470401
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Nov 14 12:10:57 2012 +0100

    tests: local-metadata: Use the built plugin instead of installed
    
    Do the same thing as we do for the tmdb plugin.
    Also added a GError check to show where it fails for me.
    This still does not run during make check.

 autogen.sh                     |    2 +-
 src/local-metadata/Makefile.am |    8 ++++++++
 test/Makefile.am               |    6 +++++-
 test/test_local_metadata.c     |    9 ++++++++-
 4 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/autogen.sh b/autogen.sh
index b572851..37dd3a7 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Run this to generate all the initial makefiles, etc.
 
 srcdir=`dirname $0`
diff --git a/src/local-metadata/Makefile.am b/src/local-metadata/Makefile.am
index afc5312..04c137d 100644
--- a/src/local-metadata/Makefile.am
+++ b/src/local-metadata/Makefile.am
@@ -26,6 +26,14 @@ extdir						= $(GRL_PLUGINS_DIR)
 localmetadataxmldir		= $(GRL_PLUGINS_DIR)
 localmetadataxml_DATA	= $(LOCALMETADATA_PLUGIN_ID).xml
 
+# This lets us test the plugin without installing it,
+# because grilo expects the .so and .xml files to be in 
+# the same directory:
+copy-xml-to-libs-dir: libgrllocalmetadata.la
+	cp $(localmetadataxml_DATA) $(builddir)/.libs/
+
+all-local: copy-xml-to-libs-dir
+
 EXTRA_DIST = $(localmetadataxml_DATA)
 
 MAINTAINERCLEANFILES	 = \
diff --git a/test/Makefile.am b/test/Makefile.am
index 1459890..7a68d2b 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -28,6 +28,10 @@ TESTS =	$(check_tests)
 #test_LDADD =		\
 #	@DEPS_LIBS@
 #
+
+test_local_metadata_defines = \
+	-DGRILO_PLUGINS_TESTS_LOCAL_METADATA_PLUGIN_PATH=\""$(abs_top_srcdir)/src/local-metadata/.libs/"\"
+
 test_local_metadata_SOURCES =  \
 	test_local_metadata.c
 
@@ -37,7 +41,7 @@ test_local_metadata_LDADD = \
 	@GIO_LIBS@
 
 test_local_metadata_CFLAGS = \
-	-DPREFIX=$(prefix) \
+	-DPREFIX=$(prefix) $(test_local_metadata_defines) \
 	@GTHREAD_CFLAGS@ \
 	@GIO_CFLAGS@
 
diff --git a/test/test_local_metadata.c b/test/test_local_metadata.c
index 1395a5c..c21d27a 100644
--- a/test/test_local_metadata.c
+++ b/test/test_local_metadata.c
@@ -149,7 +149,11 @@ setup (void)
     goto finish;
 
   registry = grl_registry_get_default ();
-  grl_registry_load_all_plugins (registry, NULL);
+
+  GError *error = NULL;
+  grl_registry_load_all_plugins (registry, &error);
+  g_assert_no_error (error);
+
   local_source =
     GRL_SOURCE (grl_registry_lookup_source (registry,
                                             LOCAL_SOURCE_ID));
@@ -292,6 +296,9 @@ finish:
 int
 main(int argc, char **argv)
 {
+  g_setenv ("GRL_PLUGIN_PATH", GRILO_PLUGINS_TESTS_LOCAL_METADATA_PLUGIN_PATH, TRUE);
+  g_setenv ("GRL_PLUGIN_LIST", LOCAL_SOURCE_ID, TRUE);
+
   grl_init (&argc, &argv);
 #if !GLIB_CHECK_VERSION(2,32,0)
   g_thread_init (NULL);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]