meson: Make use of new environment object and set plugin path to builddir

Workaround source_root being the root directory of all projects
in the subproject case and remove now unneeded getpluginsdir

Bump meson requirement to 0.35
This commit is contained in:
Thibault Saunier 2016-10-04 18:06:09 -03:00
parent 07e5039848
commit dc49e63100
3 changed files with 27 additions and 47 deletions

View file

@ -1,6 +1,6 @@
project('gst-plugins-ugly', 'c', project('gst-plugins-ugly', 'c',
version : '1.9.90', version : '1.9.90',
meson_version : '>= 0.32.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' ])

View file

@ -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(":"))

View file

@ -13,25 +13,23 @@ test_defines = [
'-UG_DISABLE_ASSERT', '-UG_DISABLE_ASSERT',
'-UG_DISABLE_CAST_CHECKS', '-UG_DISABLE_CAST_CHECKS',
'-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_PLUGIN_LOADING_WHITELIST"', '-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_PLUGIN_LOADING_WHITELIST"',
'-DGST_TEST_FILES_PATH="' + meson.source_root() + '/tests/files"', '-DGST_TEST_FILES_PATH="' + meson.current_source_dir() + '/../files"',
'-DGST_USE_UNSTABLE_API', '-DGST_USE_UNSTABLE_API',
] ]
getpluginsdir = find_program('getpluginsdir') pluginsdirs = [ ]
runcmd = run_command(getpluginsdir, 'gstreamer', 'gstreamer-1.0') # FIXME: Use if not gst_dep.is_internal() when avalaible as we only support the
if runcmd.returncode() == 0 # case where GStreamer is another subproject here.
plugins_dir = runcmd.stdout().strip() if not meson.is_subproject()
message('Using GStreamer plug-ins in ' + plugins_dir + ' for unit tests') pkgconfig = find_program('pkg-config')
else runcmd = run_command(pkgconfig, '--variable=pluginsdir', 'gstreamer-' + apiversion)
error('Could not determine GStreamer plugins directory for unit tests.')
endif
test_env = [ if runcmd.returncode() == 0
'GST_PLUGIN_SYSTEM_PATH_1_0=', pluginsdirs = runcmd.stdout().split()
'GST_PLUGIN_PATH_1_0=' + meson.build_root() + '/gst:' + meson.build_root() + '/ext:' + meson.build_root() + '/sys:' + plugins_dir, else
'GST_PLUGIN_LOADING_WHITELIST=gstreamer:gst-plugins-base:gst-plugins-good:gst-plugins-ugly@' + meson.build_root(), error('Could not determine GStreamer core plugins directory for unit tests.')
'CK_DEFAULT_TIMEOUT=20', endif
] endif
test_deps = [gst_dep, gstbase_dep, gstcheck_dep, gstaudio_dep, gstapp_dep, gstfft_dep] test_deps = [gst_dep, gstbase_dep, gstcheck_dep, gstaudio_dep, gstapp_dep, gstfft_dep]
@ -56,9 +54,18 @@ foreach t : ugly_tests
c_args : ['-DHAVE_CONFIG_H=1' ] + test_defines, c_args : ['-DHAVE_CONFIG_H=1' ] + test_defines,
dependencies : [libm] + test_deps + extra_deps, dependencies : [libm] + test_deps + extra_deps,
) )
test(test_name, exe,
env: test_env + ['GST_REGISTRY=@0@/@1@.registry'.format(meson.current_build_dir(), test_name)], env = environment()
timeout: 3 * 60 env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
) env.set('CK_DEFAULT_TIMEOUT', '20')
env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer', 'gst-plugins-base',
'gst-plugins-good', 'gst-plugins-ugly@' + meson.build_root(), separator=':')
env.set('GST_PLUGIN_PATH_1_0', meson.build_root())
foreach plugindir: pluginsdirs
env.append('GST_PLUGIN_PATH_1_0', plugindir)
endforeach
env.set('GST_REGISTRY', '@0@/@1@.registry'.format(meson.current_build_dir(), test_name))
test(test_name, exe, env: env, timeout: 3 * 60)
endif endif
endforeach endforeach