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



commit 52164d21d1343e7a2c7784256627d7810497f48a
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 5119c0a..87bbb46 100644
--- a/src/tmdb/Makefile.am
+++ b/src/tmdb/Makefile.am
@@ -24,6 +24,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 c05e832..3e58fe2 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 21c1ca7..9c1a6c9 100644
--- a/test/test_tmdb_fast_resolution.c
+++ b/test/test_tmdb_fast_resolution.c
@@ -98,6 +98,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 1cdb23c..69f571f 100644
--- a/test/test_tmdb_full_resolution.c
+++ b/test/test_tmdb_full_resolution.c
@@ -154,6 +154,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 e869da9..ee71a0a 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]