meson: Fix building tests and activate them again

This commit is contained in:
Thibault Saunier 2017-06-07 13:04:41 -04:00
parent c9e1346842
commit fe8a9bc6d5
2 changed files with 23 additions and 38 deletions

View file

@ -2,29 +2,18 @@
gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req, gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
fallback : ['gstreamer', 'gst_check_dep']) fallback : ['gstreamer', 'gst_check_dep'])
test_plugins_modules = [
['gstreamer-1.0', true], pluginsdirs = []
['gstreamer-plugins-base-1.0', true], if gst_dep.type_name() == 'pkgconfig'
['gstreamer-plugins-good-1.0', false], pbase = dependency('gstreamer-plugins-base-' + api_version, required : false)
['gstreamer-plugins-bad-1.0', false], pbad = dependency('gstreamer-plugins-bad-' + api_version, required : false)
] pgood = dependency('gstreamer-plugins-good-' + api_version, required : false)
test_plugin_path = ''
foreach m : test_plugins_modules pluginsdirs = [gst_dep.get_pkgconfig_variable('pluginsdir'),
m_name = m[0] pbase.get_pkgconfig_variable('pluginsdir'),
m_required = m[1] pbad.get_pkgconfig_variable('pluginsdir'),
runcmd = run_command('pkg-config', '--variable=pluginsdir', m_name + ' ' + gst_req) pgood.get_pkgconfig_variable('pluginsdir')]
if runcmd.returncode() == 0 endif
module_plugin_path = runcmd.stdout().strip()
message('Using '+ m_name + ' plugins in ' + module_plugin_path)
if test_plugin_path == ''
test_plugin_path = module_plugin_path
elif module_plugin_path != test_plugin_path
test_plugin_path = test_plugin_path + ':' + module_plugin_path
endif
elif m_required
error('Could not determine ' + m_name + ' plugins directory for unit tests.')
endif
endforeach
test_c_args = [ test_c_args = [
'-UG_DISABLE_ASSERT', '-UG_DISABLE_ASSERT',
@ -32,13 +21,6 @@ test_c_args = [
'-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_PLUGIN_LOADING_WHITELIST"', '-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_PLUGIN_LOADING_WHITELIST"',
] ]
test_env = [
'GST_PLUGIN_SYSTEM_PATH_1_0=',
'GST_PLUGIN_PATH_1_0=' + meson.build_root() + '/gst/rtsp-sink:' + test_plugin_path,
'GST_PLUGIN_LOADING_WHITELIST=gstreamer:gst-plugins-base:gst-plugins-good:gst-plugins-bad:gst-rtsp-server',
'CK_DEFAULT_TIMEOUT=120',
]
rtsp_server_tests = [ rtsp_server_tests = [
'gst/addresspool', 'gst/addresspool',
'gst/client', 'gst/client',
@ -55,13 +37,15 @@ rtsp_server_tests = [
'gst/token', 'gst/token',
] ]
all_env = ''
foreach e : test_env
all_env = all_env + ' ' + e
endforeach
message('test env:' + all_env)
foreach test_name : rtsp_server_tests foreach test_name : rtsp_server_tests
env = environment()
env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
env.set('GST_STATE_IGNORE_ELEMENTS', '')
env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer:gst-plugins-base:gst-plugins-good:gst-plugins-bad:gst-rtsp-server')
env.set('CK_DEFAULT_TIMEOUT', '120')
env.set('GST_REGISTRY', '@0@/@1@.registry'.format(meson.current_build_dir(), test_name))
env.set('GST_PLUGIN_PATH_1_0', [meson.build_root()] + pluginsdirs)
fname = '@0@.c'.format(test_name) fname = '@0@.c'.format(test_name)
test_name = test_name.underscorify() test_name = test_name.underscorify()
exe = executable(test_name, fname, exe = executable(test_name, fname,
@ -70,7 +54,8 @@ foreach test_name : rtsp_server_tests
dependencies : [gstcheck_dep, gstrtsp_dep, gstrtp_dep, gst_rtsp_server_dep] dependencies : [gstcheck_dep, gstrtsp_dep, gstrtp_dep, gst_rtsp_server_dep]
) )
test(test_name, exe, test(test_name, exe,
env : test_env + [ 'GST_REGISTRY=@0@/@1@.registry'.format(meson.current_build_dir(), test_name) ], env : env,
timeout : 120, timeout : 120,
is_parallel: false
) )
endforeach endforeach

View file

@ -1 +1 @@
#subdir('check') # FIXME subdir('check')