mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 03:45:39 +00:00
launcher: check: Properly set PLUGIN_PATH and registry when running in gst-build
This makes registry Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-devtools/-/merge_requests/197>
This commit is contained in:
parent
90cc65f7ee
commit
91ac75aa4c
1 changed files with 34 additions and 0 deletions
|
@ -71,12 +71,43 @@ class MesonTest(Test):
|
|||
|
||||
|
||||
class GstCheckTest(MesonTest):
|
||||
__gst_paths = {}
|
||||
|
||||
def get_valgrind_suppressions(self):
|
||||
result = super().get_valgrind_suppressions()
|
||||
result.extend(get_gst_build_valgrind_suppressions())
|
||||
|
||||
return result
|
||||
|
||||
def get_subproc_env(self):
|
||||
bdir = self.test_infos['__bdir__']
|
||||
|
||||
env = super().get_subproc_env()
|
||||
if 'GST_PLUGIN_PATH' not in env and 'GST_PLUGIN_PATH_1_0' not in env:
|
||||
return env
|
||||
|
||||
plugins_path = self.__gst_paths.get(bdir)
|
||||
if not plugins_path:
|
||||
try:
|
||||
with open(os.path.join(bdir, "GstPluginsPath.json")) as f:
|
||||
plugins_path = self.__gst_paths[bdir] = set(json.load(f))
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
if not plugins_path:
|
||||
return env
|
||||
|
||||
cpath = set(env.get('GST_PLUGIN_PATH', '').split(os.pathsep)) | set(env.get('GST_PLUGIN_PATH_1_0', '').split(os.pathsep))
|
||||
cpath -= set(self.options.meson_build_dirs)
|
||||
cpath |= plugins_path
|
||||
|
||||
env['GST_REGISTRY'] = os.path.normpath(bdir + "/registry.dat")
|
||||
env['GST_PLUGIN_PATH'] = os.pathsep.join(cpath)
|
||||
if 'GST_PLUGIN_PATH_1_0' in env:
|
||||
del env['GST_PLUGIN_PATH_1_0']
|
||||
|
||||
return env
|
||||
|
||||
|
||||
class MesonTestsManager(TestsManager):
|
||||
name = "mesontest"
|
||||
|
@ -114,6 +145,8 @@ class MesonTestsManager(TestsManager):
|
|||
if not self.options.meson_build_dirs:
|
||||
self.options.meson_build_dirs = [config.BUILDDIR]
|
||||
|
||||
self.options.meson_build_dirs = [os.path.realpath(p) for p in self.options.meson_build_dirs]
|
||||
|
||||
mesontests = []
|
||||
for i, bdir in enumerate(self.options.meson_build_dirs):
|
||||
bdir = os.path.abspath(bdir)
|
||||
|
@ -121,6 +154,7 @@ class MesonTestsManager(TestsManager):
|
|||
[meson, 'introspect', '--tests', bdir])
|
||||
|
||||
for test_dict in json.loads(output.decode()):
|
||||
test_dict['__bdir__'] = bdir
|
||||
mesontests.append(test_dict)
|
||||
|
||||
return mesontests
|
||||
|
|
Loading…
Reference in a new issue