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



commit 6fe1de0c51edd605b548b93f4e76a98390f87cc2
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.

 src/local-metadata/Makefile.am |    8 ++++++++
 test/Makefile.am               |    6 +++++-
 test/test_local_metadata.c     |    9 ++++++++-
 3 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/src/local-metadata/Makefile.am b/src/local-metadata/Makefile.am
index 99c97fd..7ed9516 100644
--- a/src/local-metadata/Makefile.am
+++ b/src/local-metadata/Makefile.am
@@ -24,6 +24,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 3e58fe2..451b5d1 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]