From c1027d7c225eab07cd2c8ad526535e87ad47a19d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 9 May 2024 21:01:50 +0200 Subject: [PATCH] build: Define the preload variable name and separator globally We may need this in multiple tests, so let's share the value --- gio/tests/meson.build | 4 ++-- glib/tests/meson.build | 10 ++-------- meson.build | 8 ++++++++ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/gio/tests/meson.build b/gio/tests/meson.build index ce71ad308..5081ed74f 100644 --- a/gio/tests/meson.build +++ b/gio/tests/meson.build @@ -331,11 +331,11 @@ if host_machine.system() != 'windows' 'gsocketclient-slow' : { 'depends' : slow_connect_preload_lib, 'env' : { - 'LD_PRELOAD': slow_connect_preload_lib.full_path(), + glib_exec_var_preload: slow_connect_preload_lib.full_path(), } + asan_env, 'installed_tests_env' : { } + asan_env, - 'LD_PRELOAD': installed_tests_execdir / + glib_exec_var_preload: installed_tests_execdir / fs.name(slow_connect_preload_lib.full_path()), }, } diff --git a/glib/tests/meson.build b/glib/tests/meson.build index 0b1f70a91..eb0ef6e74 100644 --- a/glib/tests/meson.build +++ b/glib/tests/meson.build @@ -266,12 +266,6 @@ else install_tag : 'tests', install: installed_tests_enabled) - if host_system not in ['ios', 'darwin'] - var_preload = 'LD_PRELOAD' - else - var_preload = 'DYLD_INSERT_LIBRARIES' - endif - asan_env = {} if 'address' in glib_sanitizers asan_env = {'ASAN_OPTIONS': 'verify_asan_link_order=0'} @@ -281,10 +275,10 @@ else 'gutils-user-database' : { 'depends' : getpwuid_preload, 'env' : { - var_preload: getpwuid_preload.full_path() + glib_exec_var_preload: getpwuid_preload.full_path() } + asan_env, 'installed_tests_env' : { - var_preload: installed_tests_execdir / fs.name(getpwuid_preload.full_path()) + glib_exec_var_preload: installed_tests_execdir / fs.name(getpwuid_preload.full_path()) } + asan_env, }, } diff --git a/meson.build b/meson.build index 0744164f3..6f1d9177f 100644 --- a/meson.build +++ b/meson.build @@ -2669,6 +2669,14 @@ gir_args = [ '--quiet', ] +if host_system in ['ios', 'darwin'] + glib_exec_var_preload = 'DYLD_INSERT_LIBRARIES' + glib_exec_var_preload_separator = ':' +else + glib_exec_var_preload = 'LD_PRELOAD' + glib_exec_var_preload_separator = ' ' +endif + pkg = import('pkgconfig') windows = import('windows') gnome = import('gnome')