mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 14:36:24 +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',
|
project('gst-editing-services', 'c',
|
||||||
version : '1.9.90',
|
version : '1.9.90',
|
||||||
meson_version : '>= 0.33.0',
|
meson_version : '>= 0.35.0',
|
||||||
default_options : [ 'warning_level=1',
|
default_options : [ 'warning_level=1',
|
||||||
'c_std=gnu99',
|
'c_std=gnu99',
|
||||||
'buildtype=debugoptimized' ])
|
'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',
|
'-DGST_USE_UNSTABLE_API',
|
||||||
]
|
]
|
||||||
|
|
||||||
getpluginsdir = find_program('getpluginsdir')
|
pluginsdirs = []
|
||||||
runcmd = run_command(getpluginsdir, 'gstreamer', 'gstreamer-' + apiversion,
|
if not meson.is_subproject()
|
||||||
'gst-plugins-base', 'gstreamer-plugins-base-' + apiversion,
|
pkgconfig = find_program('pkg-config')
|
||||||
'gst-plugins-good', 'gstreamer-plugins-good-' + apiversion,
|
runcmd = run_command(pkgconfig, '--variable=pluginsdir',
|
||||||
'gst-plugins-bad', 'gstreamer-plugins-bad-' + apiversion)
|
'gstreamer-' + apiversion, 'gstreamer-plugins-base-' + apiversion,
|
||||||
|
'gstreamer-plugins-bad-' + apiversion)
|
||||||
|
|
||||||
if runcmd.returncode() == 0
|
if runcmd.returncode() == 0
|
||||||
needed_plugins_dirs = runcmd.stdout().strip() + ':' + meson.build_root() + '/plugins/nle'
|
pluginsdirs = runcmd.stdout().split()
|
||||||
message('Using GStreamer plug-ins in ' + needed_plugins_dirs)
|
|
||||||
else
|
else
|
||||||
error('Could not determine GStreamer core plugins directory for unit tests.')
|
error('Could not determine GStreamer core plugins directory for unit tests.')
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
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',
|
|
||||||
]
|
|
||||||
|
|
||||||
foreach t : ges_tests
|
foreach t : ges_tests
|
||||||
test_name = t.get(0)
|
test_name = t.get(0)
|
||||||
|
@ -62,15 +56,23 @@ foreach t : ges_tests
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if not skip_test
|
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),
|
exe = executable(test_name, '@0@.c'.format(test_name),
|
||||||
'ges/test-utils.c', 'nle/common.c',
|
'ges/test-utils.c', 'nle/common.c',
|
||||||
c_args : ges_c_args + test_defines,
|
c_args : ges_c_args + test_defines,
|
||||||
include_directories : [configinc],
|
include_directories : [configinc],
|
||||||
dependencies : libges_deps + [gstcheck_dep, ges_dep],
|
dependencies : libges_deps + [gstcheck_dep, ges_dep],
|
||||||
)
|
)
|
||||||
test(test_name, exe,
|
test(test_name, exe, env: env)
|
||||||
env: test_env + ['GST_REGISTRY=@0@/@1@.registry'.format(meson.current_build_dir(), test_name)]
|
|
||||||
)
|
|
||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue