tests: fix meson test env setup to make sure we use the right gst-plugin-scanner

If core is built as a subproject (e.g. as in gst-build), make sure to use
the gst-plugin-scanner from the built subproject. Without this, gstreamer
might accidentally use the gst-plugin-scanner from the install prefix if
that exists, which in turn might drag in gst library versions we didn't
mean to drag in. Those gst library versions might then be older than
what our current build needs, and might cause our newly-built plugins
to get blacklisted in the test registry because they rely on a symbol
that the wrongly-pulled in gst lib doesn't have.

This should fix running of unit tests in gst-build when invoking
meson test or ninja test from outside the devenv for the case where
there is an older or different-version gst-plugin-scanner installed
in the install prefix.

In case no gst-plugin-scanner is installed in the install prefix, this
will fix "GStreamer-WARNING: External plugin loader failed. This most
likely means that the plugin loader helper binary was not found or
could not be run. You might need to set the GST_PLUGIN_SCANNER
environment variable if your setup is unusual." warnings when running
the unit tests.

In the case where we find GStreamer core via pkg-config we use
a newly-added pkg-config var "pluginscannerdir" to get the right
directory. This has the benefit of working transparently for both
installed and uninstalled pkg-config files/setups.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/582>
This commit is contained in:
Tim-Philipp Müller 2020-02-27 00:05:52 +00:00 committed by GStreamer Merge Bot
parent b82c8f5854
commit 01265c10cd

View file

@ -131,10 +131,14 @@ 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, valgrind_dep] + glib_deps
pluginsdirs = [ ]
pluginsdirs = []
if gst_dep.type_name() == 'pkgconfig'
pluginsdirs = [gst_dep.get_pkgconfig_variable('pluginsdir')]
gst_plugin_scanner_dir = gst_dep.get_pkgconfig_variable('pluginscannerdir')
else
gst_plugin_scanner_dir = gst_proj.get_variable('gst_scanner_dir')
endif
gst_plugin_scanner_path = join_paths(gst_plugin_scanner_dir, 'gst-plugin-scanner')
foreach t : base_tests
fname = t.get(0)
@ -167,6 +171,7 @@ foreach t : base_tests
env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer',
'gst-plugins-base@' + meson.build_root())
env.set('GST_REGISTRY', join_paths(meson.current_build_dir(), '@0@.registry'.format(test_name)))
env.set('GST_PLUGIN_SCANNER_1_0', gst_plugin_scanner_path)
test(test_name, exe, env: env, timeout: 3 * 60)
endif
endforeach
@ -189,6 +194,7 @@ foreach group : [1, 2, 3, 4, 5, 6]
env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer',
'gst-plugins-base@' + meson.build_root())
env.set('GST_REGISTRY', join_paths(meson.current_build_dir(), '@0@.registry'.format(test_name)))
env.set('GST_PLUGIN_SCANNER_1_0', gst_plugin_scanner_path)
test(vscale_test_name, exe, env: env, timeout: 3 * 60)
endforeach