From cf6660e3d7fe2a451190f92789e300d789f95f55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Wed, 7 Aug 2024 16:25:03 -0400 Subject: [PATCH] python tests: Add analytics lib runtime path This way, it will run it against the just compiled version when doing full build. Part-of: --- subprojects/gst-python/testsuite/meson.build | 72 +++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-python/testsuite/meson.build b/subprojects/gst-python/testsuite/meson.build index 321290a38b..f476b1c44b 100644 --- a/subprojects/gst-python/testsuite/meson.build +++ b/subprojects/gst-python/testsuite/meson.build @@ -4,7 +4,7 @@ tests = [ ['Test gst', 'test_gst.py'], ['Test fundamentals', 'test_types.py'], ['Test plugins', 'test_plugin.py'], - ['Test analytics', 'test_analytics.py'], + ['Test analytics', 'test_analytics.py', ['gst-plugins-bad/gst-libs/gst/analytics', 'gst-plugins-base/gst-libs/gst/video']], ] runcmd = run_command(python, '-c', '''with open("@0@/mesonconfig.py", "w") as f: @@ -21,6 +21,34 @@ endif pypluginsdir = [join_paths (meson.project_build_root(), 'plugin'), meson.current_source_dir()] +gst_deps_defs = [ + ['gstreamer', ['gstreamer', 'gst_dep'], 'libgst'], + ['gstreamer-app', ['gst-plugins-base', 'app_dep'], 'gstapp'], + ['gstreamer-audio', ['gst-plugins-base', 'audio_dep'], 'gstaudio'], + ['gstreamer-base', ['gstreamer', 'gst_base_dep'], 'gst_base'], + ['gstreamer-controller', ['gstreamer', 'gst_controller_dep'], 'gst_controller'], + ['gstreamer-fft', ['gst-plugins-base', 'fft_dep'], 'gstfft'], + ['gstreamer-net', ['gstreamer', 'gst_net_dep'], 'gst_net'], + ['gstreamer-pbutils', ['gst-plugins-base', 'pbutils_dep'], 'pbutils'], + ['gstreamer-riff', ['gst-plugins-base', 'riff_dep'], 'gstriff'], + ['gstreamer-rtp', ['gst-plugins-base', 'rtp_dep'], 'gst_rtp'], + ['gstreamer-rtsp', ['gst-plugins-base', 'rtsp_dep'], 'gst_rtsp'], + ['gstreamer-sdp', ['gst-plugins-base', 'sdp_dep'], 'gstsdp'], + ['gstreamer-tag', ['gst-plugins-base', 'tag_dep'], 'gsttag'], + ['gstreamer-video', ['gst-plugins-base', 'video_dep'], 'gstvideo'], + ['gstreamer-webrtc', ['gst-plugins-bad', 'gstwebrtc_dep'], 'gstwebrtc'], + ['gstreamer-rtsp-server', ['gst-rtsp-server', 'gst_rtsp_server_dep'], 'gst_rtsp_server'], +] + +apiversion = '1.0' +gst_required_version = '>=@0@'.format(meson.project_version()) +gst_deps = [] + +foreach dep: gst_deps_defs + gst_deps += [dependency(dep.get(0) + '-' + apiversion, version: gst_required_version, + fallback: dep.get(1))] +endforeach + foreach i: tests test_name = i.get(0) env = environment() @@ -30,5 +58,47 @@ foreach i: tests 'gst-python@' + meson.project_build_root()) env.set('GST_PLUGIN_PATH_1_0', meson.global_build_root(), pluginsdirs + pypluginsdir) env.set('GST_REGISTRY', join_paths(meson.current_build_dir(), '@0@.registry'.format(test_name))) + + l = 0 + testsenv_ld_library_path = [] + foreach dep: gst_deps + if dep.type_name() == 'pkgconfig' + testsenv_ld_library_path += [dep.get_variable('libdir')] + else + depdef = gst_deps_defs[l][1] + libname = gst_deps_defs[l].get(2, '') + if libname != '' + proj = subproject(depdef[0]) + libpath = proj.get_variable(libname).full_path().split('/') + dirname = '' + j = 1 + foreach comp: libpath + if j < libpath.length() + dirname += '/' + comp + endif + j += 1 + endforeach + testsenv_ld_library_path += [dirname] + endif + endif + l += 1 + endforeach + + foreach j: i.get(2, []) + path = meson.project_build_root() / '..' / j + env.append('GI_TYPELIB_PATH', path) + + if build_machine.system() == 'windows' + env.append('PATH', path) + env.append('PATH', testsenv_ld_library_path) + elif build_machine.system() == 'linux' + env.append('LD_LIBRARY_PATH', path) + env.append('LD_LIBRARY_PATH', testsenv_ld_library_path) + else + env.append('DYLD_LIBRARY_PATH', path) + env.append('DYLD_LIBRARY_PATH', testsenv_ld_library_path) + endif + endforeach + test(test_name, python, args: [runtests, i.get(1)], env: env) endforeach