meson: Modernize the way we set test env variables

Removing the now useless getplugindirs script
This commit is contained in:
Thibault Saunier 2016-11-18 14:45:42 -03:00 committed by Thibault Saunier
parent b0784ffcb3
commit ab614e63ae
5 changed files with 23 additions and 63 deletions

View file

@ -14,22 +14,15 @@ test_defines = [
'-DGST_USE_UNSTABLE_API',
]
runcmd = run_command(getpluginsdir, 'gstreamer', 'gstreamer-' + apiversion)
if runcmd.returncode() == 0
needed_plugins_dirs = runcmd.stdout().strip()
message('Using GStreamer plug-ins in ' + needed_plugins_dirs)
else
error('Could not determine GStreamer core plugins directory for unit tests.')
env = environment()
env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
env.set('GST_STATE_IGNORE_ELEMENTS', '')
env.set('CK_DEFAULT_TIMEOUT', '20')
env.set('GST_PLUGIN_PATH_1_0', meson.build_root())
if not meson.is_subproject()
env.append('GST_PLUGIN_PATH_1_0', gst_dep.get_pkgconfig_variable('pluginsdir'))
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 : validate_tests
test_name = t.get(0)
if t.length() == 2
@ -45,9 +38,9 @@ foreach t : validate_tests
include_directories : [inc_dirs],
dependencies : [validate_dep, gstcheck_dep],
)
test(test_name, exe,
env: test_env + ['GST_REGISTRY=@0@/@1@.registry'.format(meson.current_build_dir(), test_name)]
)
env.set('GST_REGISTRY',
'@0@/@1@.registry'.format(meson.current_build_dir(), test_name))
test(test_name, exe, env: env)
endif
endforeach

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

@ -1,26 +1,19 @@
launcher = find_program(meson.build_root() + '/validate/tools/gst-validate-launcher',
required : false)
env = environment()
env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
env.set('GST_PLUGIN_PATH_1_0', meson.build_root())
if not meson.is_subproject()
env.append('GST_PLUGIN_PATH_1_0', gst_dep.get_pkgconfig_variable('pluginsdir'))
runcmd = run_command(getpluginsdir, 'gstreamer', 'gstreamer-' + apiversion,
'gst-plugins-base', 'gst-plugins-base-' + apiversion)
if runcmd.returncode() == 0
needed_plugins_dirs = runcmd.stdout().strip()
message('Using GStreamer plug-ins in ' + needed_plugins_dirs)
else
error('Could not determine GStreamer plugins directory for unit tests.')
gst_plugins_base_dep = dependency('gstreamer-plugins-base-1.0')
env.append('GST_PLUGIN_PATH_1_0', gst_plugins_base_dep.get_pkgconfig_variable('pluginsdir'))
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',
]
if launcher.found()
test_name = 'launcher_tests'
test_name = 'validate/launcher_tests'
env.set('GST_REGISTRY', '@0@/@1@.registry'.format(meson.current_build_dir(), test_name))
test(test_name, launcher, args: ['-o', meson.build_root() + '/validate-launcher-output/',
meson.current_source_dir() + '/test_validate.py', '--validate-tools-path',
meson.build_root() + '/validate/tools/'],
env: ['GST_REGISTRY=@0@/@1@.registry'.format(meson.current_build_dir(), test_name)] +
test_env)
env: env)
endif

View file

@ -1,5 +1,4 @@
# FIXME: make check work on windows
getpluginsdir = find_program('getpluginsdir')
if host_machine.system() != 'windows'
subdir('check')
endif

View file

@ -32,3 +32,5 @@ configure_file(input : 'gst-validate-launcher.in',
install_dir: get_option('bindir'),
output : 'gst-validate-launcher',
configuration : tmpconf)
launcher = find_program(meson.current_build_dir() + '/gst-validate-launcher')