From 74204393ff5c99109e18b1bce01d725af23485f8 Mon Sep 17 00:00:00 2001 From: Julian Sparber Date: Sat, 19 Nov 2022 14:08:11 +0100 Subject: [PATCH] tests: Use CALLS_PLUGIN_DIR to search for plugins in the build dir There is no need to add a second variable to search for plugins, we can use CALLS_PLUGIN_DIR directly. --- meson.build | 2 -- plugins/provider/tests/meson.build | 2 +- plugins/provider/tests/test-sip.c | 4 ---- tests/meson.build | 2 +- tests/test-manager.c | 6 ------ tests/test-plugins.c | 18 ++++++++++++------ 6 files changed, 14 insertions(+), 20 deletions(-) diff --git a/meson.build b/meson.build index afa1d60..8afb926 100644 --- a/meson.build +++ b/meson.build @@ -47,8 +47,6 @@ full_servicedir = join_paths(prefix, get_option('datadir'), 'dbus-1', 'services' localedir = get_option('localedir') full_localedir = join_paths(prefix, localedir) full_calls_plugin_libdir = join_paths(prefix, libdir, calls_name, 'plugins') -# Path to plugins inside the build dir, used for testing -full_calls_plugin_builddir = join_paths(builddir, 'plugins') libcall_ui_dep = dependency('call-ui', fallback: ['libcall-ui', 'libcall_ui_dep'], diff --git a/plugins/provider/tests/meson.build b/plugins/provider/tests/meson.build index 881ce18..49f5cd1 100644 --- a/plugins/provider/tests/meson.build +++ b/plugins/provider/tests/meson.build @@ -32,12 +32,12 @@ test_env = [ 'CALLS_AUDIOSRC=audiotestsrc', 'CALLS_AUDIOSINK=fakesink', 'GSETTINGS_SCHEMA_DIR=@0@/data'.format(meson.project_build_root()), + 'CALLS_PLUGIN_DIR=@0@/plugins'.format(meson.project_build_root()), ] test_cflags = [ '-DFOR_TESTING', '-Wno-error=deprecated-declarations', - '-DPLUGIN_BUILDDIR="@0@"'.format(full_calls_plugin_builddir), ] test_link_args = [ diff --git a/plugins/provider/tests/test-sip.c b/plugins/provider/tests/test-sip.c index d16a036..d9c013f 100644 --- a/plugins/provider/tests/test-sip.c +++ b/plugins/provider/tests/test-sip.c @@ -429,10 +429,6 @@ main (int argc, gtk_test_init (&argc, &argv, NULL); gst_init (NULL, NULL); - -#ifdef PLUGIN_BUILDDIR - peas_engine_add_search_path (peas_engine_get_default (), PLUGIN_BUILDDIR, NULL); -#endif /* this is a workaround for an issue with sofia: https://github.com/freeswitch/sofia-sip/issues/58 */ su_random64 (); diff --git a/tests/meson.build b/tests/meson.build index 60df9ad..c592318 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -9,12 +9,12 @@ test_env = [ 'MALLOC_CHECK_=2', 'NO_AT_BRIDGE=1', 'GSETTINGS_SCHEMA_DIR=@0@/data'.format(meson.project_build_root()), + 'CALLS_PLUGIN_DIR=@0@/plugins'.format(meson.project_build_root()), ] test_cflags = [ '-DFOR_TESTING', '-Wno-error=deprecated-declarations', - '-DPLUGIN_BUILDDIR="@0@"'.format(full_calls_plugin_builddir), ] test_link_args = [ diff --git a/tests/test-manager.c b/tests/test-manager.c index b34a460..9caa4e9 100644 --- a/tests/test-manager.c +++ b/tests/test-manager.c @@ -262,12 +262,6 @@ main (gint argc, gtk_test_init (&argc, &argv, NULL); - /* Add builddir as search path */ -#ifdef PLUGIN_BUILDDIR - plugin_dir_provider = g_build_filename (PLUGIN_BUILDDIR, "provider", NULL); - peas_engine_add_search_path (peas_engine_get_default (), plugin_dir_provider, NULL); -#endif - g_test_add_func("/Calls/Manager/without_provider", test_calls_manager_without_provider); g_test_add_func("/Calls/Manager/dummy_provider", test_calls_manager_dummy_provider); g_test_add_func("/Calls/Manager/mm_provider", test_calls_manager_mm_provider); diff --git a/tests/test-plugins.c b/tests/test-plugins.c index b0ae8b2..1af15cc 100644 --- a/tests/test-plugins.c +++ b/tests/test-plugins.c @@ -48,7 +48,6 @@ gint main (gint argc, gchar *argv[]) { - g_autofree char *plugin_dir_provider = NULL; PeasEngine *peas; const gchar *dir; g_autofree char *default_plugin_dir_provider = NULL; @@ -57,11 +56,18 @@ main (gint argc, peas = peas_engine_get_default (); - /* Add builddir as search path */ -#ifdef PLUGIN_BUILDDIR - plugin_dir_provider = g_build_filename (PLUGIN_BUILDDIR, "provider", NULL); - peas_engine_add_search_path (peas_engine_get_default (), plugin_dir_provider, NULL); -#endif + dir = g_getenv ("CALLS_PLUGIN_DIR"); + if (dir && dir[0] != '\0') { + g_autofree char *plugin_dir_provider = NULL; + plugin_dir_provider = g_build_filename (dir, "provider", NULL); + g_debug ("Adding %s to plugin search path", plugin_dir_provider); + peas_engine_prepend_search_path (peas, plugin_dir_provider, NULL); + } + + default_plugin_dir_provider = g_build_filename (PLUGIN_LIBDIR, "provider", NULL); + g_debug ("Adding %s to plugin search path", default_plugin_dir_provider); + peas_engine_add_search_path (peas, default_plugin_dir_provider, NULL); + peas_engine_rescan_plugins (peas); dir = g_getenv ("CALLS_PLUGIN_DIR"); if (dir && dir[0] != '\0') {