[grilo-plugins/wip/hadess/no-chromaprint: 8/9] tests: Check for chromaprint GStreamer plugin presence



commit c7195f75ab1e3405e01bee7c558b3e54a608a84f
Author: Bastien Nocera <hadess hadess net>
Date:   Sat Sep 28 11:57:33 2019 +0200

    tests: Check for chromaprint GStreamer plugin presence
    
    Can't run the tests without the plugin installed, so error out if it's
    missing. If the chromaprint plugin can't be installed for the tests,
    then disable the chromaprint grilo plugin.
    
    Bail out! FATAL-WARNING: chromaprint GStreamer plugin missing, verify your installation

 tests/chromaprint/meson.build              | 2 +-
 tests/chromaprint/test_chromaprint_utils.c | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/tests/chromaprint/meson.build b/tests/chromaprint/meson.build
index 51180d81..72957e3a 100644
--- a/tests/chromaprint/meson.build
+++ b/tests/chromaprint/meson.build
@@ -17,7 +17,7 @@ source_common = [
 foreach t: source_tests
     exe = executable(t, [t + '.c'] + source_common,
         install: false,
-        dependencies: must_deps,
+        dependencies: [ must_deps, gstreamer_dep ],
         c_args: [
             '-DCHROMAPRINT_PLUGIN_PATH="@0@/src/chromaprint/"'.format(meson.build_root()),
             '-DCHROMAPRINT_PLUGIN_TEST_DATA_PATH="@0@/data/"'.format(meson.current_source_dir()),
diff --git a/tests/chromaprint/test_chromaprint_utils.c b/tests/chromaprint/test_chromaprint_utils.c
index 505e0c5d..947d29ed 100644
--- a/tests/chromaprint/test_chromaprint_utils.c
+++ b/tests/chromaprint/test_chromaprint_utils.c
@@ -21,6 +21,7 @@
  */
 
 #include <grilo.h>
+#include <gst/gst.h>
 #include "test_chromaprint_utils.h"
 
 GrlSource *source = NULL;
@@ -29,8 +30,16 @@ void
 test_setup_chromaprint (void)
 {
   GrlRegistry *registry;
+  GstElement *chromaprint;
   GError *error = NULL;
 
+  gst_init (NULL, NULL);
+  chromaprint = gst_element_factory_make ("chromaprint", "test");
+  if (chromaprint == NULL) {
+      g_warning ("chromaprint GStreamer plugin missing, verify your installation");
+      g_assert_nonnull (chromaprint);
+  }
+
   registry = grl_registry_get_default ();
   grl_registry_load_plugin (registry,
                             CHROMAPRINT_PLUGIN_PATH "libgrlchromaprint.so",


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