summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <thibault.saunier@osg.samsung.com>2016-10-03 17:44:04 -0300
committerThibault Saunier <thibault.saunier@osg.samsung.com>2016-10-14 17:44:00 +0200
commit1d6167f07dae8ddb53350213d431253132060c26 (patch)
tree9d99380c0d7570cd10b4cde7e0f9bfd64ac8d950
parent4432efcfad04cc87ea944f860d22c449b02df26d (diff)
meson: Use environment object to setup test environment variables
Bump meson requirement to 0.35
-rw-r--r--meson.build2
-rw-r--r--tests/check/getpluginsdir27
-rw-r--r--tests/check/meson.build44
3 files changed, 24 insertions, 49 deletions
diff --git a/meson.build b/meson.build
index d40e74b5..b4d330e8 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
project('gst-editing-services', 'c',
version : '1.9.90',
- meson_version : '>= 0.33.0',
+ meson_version : '>= 0.35.0',
default_options : [ 'warning_level=1',
'c_std=gnu99',
'buildtype=debugoptimized' ])
diff --git a/tests/check/getpluginsdir b/tests/check/getpluginsdir
deleted file mode 100644
index aa41ca83..00000000
--- a/tests/check/getpluginsdir
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python3
-
-import os
-import sys
-import subprocess
-
-builddir = os.environ['MESON_BUILD_ROOT']
-
-res = ''
-args = sys.argv[1:]
-for i in range(0, len(args), 2):
- project = args[i]
- pkg_name = args[i + 1]
- path = os.path.join(builddir, 'subprojects', project)
- if os.path.exists(path):
- res += ':' + path
- else:
- try:
- res += ':' + subprocess.check_output([
- 'pkg-config', '--variable=pluginsdir',
- pkg_name]).decode().replace("\n", "")
- except subprocess.CalledProcessError as e:
- # Probably means there is no .pc file for the module
- # and it should hopefully no be too bad.
- pass
-
-print(res.strip(":"))
diff --git a/tests/check/meson.build b/tests/check/meson.build
index 649eaebd..e2625e46 100644
--- a/tests/check/meson.build
+++ b/tests/check/meson.build
@@ -33,25 +33,19 @@ test_defines = [
'-DGST_USE_UNSTABLE_API',
]
-getpluginsdir = find_program('getpluginsdir')
-runcmd = run_command(getpluginsdir, 'gstreamer', 'gstreamer-' + apiversion,
- 'gst-plugins-base', 'gstreamer-plugins-base-' + apiversion,
- 'gst-plugins-good', 'gstreamer-plugins-good-' + apiversion,
- 'gst-plugins-bad', 'gstreamer-plugins-bad-' + apiversion)
-if runcmd.returncode() == 0
- needed_plugins_dirs = runcmd.stdout().strip() + ':' + meson.build_root() + '/plugins/nle'
- message('Using GStreamer plug-ins in ' + needed_plugins_dirs)
-else
- error('Could not determine GStreamer core plugins directory for unit tests.')
-endif
+pluginsdirs = []
+if not meson.is_subproject()
+ pkgconfig = find_program('pkg-config')
+ runcmd = run_command(pkgconfig, '--variable=pluginsdir',
+ 'gstreamer-' + apiversion, 'gstreamer-plugins-base-' + apiversion,
+ 'gstreamer-plugins-bad-' + apiversion)
-test_env = [
- 'GST_PLUGIN_SYSTEM_PATH_1_0=',
- 'GST_PLUGIN_PATH_1_0=' + needed_plugins_dirs,
- 'GST_PLUGIN_SCANNER_1_0='+ meson.build_root() + '/libs/gst/helpers/gst-plugin-scanner',
- 'GST_STATE_IGNORE_ELEMENTS=',
- 'CK_DEFAULT_TIMEOUT=20',
-]
+ if runcmd.returncode() == 0
+ pluginsdirs = runcmd.stdout().split()
+ else
+ error('Could not determine GStreamer core plugins directory for unit tests.')
+ endif
+endif
foreach t : ges_tests
test_name = t.get(0)
@@ -62,15 +56,23 @@ foreach t : ges_tests
endif
if not skip_test
+ env = environment()
+ env.set('GST_PLUGIN_PATH_1_0', meson.build_root())
+ env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
+ env.set('GST_STATE_IGNORE_ELEMENTS', '')
+ env.set('CK_DEFAULT_TIMEOUT', '20')
+ env.set('GST_REGISTRY', '@0@/@1@.registry'.format(meson.current_build_dir(), test_name))
+ foreach plugindir: pluginsdirs
+ env.append('GST_PLUGIN_PATH_1_0', plugindir)
+ endforeach
+
exe = executable(test_name, '@0@.c'.format(test_name),
'ges/test-utils.c', 'nle/common.c',
c_args : ges_c_args + test_defines,
include_directories : [configinc],
dependencies : libges_deps + [gstcheck_dep, ges_dep],
)
- test(test_name, exe,
- env: test_env + ['GST_REGISTRY=@0@/@1@.registry'.format(meson.current_build_dir(), test_name)]
- )
+ test(test_name, exe, env: env)
endif
endforeach