Move plugin specific tests into dedicated directory
This will prove beneficial when we also add tests for the policy engine plugins. The increased locality is also nice to have.
This commit is contained in:
committed by
Guido Günther
parent
86a8f3ae22
commit
11ba83c16e
+1
-1
@@ -132,9 +132,9 @@ add_project_arguments(
|
||||
|
||||
subdir('po')
|
||||
subdir('src')
|
||||
subdir('tests')
|
||||
subdir('plugins')
|
||||
subdir('doc')
|
||||
subdir('data')
|
||||
subdir('tests')
|
||||
|
||||
meson.add_install_script('build-aux/meson/postinstall.py')
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
calls_provider_plugin_libdir = join_paths(full_calls_plugin_libdir, 'providers')
|
||||
subdir('provider/mm')
|
||||
subdir('provider/dummy')
|
||||
subdir('provider/ofono')
|
||||
subdir('provider/sip')
|
||||
subdir('provider/tests')
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
dummy_include = include_directories('.')
|
||||
|
||||
dummy_install_dir = join_paths(full_calls_plugin_libdir, 'dummy')
|
||||
dummy_install_dir = join_paths(calls_provider_plugin_libdir, 'dummy')
|
||||
|
||||
dummy_plugin = configure_file(
|
||||
input: 'dummy.plugin.in',
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
|
||||
mm_install_dir = join_paths(full_calls_plugin_libdir, 'mm')
|
||||
mm_install_dir = join_paths(calls_provider_plugin_libdir, 'mm')
|
||||
|
||||
mm_plugin = configure_file(
|
||||
input: 'mm.plugin.in',
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
subdir('libgdbofono')
|
||||
|
||||
ofono_install_dir = join_paths(full_calls_plugin_libdir, 'ofono')
|
||||
ofono_install_dir = join_paths(calls_provider_plugin_libdir, 'ofono')
|
||||
|
||||
ofono_plugin = configure_file(
|
||||
input: 'ofono.plugin.in',
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
sip_include = include_directories('.')
|
||||
|
||||
sip_install_dir = join_paths(full_calls_plugin_libdir, 'sip')
|
||||
sip_install_dir = join_paths(calls_provider_plugin_libdir, 'sip')
|
||||
|
||||
sip_plugin = configure_file(
|
||||
input: 'sip.plugin.in',
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
#
|
||||
# Copyright (C) 2022 Purism SPC
|
||||
#
|
||||
# This file is part of Calls.
|
||||
#
|
||||
# Calls is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Calls is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Calls. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
|
||||
|
||||
if get_option('tests')
|
||||
|
||||
test_env = [
|
||||
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
|
||||
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
|
||||
'G_DEBUG=gc-friendly,fatal-warnings',
|
||||
'GSETTINGS_BACKEND=memory',
|
||||
'PYTHONDONTWRITEBYTECODE=yes',
|
||||
'MALLOC_CHECK_=2',
|
||||
'NO_AT_BRIDGE=1',
|
||||
'CALLS_SIP_TEST=1',
|
||||
'CALLS_AUDIOSRC=audiotestsrc',
|
||||
'CALLS_AUDIOSINK=fakesink',
|
||||
'GSETTINGS_SCHEMA_DIR=@0@/data'.format(meson.project_build_root()),
|
||||
]
|
||||
|
||||
test_cflags = [
|
||||
'-DFOR_TESTING',
|
||||
'-Wno-error=deprecated-declarations',
|
||||
'-DPLUGIN_BUILDDIR="@0@"'.format(full_calls_plugin_builddir),
|
||||
]
|
||||
|
||||
test_link_args = [
|
||||
'-fPIC',
|
||||
]
|
||||
|
||||
tests = [
|
||||
[ 'provider', [] ],
|
||||
[ 'origin', [ 'provider' ] ],
|
||||
[ 'call', [ 'provider', 'origin' ] ],
|
||||
]
|
||||
|
||||
foreach test : tests
|
||||
name = test[0]
|
||||
|
||||
setup_bases = test[1]
|
||||
setup_bases += name
|
||||
|
||||
test_sources = []
|
||||
foreach base : setup_bases
|
||||
test_sources += [ 'setup-' + base + '.c',
|
||||
'setup-' + base + '.h' ]
|
||||
endforeach
|
||||
test_sources += [ 'test-' + name + '.c',
|
||||
'common.h' ]
|
||||
|
||||
t = executable(name, test_sources,
|
||||
dummy_sources,
|
||||
c_args : test_cflags,
|
||||
link_args: test_link_args,
|
||||
pie: true,
|
||||
link_with : [calls_vala, libcalls],
|
||||
dependencies: calls_deps,
|
||||
include_directories : [
|
||||
calls_includes,
|
||||
dummy_include,
|
||||
]
|
||||
)
|
||||
test(name, t, env: test_env)
|
||||
endforeach
|
||||
|
||||
|
||||
|
||||
test_sources = [ 'test-media.c' ]
|
||||
test_sources += sip_sources
|
||||
t = executable('media', test_sources,
|
||||
c_args : test_cflags,
|
||||
link_args: test_link_args,
|
||||
pie: true,
|
||||
link_with : [calls_vala, libcalls],
|
||||
dependencies: [calls_deps, sip_deps],
|
||||
include_directories : [
|
||||
calls_includes,
|
||||
sip_include,
|
||||
]
|
||||
)
|
||||
test('media', t, env: test_env)
|
||||
|
||||
test_sources = [ 'test-sip.c' ]
|
||||
test_sources += sip_sources
|
||||
t = executable('sip', test_sources,
|
||||
c_args : test_cflags,
|
||||
link_args: test_link_args,
|
||||
pie: true,
|
||||
link_with : [calls_vala, libcalls],
|
||||
dependencies: [calls_deps, sip_deps],
|
||||
include_directories : [
|
||||
calls_includes,
|
||||
sip_include,
|
||||
]
|
||||
)
|
||||
test('sip', t, env: test_env)
|
||||
|
||||
test_sources = [ 'test-srtp.c' ]
|
||||
test_sources += sip_sources
|
||||
t = executable('srtp', test_sources,
|
||||
c_args : test_cflags,
|
||||
link_args: test_link_args,
|
||||
pie: true,
|
||||
link_with : [calls_vala, libcalls],
|
||||
dependencies: [calls_deps, sip_deps],
|
||||
include_directories : [
|
||||
calls_includes,
|
||||
sip_include,
|
||||
]
|
||||
)
|
||||
test('srtp', t, env: test_env)
|
||||
|
||||
test_sources = [ 'test-sdp-crypto.c' ]
|
||||
test_sources += sip_sources
|
||||
t = executable('sdp-crypto', test_sources,
|
||||
c_args : test_cflags,
|
||||
link_args: test_link_args,
|
||||
pie: true,
|
||||
link_with : [calls_vala, libcalls],
|
||||
dependencies: [calls_deps, sip_deps],
|
||||
include_directories : [
|
||||
calls_includes,
|
||||
sip_include,
|
||||
]
|
||||
)
|
||||
test('sdp-crypto', t, env: test_env)
|
||||
|
||||
|
||||
endif
|
||||
+9
-4
@@ -742,6 +742,7 @@ calls_manager_init (CallsManager *self)
|
||||
GApplication *application;
|
||||
PeasEngine *peas;
|
||||
const gchar *dir;
|
||||
g_autofree char *default_plugin_dir_provider = NULL;
|
||||
|
||||
self->state_flags = CALLS_MANAGER_FLAGS_UNKNOWN;
|
||||
self->providers = g_hash_table_new_full (g_str_hash,
|
||||
@@ -802,15 +803,19 @@ calls_manager_init (CallsManager *self)
|
||||
|
||||
dir = g_getenv ("CALLS_PLUGIN_DIR");
|
||||
if (dir && dir[0] != '\0') {
|
||||
g_autofree char *plugin_dir_provider = NULL;
|
||||
/** Add the directory to the search path. prepend_search_path() does not work
|
||||
* as expected. see https://gitlab.gnome.org/GNOME/libpeas/-/issues/19
|
||||
*/
|
||||
g_debug ("Adding %s to plugin search path", dir);
|
||||
peas_engine_add_search_path (peas, dir, NULL);
|
||||
|
||||
plugin_dir_provider = g_build_filename (dir, "provider", NULL);
|
||||
g_debug ("Adding %s to plugin search path", plugin_dir_provider);
|
||||
peas_engine_add_search_path (peas, plugin_dir_provider, NULL);
|
||||
}
|
||||
|
||||
peas_engine_add_search_path (peas, PLUGIN_LIBDIR, NULL);
|
||||
g_debug ("Scanning for plugins in `%s'", PLUGIN_LIBDIR);
|
||||
default_plugin_dir_provider = g_build_filename(PLUGIN_LIBDIR, "provider", NULL);
|
||||
peas_engine_add_search_path (peas, default_plugin_dir_provider, NULL);
|
||||
g_debug ("Scanning for plugins in `%s'", default_plugin_dir_provider);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,9 +8,6 @@ test_env = [
|
||||
'PYTHONDONTWRITEBYTECODE=yes',
|
||||
'MALLOC_CHECK_=2',
|
||||
'NO_AT_BRIDGE=1',
|
||||
'CALLS_SIP_TEST=1',
|
||||
'CALLS_AUDIOSRC=audiotestsrc',
|
||||
'CALLS_AUDIOSINK=fakesink',
|
||||
'GSETTINGS_SCHEMA_DIR=@0@/data'.format(meson.project_build_root()),
|
||||
]
|
||||
|
||||
@@ -29,41 +26,6 @@ mock_link_args = [ test_link_args,
|
||||
]
|
||||
|
||||
|
||||
tests = [
|
||||
[ 'provider', [] ],
|
||||
[ 'origin', [ 'provider' ] ],
|
||||
[ 'call', [ 'provider', 'origin' ] ],
|
||||
]
|
||||
|
||||
foreach test : tests
|
||||
name = test[0]
|
||||
|
||||
setup_bases = test[1]
|
||||
setup_bases += name
|
||||
|
||||
test_sources = []
|
||||
foreach base : setup_bases
|
||||
test_sources += [ 'setup-' + base + '.c',
|
||||
'setup-' + base + '.h' ]
|
||||
endforeach
|
||||
test_sources += [ 'test-' + name + '.c',
|
||||
'common.h' ]
|
||||
|
||||
t = executable(name, test_sources,
|
||||
dummy_sources,
|
||||
c_args : test_cflags,
|
||||
link_args: test_link_args,
|
||||
pie: true,
|
||||
link_with : [calls_vala, libcalls],
|
||||
dependencies: calls_deps,
|
||||
include_directories : [
|
||||
calls_includes,
|
||||
dummy_include,
|
||||
]
|
||||
)
|
||||
test(name, t, env: test_env)
|
||||
endforeach
|
||||
|
||||
test_sources = [ 'test-manager.c' ]
|
||||
|
||||
t = executable('manager', test_sources,
|
||||
@@ -93,66 +55,6 @@ t = executable('plugins', test_sources,
|
||||
)
|
||||
test('plugins', t, env: test_env)
|
||||
|
||||
test_sources = [ 'test-media.c' ]
|
||||
test_sources += sip_sources
|
||||
t = executable('media', test_sources,
|
||||
c_args : test_cflags,
|
||||
link_args: test_link_args,
|
||||
pie: true,
|
||||
link_with : [calls_vala, libcalls],
|
||||
dependencies: [calls_deps, sip_deps],
|
||||
include_directories : [
|
||||
calls_includes,
|
||||
sip_include,
|
||||
]
|
||||
)
|
||||
test('media', t, env: test_env)
|
||||
|
||||
test_sources = [ 'test-sip.c' ]
|
||||
test_sources += sip_sources
|
||||
t = executable('sip', test_sources,
|
||||
c_args : test_cflags,
|
||||
link_args: test_link_args,
|
||||
pie: true,
|
||||
link_with : [calls_vala, libcalls],
|
||||
dependencies: [calls_deps, sip_deps],
|
||||
include_directories : [
|
||||
calls_includes,
|
||||
sip_include,
|
||||
]
|
||||
)
|
||||
test('sip', t, env: test_env)
|
||||
|
||||
test_sources = [ 'test-srtp.c' ]
|
||||
test_sources += sip_sources
|
||||
t = executable('srtp', test_sources,
|
||||
c_args : test_cflags,
|
||||
link_args: test_link_args,
|
||||
pie: true,
|
||||
link_with : [calls_vala, libcalls],
|
||||
dependencies: [calls_deps, sip_deps],
|
||||
include_directories : [
|
||||
calls_includes,
|
||||
sip_include,
|
||||
]
|
||||
)
|
||||
test('srtp', t, env: test_env)
|
||||
|
||||
test_sources = [ 'test-sdp-crypto.c' ]
|
||||
test_sources += sip_sources
|
||||
t = executable('sdp-crypto', test_sources,
|
||||
c_args : test_cflags,
|
||||
link_args: test_link_args,
|
||||
pie: true,
|
||||
link_with : [calls_vala, libcalls],
|
||||
dependencies: [calls_deps, sip_deps],
|
||||
include_directories : [
|
||||
calls_includes,
|
||||
sip_include,
|
||||
]
|
||||
)
|
||||
test('sdp-crypto', t, env: test_env)
|
||||
|
||||
test_sources = [ 'test-util.c' ]
|
||||
t = executable('util', test_sources,
|
||||
c_args : test_cflags,
|
||||
|
||||
Reference in New Issue
Block a user