build: Define the preload variable name and separator globally

We may need this in multiple tests, so let's share the value
This commit is contained in:
Marco Trevisan (Treviño) 2024-05-09 21:01:50 +02:00
parent 9314d0369b
commit c1027d7c22
3 changed files with 12 additions and 10 deletions

View File

@ -331,11 +331,11 @@ if host_machine.system() != 'windows'
'gsocketclient-slow' : { 'gsocketclient-slow' : {
'depends' : slow_connect_preload_lib, 'depends' : slow_connect_preload_lib,
'env' : { 'env' : {
'LD_PRELOAD': slow_connect_preload_lib.full_path(), glib_exec_var_preload: slow_connect_preload_lib.full_path(),
} + asan_env, } + asan_env,
'installed_tests_env' : { 'installed_tests_env' : {
} + asan_env, } + asan_env,
'LD_PRELOAD': installed_tests_execdir / glib_exec_var_preload: installed_tests_execdir /
fs.name(slow_connect_preload_lib.full_path()), fs.name(slow_connect_preload_lib.full_path()),
}, },
} }

View File

@ -266,12 +266,6 @@ else
install_tag : 'tests', install_tag : 'tests',
install: installed_tests_enabled) install: installed_tests_enabled)
if host_system not in ['ios', 'darwin']
var_preload = 'LD_PRELOAD'
else
var_preload = 'DYLD_INSERT_LIBRARIES'
endif
asan_env = {} asan_env = {}
if 'address' in glib_sanitizers if 'address' in glib_sanitizers
asan_env = {'ASAN_OPTIONS': 'verify_asan_link_order=0'} asan_env = {'ASAN_OPTIONS': 'verify_asan_link_order=0'}
@ -281,10 +275,10 @@ else
'gutils-user-database' : { 'gutils-user-database' : {
'depends' : getpwuid_preload, 'depends' : getpwuid_preload,
'env' : { 'env' : {
var_preload: getpwuid_preload.full_path() glib_exec_var_preload: getpwuid_preload.full_path()
} + asan_env, } + asan_env,
'installed_tests_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, } + asan_env,
}, },
} }

View File

@ -2669,6 +2669,14 @@ gir_args = [
'--quiet', '--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') pkg = import('pkgconfig')
windows = import('windows') windows = import('windows')
gnome = import('gnome') gnome = import('gnome')