[grilo] tests: skip test if no plugin is installed



commit 1cbe1e25203af53cafbecd965bcb96b024a6a92f
Author: Victor Toso <me victortoso com>
Date:   Wed Aug 29 12:30:02 2018 +0200

    tests: skip test if no plugin is installed
    
    Registry tests around loaded GrlSources might fail if no plugin is
    installed. This can be guaranteed by continuous integration and would
    be better than creating dummy plugins to be loaded/unloaded.
    
    Signed-off-by: Victor Toso <victortoso gnome org>

 tests/registry.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/tests/registry.c b/tests/registry.c
index 4edabfe..d1ed02f 100644
--- a/tests/registry.c
+++ b/tests/registry.c
@@ -41,6 +41,7 @@ registry_load_error_handler (const gchar *log_domain,
       CHECK_MESSAGE ("Grilo", "Configuration not provided") ||
       CHECK_MESSAGE ("Grilo", "Missing configuration") ||
       CHECK_MESSAGE ("Grilo", "Could not open plugin directory") ||
+      CHECK_MESSAGE ("Grilo", "Error opening directory") ||
       CHECK_MESSAGE ("Grilo", "Could not read XML file")) {
     return FALSE;
   }
@@ -81,9 +82,13 @@ static void
 registry_load (RegistryFixture *fixture, gconstpointer data)
 {
   gboolean res;
+  GError *err = NULL;
 
-  res = grl_registry_load_all_plugins (fixture->registry, TRUE, NULL);
-  g_assert_cmpint (res, ==, TRUE);
+  res = grl_registry_load_all_plugins (fixture->registry, TRUE, &err);
+  if (!res) {
+    g_assert_error (err, GRL_CORE_ERROR, GRL_CORE_ERROR_LOAD_PLUGIN_FAILED);
+    g_test_skip ("No sources loaded, skipping test");
+  }
 }
 
 static void
@@ -96,6 +101,10 @@ registry_unregister (RegistryFixture *fixture, gconstpointer data)
   g_test_bug ("627207");
 
   sources = grl_registry_get_sources (fixture->registry, FALSE);
+  if (sources == NULL) {
+    g_test_skip ("No sources loaded, skipping test");
+    return;
+  }
 
   for (sources_iter = sources, i = 0; sources_iter;
       sources_iter = g_list_next (sources_iter), i++) {


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