meson: test: Fix environment object usage
authorThibault Saunier <thibault.saunier@osg.samsung.com>
Tue, 28 Mar 2017 17:18:38 +0000 (14:18 -0300)
committerThibault Saunier <thibault.saunier@osg.samsung.com>
Tue, 28 Mar 2017 17:20:50 +0000 (14:20 -0300)
And use get_pkgconfig_variable instead of calling pkg-config ourself

tests/check/meson.build

index 3c1a00f..f420303 100644 (file)
@@ -17,18 +17,11 @@ test_defines = [
   '-DGST_USE_UNSTABLE_API',
 ]
 
-pluginsdirs = [  ]
-# FIXME: Use if not gst_dep.is_internal() when avalaible as we only support the
-# case where GStreamer is another subproject here.
-if not meson.is_subproject()
-  pkgconfig = find_program('pkg-config')
-  runcmd = run_command(pkgconfig, '--variable=pluginsdir', 'gstreamer-' + api_version)
-
-  if runcmd.returncode() == 0
-      pluginsdirs = runcmd.stdout().split()
-  else
-    error('Could not determine GStreamer core plugins directory for unit tests.')
-  endif
+pluginsdirs = []
+if gst_dep.type_name() == 'pkgconfig'
+  pbase = dependency('gstreamer-plugins-base-' + api_version, required : false)
+  pluginsdirs = [gst_dep.get_pkgconfig_variable('pluginsdir'),
+                 pbase.get_pkgconfig_variable('pluginsdir')]
 endif
 
 test_deps = [gst_dep, gstbase_dep, gstcheck_dep, gstaudio_dep, gstapp_dep, gstfft_dep]
@@ -60,11 +53,7 @@ foreach t : ugly_tests
     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_PLUGIN_PATH_1_0', [meson.build_root()] + pluginsdirs)
     env.set('GST_REGISTRY', '@0@/@1@.registry'.format(meson.current_build_dir(), test_name))
     test(test_name, exe, env: env, timeout: 3 * 60)
   endif