python tests: Add analytics lib runtime path

This way, it will run it against the just compiled version when doing full build.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6026>
This commit is contained in:
Olivier Crête 2024-08-07 16:25:03 -04:00 committed by GStreamer Marge Bot
parent 9fc017667f
commit cf6660e3d7

View file

@ -4,7 +4,7 @@ tests = [
['Test gst', 'test_gst.py'], ['Test gst', 'test_gst.py'],
['Test fundamentals', 'test_types.py'], ['Test fundamentals', 'test_types.py'],
['Test plugins', 'test_plugin.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: 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()] 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 foreach i: tests
test_name = i.get(0) test_name = i.get(0)
env = environment() env = environment()
@ -30,5 +58,47 @@ foreach i: tests
'gst-python@' + meson.project_build_root()) 'gst-python@' + meson.project_build_root())
env.set('GST_PLUGIN_PATH_1_0', meson.global_build_root(), pluginsdirs + pypluginsdir) 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))) 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) test(test_name, python, args: [runtests, i.get(1)], env: env)
endforeach endforeach