diff --git a/tests/meson.build b/tests/meson.build index 7d98d167..448c7631 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -28,6 +28,32 @@ if valgrind.found() timeout_multiplier: 2) endif +# The common test environment +common_test_env = environment({ + 'XDG_CONFIG_HOME': meson.current_build_dir() / '.config', + 'WIREPLUMBER_CONFIG_DIR': '/invalid', + 'WIREPLUMBER_DATA_DIR': '/invalid', + 'WIREPLUMBER_MODULE_DIR': meson.current_build_dir() / '..' / 'modules', + 'WIREPLUMBER_DEBUG': '7', +}) + +spa_plugindir = spa_dep.get_variable( + pkgconfig: 'plugindir', internal: 'plugindir', default_value: '') +pipewire_moduledir = pipewire_dep.get_variable( + pkgconfig: 'moduledir', internal: 'moduledir', default_value: '') +pipewire_confdatadir = pipewire_dep.get_variable( + pkgconfig: 'confdatadir', internal: 'confdatadir', default_value: '') + +if spa_plugindir != '' + common_test_env.set('SPA_PLUGIN_DIR', spa_plugindir) +endif +if pipewire_moduledir != '' + common_test_env.set('PIPEWIRE_MODULE_DIR', pipewire_moduledir) +endif +if pipewire_confdatadir != '' + common_test_env.set('PIPEWIRE_CONFIG_DIR', pipewire_confdatadir) +endif + subdir('wp') subdir('wplua') subdir('wpipc', if_found: wpipc_dep) diff --git a/tests/modules/meson.build b/tests/modules/meson.build index dedccaea..4b4d1bd2 100644 --- a/tests/modules/meson.build +++ b/tests/modules/meson.build @@ -1,10 +1,7 @@ common_deps = [gobject_dep, gio_dep, wp_dep, pipewire_dep] -common_env = environment({ - 'G_TEST_SRCDIR': meson.current_source_dir(), - 'G_TEST_BUILDDIR': meson.current_build_dir(), - 'WIREPLUMBER_MODULE_DIR': meson.current_build_dir() / '..' / '..' / 'modules', - 'WIREPLUMBER_DEBUG': '7', -}) +common_env = common_test_env +common_env.set('G_TEST_SRCDIR', meson.current_source_dir()) +common_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) common_args = [ '-DG_LOG_USE_STRUCTURED', ] diff --git a/tests/wp/meson.build b/tests/wp/meson.build index b19c7f97..a18caf79 100644 --- a/tests/wp/meson.build +++ b/tests/wp/meson.build @@ -1,11 +1,7 @@ common_deps = [gobject_dep, gio_dep, wp_dep, pipewire_dep] -common_env = environment({ - 'G_TEST_SRCDIR': meson.current_source_dir(), - 'G_TEST_BUILDDIR': meson.current_build_dir(), - 'XDG_CONFIG_HOME': meson.current_build_dir() / '.config', - 'WIREPLUMBER_MODULE_DIR': meson.current_build_dir() / '..' / '..' / 'modules', - 'WIREPLUMBER_DEBUG': '7', -}) +common_env = common_test_env +common_env.set('G_TEST_SRCDIR', meson.current_source_dir()) +common_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) common_args = [ '-DG_LOG_USE_STRUCTURED', ] diff --git a/tests/wplua/meson.build b/tests/wplua/meson.build index cd45c1ce..128cc309 100644 --- a/tests/wplua/meson.build +++ b/tests/wplua/meson.build @@ -1,18 +1,13 @@ common_deps = [wplua_dep, pipewire_dep, wp_dep] -common_env = environment({ - 'G_TEST_SRCDIR': meson.current_source_dir(), - 'G_TEST_BUILDDIR': meson.current_build_dir(), - 'WIREPLUMBER_CONFIG_DIR': '/invalid', - 'WIREPLUMBER_DATA_DIR': meson.current_source_dir(), - 'WIREPLUMBER_MODULE_DIR': meson.current_build_dir() / '..' / '..' / 'modules', - 'WIREPLUMBER_DEBUG': '7', -}) +common_env = common_test_env +common_env.set('G_TEST_SRCDIR', meson.current_source_dir()) +common_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) +common_env.set('WIREPLUMBER_DATA_DIR', meson.current_source_dir()) test( 'test-wplua', executable('test-wplua', 'wplua.c', dependencies: common_deps), env: common_env, - workdir : meson.current_source_dir(), ) script_tester = executable('script-tester', @@ -25,12 +20,10 @@ test( script_tester, args: ['pod.lua'], env: common_env, - workdir : meson.current_source_dir(), ) test( 'test-lua-monitor-rules', script_tester, args: ['monitor-rules.lua'], env: common_env, - workdir : meson.current_source_dir(), )