From: Thibault Saunier Date: Fri, 18 Nov 2016 17:45:42 +0000 (-0300) Subject: meson: Modernize the way we set test env variables X-Git-Tag: 1.19.3~491^2~870 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab614e63ae7833899a952501565df2a2f674214d;p=platform%2Fupstream%2Fgstreamer.git meson: Modernize the way we set test env variables Removing the now useless getplugindirs script --- diff --git a/validate/tests/check/meson.build b/validate/tests/check/meson.build index e61f14d..c564d3b 100644 --- a/validate/tests/check/meson.build +++ b/validate/tests/check/meson.build @@ -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 diff --git a/validate/tests/getpluginsdir b/validate/tests/getpluginsdir deleted file mode 100644 index aa41ca8..0000000 --- a/validate/tests/getpluginsdir +++ /dev/null @@ -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(":")) diff --git a/validate/tests/launcher_tests/meson.build b/validate/tests/launcher_tests/meson.build index 8f16792..75a03c1 100644 --- a/validate/tests/launcher_tests/meson.build +++ b/validate/tests/launcher_tests/meson.build @@ -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 diff --git a/validate/tests/meson.build b/validate/tests/meson.build index 2f6cd48..2153ca1 100644 --- a/validate/tests/meson.build +++ b/validate/tests/meson.build @@ -1,5 +1,4 @@ # FIXME: make check work on windows -getpluginsdir = find_program('getpluginsdir') if host_machine.system() != 'windows' subdir('check') endif diff --git a/validate/tools/meson.build b/validate/tools/meson.build index dc51525..a608da1 100644 --- a/validate/tools/meson.build +++ b/validate/tools/meson.build @@ -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')