[grilo-plugins/tmdb-test] tests: tmdb: Use the built plugins, not the installed ones.



commit 8b25ef197210e53eee0a9ef23ef9adf186a18e56
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Nov 14 12:01:19 2012 +0100

    tests: tmdb: Use the built plugins, not the installed ones.
    
    By setting the GRL_PLUGIN_PATH environment variable in the code.
    Note that we have to copy the .xml file into the .libs directory
    to make this work. We will need to do that for other plugins when
    testing them too.

 src/tmdb/Makefile.am                   |    8 ++++++++
 test/Makefile.am                       |   10 ++++++++--
 test/test_tmdb_fast_resolution.c       |    1 +
 test/test_tmdb_full_resolution.c       |    1 +
 test/test_tmdb_missing_configuration.c |    1 +
 test/test_tmdb_preconditions.c         |    1 +
 6 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/src/tmdb/Makefile.am b/src/tmdb/Makefile.am
index d40ad98..5237b45 100644
--- a/src/tmdb/Makefile.am
+++ b/src/tmdb/Makefile.am
@@ -32,6 +32,14 @@ extdir					= $(GRL_PLUGINS_DIR)
 tmdbxmldir	= $(GRL_PLUGINS_DIR)
 tmdbxml_DATA	= $(TMDB_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: libgrltmdb.la
+	cp $(tmdbxml_DATA) $(builddir)/.libs/
+
+all-local: copy-xml-to-libs-dir
+
 EXTRA_DIST = $(tmdbxml_DATA)
 
 MAINTAINERCLEANFILES	 = \
diff --git a/test/Makefile.am b/test/Makefile.am
index afc3a52..1459890 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -41,9 +41,15 @@ test_local_metadata_CFLAGS = \
 	@GTHREAD_CFLAGS@ \
 	@GIO_CFLAGS@
 
-# Let the .c source code know about this path,
+# Let the .c source code know about these paths,
 # even when sourcedir!=builddir, such as during make distcheck:
-test_tmdb_defines = -DGRILO_PLUGINS_TESTS_TMDB_DATA_PATH=\""$(abs_top_srcdir)/test/test_data/tmdb/"\"
+#
+# We could set GRL_PLUGIN_PATH here in TESTS_ENVIRONMENT, specifying all the paths (separated by :) to all the plugins,
+# but it is cleaner to restrict the test to just one plugin by doing it in the code.
+# Note that the tmdb plugin Makefile.am copies the .xml file into .libs so we can use the plugin.
+test_tmdb_defines = \
+	-DGRILO_PLUGINS_TESTS_TMDB_PLUGIN_PATH=\""$(abs_top_srcdir)/src/tmdb/.libs/"\" \
+	-DGRILO_PLUGINS_TESTS_TMDB_DATA_PATH=\""$(abs_top_srcdir)/test/test_data/tmdb/"\"
 
 test_tmdb_preconditions_SOURCES = \
 	test_tmdb_preconditions.c \
diff --git a/test/test_tmdb_fast_resolution.c b/test/test_tmdb_fast_resolution.c
index 163fa96..5eeff71 100644
--- a/test/test_tmdb_fast_resolution.c
+++ b/test/test_tmdb_fast_resolution.c
@@ -102,6 +102,7 @@ test (void)
 int
 main(int argc, char **argv)
 {
+  g_setenv ("GRL_PLUGIN_PATH", GRILO_PLUGINS_TESTS_TMDB_PLUGIN_PATH, TRUE);
   g_setenv ("GRL_PLUGIN_LIST", TMDB_PLUGIN_ID, TRUE);
 
   /* We must set this before calling grl_init.
diff --git a/test/test_tmdb_full_resolution.c b/test/test_tmdb_full_resolution.c
index ac3e37e..8e901d8 100644
--- a/test/test_tmdb_full_resolution.c
+++ b/test/test_tmdb_full_resolution.c
@@ -168,6 +168,7 @@ test (void)
 int
 main(int argc, char **argv)
 {
+  g_setenv ("GRL_PLUGIN_PATH", GRILO_PLUGINS_TESTS_TMDB_PLUGIN_PATH, TRUE);
   g_setenv ("GRL_PLUGIN_LIST", TMDB_PLUGIN_ID, TRUE);
 
   /* We must set this before calling grl_init.
diff --git a/test/test_tmdb_missing_configuration.c b/test/test_tmdb_missing_configuration.c
index fee49ca..5793185 100644
--- a/test/test_tmdb_missing_configuration.c
+++ b/test/test_tmdb_missing_configuration.c
@@ -68,6 +68,7 @@ test (void)
 int
 main(int argc, char **argv)
 {
+  g_setenv ("GRL_PLUGIN_PATH", GRILO_PLUGINS_TESTS_TMDB_PLUGIN_PATH, TRUE);
   g_setenv ("GRL_PLUGIN_LIST", TMDB_PLUGIN_ID, TRUE);
 
   /* We must set this before calling grl_init.
diff --git a/test/test_tmdb_preconditions.c b/test/test_tmdb_preconditions.c
index 904542f..5660ff0 100644
--- a/test/test_tmdb_preconditions.c
+++ b/test/test_tmdb_preconditions.c
@@ -91,6 +91,7 @@ test (void)
 int
 main(int argc, char **argv)
 {
+  g_setenv ("GRL_PLUGIN_PATH", GRILO_PLUGINS_TESTS_TMDB_PLUGIN_PATH, TRUE);
   g_setenv ("GRL_PLUGIN_LIST", TMDB_PLUGIN_ID, TRUE);
 
   /* We must set this before calling grl_init.



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