2018-06-11 11:46:08 +00:00
|
|
|
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',
|
2020-06-05 10:04:23 +00:00
|
|
|
'NO_AT_BRIDGE=1',
|
2021-07-06 10:57:49 +00:00
|
|
|
'CALLS_SIP_TEST=1',
|
2021-04-17 09:38:10 +00:00
|
|
|
'CALLS_AUDIOSRC=audiotestsrc',
|
|
|
|
'CALLS_AUDIOSINK=fakesink',
|
2021-09-23 08:10:25 +00:00
|
|
|
'GSETTINGS_SCHEMA_DIR=@0@/data'.format(meson.project_build_root()),
|
2018-06-11 11:46:08 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
test_cflags = [
|
2021-04-06 10:07:14 +00:00
|
|
|
'-DFOR_TESTING',
|
2020-03-20 17:33:59 +00:00
|
|
|
'-Wno-error=deprecated-declarations',
|
|
|
|
'-DPLUGIN_BUILDDIR="@0@"'.format(full_calls_plugin_builddir),
|
2018-06-11 11:46:08 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
test_link_args = [
|
|
|
|
'-fPIC',
|
|
|
|
]
|
|
|
|
|
2018-06-13 13:38:51 +00:00
|
|
|
tests = [
|
|
|
|
[ 'provider', [] ],
|
|
|
|
[ 'origin', [ 'provider' ] ],
|
|
|
|
[ 'call', [ 'provider', 'origin' ] ],
|
2018-06-11 11:46:08 +00:00
|
|
|
]
|
|
|
|
|
2018-06-13 13:38:51 +00:00
|
|
|
foreach test : tests
|
|
|
|
name = test[0]
|
2018-06-11 11:46:08 +00:00
|
|
|
|
2018-06-13 13:38:51 +00:00
|
|
|
setup_bases = test[1]
|
|
|
|
setup_bases += name
|
|
|
|
|
|
|
|
test_sources = []
|
|
|
|
foreach base : setup_bases
|
|
|
|
test_sources += [ 'setup-' + base + '.c',
|
|
|
|
'setup-' + base + '.h' ]
|
2018-06-11 11:46:08 +00:00
|
|
|
endforeach
|
2018-06-13 13:38:51 +00:00
|
|
|
test_sources += [ 'test-' + name + '.c',
|
|
|
|
'common.h' ]
|
2018-06-11 11:46:08 +00:00
|
|
|
|
2018-06-13 13:38:51 +00:00
|
|
|
t = executable(name, test_sources,
|
2021-04-06 10:44:46 +00:00
|
|
|
dummy_sources,
|
2021-04-06 10:07:14 +00:00
|
|
|
c_args : test_cflags,
|
2018-06-13 13:38:51 +00:00
|
|
|
link_args: test_link_args,
|
2021-06-22 02:20:10 +00:00
|
|
|
pie: true,
|
2021-05-17 13:21:54 +00:00
|
|
|
link_with : [calls_vala, libcalls],
|
2018-06-13 13:38:51 +00:00
|
|
|
dependencies: calls_deps,
|
2018-11-23 14:34:41 +00:00
|
|
|
include_directories : [
|
2019-08-13 10:38:40 +00:00
|
|
|
calls_includes,
|
|
|
|
dummy_include,
|
2018-11-23 14:34:41 +00:00
|
|
|
]
|
2018-06-13 13:38:51 +00:00
|
|
|
)
|
|
|
|
test(name, t, env: test_env)
|
2018-06-11 11:46:08 +00:00
|
|
|
endforeach
|
|
|
|
|
2020-03-20 17:33:59 +00:00
|
|
|
test_sources = [ 'test-manager.c' ]
|
|
|
|
|
|
|
|
t = executable('manager', test_sources,
|
|
|
|
c_args : test_cflags,
|
|
|
|
link_args: test_link_args,
|
2021-06-22 02:20:10 +00:00
|
|
|
pie: true,
|
2021-05-17 13:21:54 +00:00
|
|
|
link_with : [calls_vala, libcalls],
|
2020-03-20 17:33:59 +00:00
|
|
|
dependencies: calls_deps,
|
|
|
|
include_directories : [
|
|
|
|
calls_includes
|
|
|
|
]
|
|
|
|
)
|
|
|
|
test('manager', t, env: test_env)
|
|
|
|
|
2021-03-23 13:20:24 +00:00
|
|
|
test_sources = [ 'test-plugins.c' ]
|
|
|
|
|
|
|
|
t = executable('plugins', test_sources,
|
2021-04-06 10:44:46 +00:00
|
|
|
calls_sources,
|
2021-03-23 13:20:24 +00:00
|
|
|
c_args : test_cflags,
|
|
|
|
link_args: test_link_args,
|
2021-06-22 02:20:10 +00:00
|
|
|
pie: true,
|
2021-05-17 13:21:54 +00:00
|
|
|
link_with : [calls_vala, libcalls],
|
2021-03-23 13:20:24 +00:00
|
|
|
dependencies: calls_deps,
|
|
|
|
include_directories : [
|
|
|
|
calls_includes
|
|
|
|
]
|
|
|
|
)
|
|
|
|
test('plugins', t, env: test_env)
|
2020-03-20 17:33:59 +00:00
|
|
|
|
2021-03-18 19:29:55 +00:00
|
|
|
test_sources = [ 'test-sip.c' ]
|
|
|
|
t = executable('sip', test_sources,
|
2021-04-06 08:56:38 +00:00
|
|
|
c_args : test_cflags,
|
2021-03-18 19:29:55 +00:00
|
|
|
link_args: test_link_args,
|
2021-06-22 02:20:10 +00:00
|
|
|
pie: true,
|
2021-05-17 13:21:54 +00:00
|
|
|
link_with : [calls_vala, calls_sip, libcalls],
|
2021-03-18 19:29:55 +00:00
|
|
|
dependencies: [calls_deps, sip_deps],
|
|
|
|
include_directories : [
|
|
|
|
calls_includes,
|
|
|
|
sip_include,
|
|
|
|
]
|
|
|
|
)
|
|
|
|
test('sip', t, env: test_env)
|
|
|
|
|
2021-04-30 14:24:07 +00:00
|
|
|
test_sources = [ 'test-util.c' ]
|
|
|
|
t = executable('util', test_sources,
|
|
|
|
c_args : test_cflags,
|
|
|
|
link_args: test_link_args,
|
2021-06-22 02:20:10 +00:00
|
|
|
pie: true,
|
2021-04-30 14:24:07 +00:00
|
|
|
link_with : [calls_vala, libcalls],
|
|
|
|
dependencies: calls_deps,
|
|
|
|
include_directories : [
|
|
|
|
calls_includes,
|
|
|
|
]
|
|
|
|
)
|
|
|
|
test('util', t, env: test_env)
|
|
|
|
|
2022-02-01 18:13:16 +00:00
|
|
|
test_sources = [ 'test-ui-call.c' ]
|
|
|
|
t = executable('ui-call', test_sources,
|
|
|
|
c_args : test_cflags,
|
|
|
|
link_args : test_link_args,
|
|
|
|
pie: true,
|
|
|
|
link_with : [calls_vala, libcalls],
|
|
|
|
dependencies : calls_deps,
|
|
|
|
include_directories : [
|
|
|
|
calls_includes
|
|
|
|
]
|
|
|
|
)
|
|
|
|
test('ui-call', t, env: test_env)
|
|
|
|
|
2021-10-22 05:23:29 +00:00
|
|
|
mock_link_args = [ test_link_args,
|
|
|
|
'-Wl,--wrap=lfb_init',
|
|
|
|
'-Wl,--wrap=lfb_uninit',
|
|
|
|
'-Wl,--wrap=lfb_event_set_feedback_profile',
|
|
|
|
'-Wl,--wrap=lfb_event_trigger_feedback_async',
|
|
|
|
'-Wl,--wrap=lfb_event_trigger_feedback_finish',
|
|
|
|
'-Wl,--wrap=lfb_event_end_feedback_async',
|
|
|
|
'-Wl,--wrap=lfb_event_end_feedback_finish',
|
|
|
|
'-Wl,--wrap=calls_contacts_provider_new',
|
|
|
|
]
|
|
|
|
cmocka = dependency ('cmocka', required: false)
|
|
|
|
|
|
|
|
if cmocka.found ()
|
|
|
|
test_sources = [
|
|
|
|
'mock-call.c', 'mock-call.h', 'mock-libfeedback.h',
|
|
|
|
'test-ringer.c'
|
|
|
|
]
|
|
|
|
|
|
|
|
t = executable('ringer', test_sources,
|
|
|
|
c_args : test_cflags,
|
|
|
|
link_args: mock_link_args,
|
|
|
|
pie: true,
|
|
|
|
link_with : [calls_vala, libcalls],
|
|
|
|
dependencies: [calls_deps, cmocka],
|
|
|
|
include_directories : [
|
|
|
|
calls_includes,
|
|
|
|
]
|
|
|
|
)
|
|
|
|
test('ringer', t, env: test_env)
|
|
|
|
endif
|
|
|
|
|
2018-06-11 11:46:08 +00:00
|
|
|
endif
|