test: fix test library path and fix test-functional with ASAN

Set LD_LIBRARY_PATH to have processes spawned by test load the right
library.

Mark openal-info test skipped if ASAN is enabled. The problem is that
openal-info would need LD_PRELOAD to work properly then. Just disable
the test then.
This commit is contained in:
Pauli Virtanen 2025-07-28 22:05:45 +03:00 committed by Wim Taymans
parent 58d86cfb5f
commit 02aee17cc3
3 changed files with 13 additions and 1 deletions

View file

@ -135,10 +135,15 @@ endif
summary({'pactl': pactl.found()}, bool_yn: true, section: 'Functional test programs') summary({'pactl': pactl.found()}, bool_yn: true, section: 'Functional test programs')
if default_sm == 'media-session' or default_sm == 'wireplumber' if default_sm == 'media-session' or default_sm == 'wireplumber'
test_functional_c_args = []
if get_option('b_sanitize').contains('address')
test_functional_c_args += ['-DHAVE_ASAN']
endif
test('test-functional', test('test-functional',
executable('test-functional', executable('test-functional',
'test-functional.c', 'test-functional.c',
include_directories: pwtest_inc, include_directories: pwtest_inc,
c_args: [test_functional_c_args],
dependencies: [ spa_dep ], dependencies: [ spa_dep ],
link_with: pwtest_lib) link_with: pwtest_lib)
) )

View file

@ -788,6 +788,7 @@ static void set_test_env(struct pwtest_context *ctx, struct pwtest_test *t)
replace_env(t, "ACP_PROFILES_DIR", SOURCE_ROOT "/spa/plugins/alsa/mixer/profile-sets"); replace_env(t, "ACP_PROFILES_DIR", SOURCE_ROOT "/spa/plugins/alsa/mixer/profile-sets");
replace_env(t, "PIPEWIRE_LOG_SYSTEMD", "false"); replace_env(t, "PIPEWIRE_LOG_SYSTEMD", "false");
replace_env(t, "PWTEST_DATA_DIR", SOURCE_ROOT "/test/data"); replace_env(t, "PWTEST_DATA_DIR", SOURCE_ROOT "/test/data");
replace_env(t, "LD_LIBRARY_PATH", BUILD_ROOT "/src/pipewire:" BUILD_ROOT "pipewire-jack/src");
} }
static void close_pipes(int fds[_FD_LAST]) static void close_pipes(int fds[_FD_LAST])

View file

@ -10,9 +10,14 @@
PWTEST(openal_info_test) PWTEST(openal_info_test)
{ {
#ifdef OPENAL_INFO_PATH /* openal-info tries to load libpipewire, which would need
* LD_PRELOAD=/lib64/libasan.so.XX to work when ASan is enabled. Don't try to
* figure out the right preload, but just disable the test in that case.
*/
#if defined(OPENAL_INFO_PATH) && !defined(HAVE_ASAN)
int status = pwtest_spawn(OPENAL_INFO_PATH, (char *[]){ "openal-info", NULL }); int status = pwtest_spawn(OPENAL_INFO_PATH, (char *[]){ "openal-info", NULL });
pwtest_int_eq(WEXITSTATUS(status), 0); pwtest_int_eq(WEXITSTATUS(status), 0);
pwtest_int_eq(WIFSIGNALED(status), 0);
return PWTEST_PASS; return PWTEST_PASS;
#else #else
return PWTEST_SKIP; return PWTEST_SKIP;
@ -24,6 +29,7 @@ PWTEST(pactl_test)
#ifdef PACTL_PATH #ifdef PACTL_PATH
int status = pwtest_spawn(PACTL_PATH, (char *[]){ "pactl", "info", NULL }); int status = pwtest_spawn(PACTL_PATH, (char *[]){ "pactl", "info", NULL });
pwtest_int_eq(WEXITSTATUS(status), 0); pwtest_int_eq(WEXITSTATUS(status), 0);
pwtest_int_eq(WIFSIGNALED(status), 0);
return PWTEST_PASS; return PWTEST_PASS;
#else #else
return PWTEST_SKIP; return PWTEST_SKIP;