[gupnp-dlna/wip/meson: 1/2] build: Enable tests




commit 6549a908d06bad2d14475957ed5b81d58c5fc27c
Author: Jens Georg <jensg openismus com>
Date:   Sun May 23 12:29:45 2021 +0200

    build: Enable tests

 libgupnp-dlna/meson.build                          |  2 +-
 .../metadata-backends/gstreamer/meson.build        |  2 ++
 meson.build                                        |  5 +++++
 meson_options.txt                                  |  1 +
 tests/meson.build                                  | 22 ++++++++++++++++++++++
 5 files changed, 31 insertions(+), 1 deletion(-)
---
diff --git a/libgupnp-dlna/meson.build b/libgupnp-dlna/meson.build
index b35f25d..ea79d37 100644
--- a/libgupnp-dlna/meson.build
+++ b/libgupnp-dlna/meson.build
@@ -115,7 +115,7 @@ libgupnp_dlna = library(
 
 gupnp_dlna = declare_dependency(
     link_with : libgupnp_dlna,
-    include_directories: include_directories('.')
+    include_directories: [include_directories('.'), include_directories('..')],
 )
 
 pkg.generate(
diff --git a/libgupnp-dlna/metadata-backends/gstreamer/meson.build 
b/libgupnp-dlna/metadata-backends/gstreamer/meson.build
index a029290..4223e05 100644
--- a/libgupnp-dlna/metadata-backends/gstreamer/meson.build
+++ b/libgupnp-dlna/metadata-backends/gstreamer/meson.build
@@ -1,5 +1,7 @@
 dlna_gst_headers = files('gupnp-dlna-gst-utils.h')
 
+dlna_backend_dir = meson.current_build_dir()
+
 install_headers(dlna_gst_headers, subdir : headers_subdir)
 
 dlna_gst_sources = files(
diff --git a/meson.build b/meson.build
index ecc0a4f..3819ef8 100644
--- a/meson.build
+++ b/meson.build
@@ -30,6 +30,10 @@ config_dep = declare_dependency(
 gstreamer = dependency('gstreamer-1.0', required: get_option('gstreamer_backend'), disabler : true)
 gstreamer_pbu = dependency('gstreamer-pbutils-1.0', required: get_option('gstreamer_backend'), disabler : 
true)
 
+# default is relative to the source dir; if test_media is absolute, join_paths() will return that instead
+media_dir = join_paths(meson.current_source_dir(), get_option('test_media'))
+dlna_profile_dir = join_paths(meson.current_source_dir(), 'data')
+
 install_data(
     files(
         'data/dlna-profiles.rng',
@@ -60,3 +64,4 @@ if get_option('introspection')
     endif
 endif
 subdir('doc')
+subdir('tests')
diff --git a/meson_options.txt b/meson_options.txt
index 40d66e5..bdf45ab 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -3,3 +3,4 @@ option('default_backend', type: 'string', value: 'gstreamer')
 option('introspection', type: 'boolean', value: 'true')
 option('vapi', type: 'boolean', value: 'true')
 option('gtk_doc', type: 'boolean', value: 'false')
+option('test_media', type: 'string', value: 'tests/gupnp-dlna-media')
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..cb0ae9f
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,22 @@
+discoverer_test = find_program('test-discoverer.sh')
+
+test(
+    'discoverer',
+    discoverer_test,
+    env : [
+        'MEDIA_DIR=' + media_dir,
+        'FILE_LIST=' + join_paths(media_dir, 'media-list.txt'),
+        'GUPNP_DLNA_PROFILE_DIR=' + dlna_profile_dir,
+        'GUPNP_DLNA_METADATA_BACKEND_DIR=' + dlna_backend_dir
+    ]
+)
+
+test(
+    'test-sets',
+    executable(
+        'sets',
+        'sets.c',
+        dependencies : [glib, gio, gobject, gupnp_dlna],
+    )
+)
+


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