mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +00:00
meson: Use environment object to setup test environment variables
Bump meson requirement to 0.35
This commit is contained in:
parent
4432efcfad
commit
1d6167f07d
3 changed files with 24 additions and 49 deletions
|
@ -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' ])
|
||||
|
|
|
@ -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(":"))
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue