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.
Remove now unneeded getpluginsdir and define c++ tests in the same loop.

Bump meson requirement to 0.35
This commit is contained in:
Thibault Saunier 2016-10-04 17:44:51 -03:00
parent 86d18fa9ff
commit 558172d418
4 changed files with 130 additions and 135 deletions

View file

@ -52,3 +52,5 @@ executable('mklicensestables', 'mklicensestables.c',
dependencies : [tag_dep, gst_base_dep],
install : false,
)
gst_tag_dir = meson.current_source_dir()

View file

@ -1,6 +1,6 @@
project('gst-plugins-base', 'c', 'cpp',
version : '1.9.90',
meson_version : '>= 0.33.0',
meson_version : '>= 0.35.0',
default_options : [ 'warning_level=1',
'c_std=gnu99',
'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

@ -2,69 +2,69 @@ have_registry = true # FIXME not get_option('disable_registry')
# name, condition when to skip the test and extra dependencies
base_tests = [
[ 'gst/typefindfunctions', not have_registry ],
[ 'libs/allocators' ],
[ 'libs/audio' ],
[ 'libs/audiocdsrc' ],
[ 'libs/audiodecoder' ],
[ 'libs/audioencoder' ],
[ 'libs/baseaudiovisualizer' ],
[ 'libs/discoverer' ],
[ 'libs/fft' ],
[ 'libs/libsabi' ],
[ 'libs/mikey' ],
[ 'libs/navigation' ],
[ 'libs/pbutils' ],
[ 'libs/profile' ],
[ 'libs/rtpbasedepayload' ],
[ 'libs/rtpbasepayload' ],
[ 'libs/rtp' ],
[ 'libs/rtsp' ],
[ 'libs/rtspconnection' ],
[ 'libs/sdp' ],
[ 'libs/tag' ],
[ 'gst/typefindfunctions.c', not have_registry ],
[ 'libs/allocators.c' ],
[ 'libs/audio.c' ],
[ 'libs/audiocdsrc.c' ],
[ 'libs/audiodecoder.c' ],
[ 'libs/audioencoder.c' ],
[ 'libs/baseaudiovisualizer.c' ],
[ 'libs/discoverer.c' ],
[ 'libs/fft.c' ],
[ 'libs/libsabi.c' ],
[ 'libs/mikey.c' ],
[ 'libs/navigation.c' ],
[ 'libs/pbutils.c' ],
[ 'libs/profile.c' ],
[ 'libs/rtpbasedepayload.c' ],
[ 'libs/rtpbasepayload.c' ],
[ 'libs/rtp.c' ],
[ 'libs/rtsp.c' ],
[ 'libs/rtspconnection.c' ],
[ 'libs/sdp.c' ],
[ 'libs/tag.c' ],
# [ 'libs/video' ], # FIXME: times out, perhaps split or spawn conversions into benchmark tool and/or multiple threads
[ 'libs/videodecoder' ],
[ 'libs/videoencoder' ],
[ 'libs/videotimecode' ],
[ 'libs/xmpwriter' ],
[ 'elements/adder' ],
[ 'elements/appsink' ],
[ 'elements/appsrc' ],
[ 'elements/audioconvert' ],
[ 'elements/audiorate' ],
[ 'elements/audiotestsrc' ],
[ 'elements/audioresample' ],
[ 'elements/libvisual', not libvisual_dep.found() ],
[ 'elements/decodebin' ],
[ 'elements/encodebin', not theoraenc_dep.found() or not vorbisenc_dep.found() ],
[ 'elements/multifdsink' ],
[ 'elements/multisocketsink' ],
[ 'elements/playbin' ],
[ 'elements/playbin-complex', not ogg_dep.found() ],
[ 'elements/playsink' ],
[ 'elements/streamsynchronizer' ],
[ 'elements/subparse' ],
[ 'elements/textoverlay', not pango_dep.found() ],
[ 'elements/videoconvert' ],
[ 'elements/videorate' ],
[ 'elements/videoscale' ],
[ 'elements/videotestsrc' ],
[ 'elements/volume', false, [ gst_controller_dep ] ],
[ 'elements/vorbisdec', not vorbis_dep.found(), [ vorbis_dep, vorbisenc_dep ] ],
[ 'elements/vorbistag', not vorbisenc_dep.found(), [ vorbis_dep, vorbisenc_dep ] ],
[ 'generic/clock-selection' ],
[ 'generic/states' ],
[ 'pipelines/simple-launch-lines' ],
[ 'pipelines/basetime' ],
[ 'pipelines/capsfilter-renegotiation' ],
[ 'pipelines/gio' ],
[ 'pipelines/oggmux', not ogg_dep.found(), [ ogg_dep, ] ],
[ 'pipelines/streamsynchronizer' ],
[ 'pipelines/tcp' ], # FIXME: -DHAVE_GIO_UNIX_2_0=1
[ 'pipelines/theoraenc', not theoraenc_dep.found(), [ theoraenc_dep ] ],
[ 'pipelines/vorbisenc', not vorbisenc_dep.found() ],
[ 'pipelines/vorbisdec', not vorbisenc_dep.found(),],
[ 'libs/videoencoder.c' ],
[ 'libs/videotimecode.c' ],
[ 'libs/xmpwriter.c' ],
[ 'elements/adder.c' ],
[ 'elements/appsink.c' ],
[ 'elements/appsrc.c' ],
[ 'elements/audioconvert.c' ],
[ 'elements/audiorate.c' ],
[ 'elements/audiotestsrc.c' ],
[ 'elements/audioresample.c' ],
[ 'elements/libvisual.c', not libvisual_dep.found() ],
[ 'elements/decodebin.c' ],
[ 'elements/encodebin.c', not theoraenc_dep.found() or not vorbisenc_dep.found() ],
[ 'elements/multifdsink.c' ],
[ 'elements/multisocketsink.c' ],
[ 'elements/playbin.c' ],
[ 'elements/playbin-complex.c', not ogg_dep.found() ],
[ 'elements/playsink.c' ],
[ 'elements/streamsynchronizer.c' ],
[ 'elements/subparse.c' ],
[ 'elements/textoverlay.c', not pango_dep.found() ],
[ 'elements/videoconvert.c' ],
[ 'elements/videorate.c' ],
[ 'elements/videoscale.c' ],
[ 'elements/videotestsrc.c' ],
[ 'elements/volume.c', false, [ gst_controller_dep ] ],
[ 'elements/vorbisdec.c', not vorbis_dep.found(), [ vorbis_dep, vorbisenc_dep ] ],
[ 'elements/vorbistag.c', not vorbisenc_dep.found(), [ vorbis_dep, vorbisenc_dep ] ],
[ 'generic/clock-selection.c' ],
[ 'generic/states.c' ],
[ 'pipelines/simple-launch-lines.c' ],
[ 'pipelines/basetime.c' ],
[ 'pipelines/capsfilter-renegotiation.c' ],
[ 'pipelines/gio.c' ],
[ 'pipelines/oggmux.c', not ogg_dep.found(), [ ogg_dep, ] ],
[ 'pipelines/streamsynchronizer.c' ],
[ 'pipelines/tcp.c' ], # FIXME: -DHAVE_GIO_UNIX_2_0=1
[ 'pipelines/theoraenc.c', not theoraenc_dep.found(), [ theoraenc_dep ] ],
[ 'pipelines/vorbisenc.c', not vorbisenc_dep.found() ],
[ 'pipelines/vorbisdec.c', not vorbisenc_dep.found(),],
[ 'libs/gstlibscpp.cc', false, [ ] ],
]
# FIXME: enable orc testing
@ -80,54 +80,67 @@ test_defines = [
'-UG_DISABLE_ASSERT',
'-UG_DISABLE_CAST_CHECKS',
'-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_PLUGIN_LOADING_WHITELIST"',
'-DGST_TEST_FILES_PATH="' + meson.source_root() + '/tests/files"',
'-DGST_TEST_FILE="' + meson.source_root() + '/tests/files/partialframe.mjpeg"', # for libs/discoverer
'-DGST_TEST_FILES_PATH="' + meson.current_source_dir() + '/../files"',
'-DGST_TEST_FILE="' + meson.current_source_dir() + '/../files/partialframe.mjpeg"', # for libs/discoverer
'-DGST_USE_UNSTABLE_API',
]
getpluginsdir = find_program('getpluginsdir')
runcmd = run_command(getpluginsdir, 'gstreamer', 'gstreamer-1.0')
if runcmd.returncode() == 0
core_plugins_dir = runcmd.stdout().strip()
message('Using GStreamer plug-ins in ' + core_plugins_dir)
else
error('Could not determine GStreamer core plugins directory for unit tests.')
endif
test_env = [
'GST_PLUGIN_SYSTEM_PATH_1_0=',
'GST_PLUGIN_PATH_1_0=' + meson.build_root() + '/gst:' + meson.build_root() + '/ext:' + meson.build_root() + '/sys:' + core_plugins_dir,
'GST_PLUGIN_LOADING_WHITELIST=gstreamer:gst-plugins-base@' + meson.build_root(),
'GST_TAG_LICENSE_TRANSLATIONS_DICT=' + meson.source_root() + '/gst-libs/gst/tag/license-translations.dict',
'GST_STATE_IGNORE_ELEMENTS=cdio cdparanoiasrc libvisual_ alsasrc alsasink',
'CK_DEFAULT_TIMEOUT=20',
]
test_deps = [gst_dep, gst_base_dep, gst_net_dep, gst_check_dep, audio_dep,
video_dep, pbutils_dep, rtp_dep, rtsp_dep, tag_dep, allocators_dep, app_dep,
fft_dep, riff_dep, sdp_dep, gio_dep] + glib_deps
foreach t : base_tests
test_name = t.get(0)
extra_deps = [ ]
if t.length() == 3
extra_deps = t.get(2)
skip_test = t.get(1)
elif t.length() == 2
skip_test = t.get(1)
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-' + apiversion)
if runcmd.returncode() == 0
pluginsdirs = runcmd.stdout().split()
else
skip_test = false
error('Could not determine GStreamer core plugins directory for unit tests.')
endif
endif
foreach t : base_tests
fname = t.get(0)
test_name = fname.split('.').get(0)
skip_test = false
extra_deps = [ ]
if t.length() >= 3
extra_deps = t.get(2)
endif
if t.length() >= 2
skip_test = t.get(1)
endif
if not skip_test
exe = executable(test_name, '@0@.c'.format(test_name),
exe = executable(test_name, fname,
include_directories : [configinc],
c_args : ['-DHAVE_CONFIG_H=1' ] + test_defines,
cpp_args : gst_plugins_base_args,
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)],
timeout: 3 * 60
)
env = environment()
env.set('GST_PLUGIN_PATH_1_0', meson.build_root())
env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
env.set('GST_STATE_IGNORE_ELEMENTS', 'cdio cdparanoiasrc libvisual_ alsasrc alsasink')
env.set('CK_DEFAULT_TIMEOUT', '20')
env.set('GST_TAG_LICENSE_TRANSLATIONS_DICT', gst_tag_dir + '/license-translations.dict')
env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer',
'gst-plugins-base@' + 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
endforeach
@ -138,14 +151,21 @@ foreach group : [1, 2, 3, 4, 5, 6]
include_directories : [configinc],
c_args : ['-DHAVE_CONFIG_H=1', '-DVSCALE_TEST_GROUP=@0@'.format(group) ] + test_defines,
dependencies : [libm] + test_deps + extra_deps)
test(vscale_test_name, exe,
env: test_env + ['GST_REGISTRY=@0@/@1@.registry'.format(meson.current_build_dir(), test_name)],
timeout: 3 * 60)
endforeach
# ===============> FIXME <==========
test('gstlibscpp', executable('gstlibscpp', 'libs/gstlibscpp.cc',
include_directories : [configinc],
cpp_args : gst_plugins_base_args,
dependencies : test_deps),
env: test_env + [ 'GST_REGISTRY=@0@/gstlibscpp.registry'.format(meson.current_build_dir()) ])
# TODO Use env.copy when it is in meson
env = environment()
env.set('GST_PLUGIN_PATH_1_0', meson.build_root())
env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
env.set('GST_STATE_IGNORE_ELEMENTS', 'cdio cdparanoiasrc libvisual_ alsasrc alsasink')
env.set('CK_DEFAULT_TIMEOUT', '20')
env.set('GST_TAG_LICENSE_TRANSLATIONS_DICT', gst_tag_dir + '/license-translations.dict')
env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer',
'gst-plugins-base@' + 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(vscale_test_name, exe, env: env, timeout: 3 * 60)
endforeach