1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
sources = files(
'dconf-mock-dbus.c',
'dconf-mock-gvdb.c',
'dconf-mock-shm.c',
)
libdconf_mock = static_library(
'dconf-mock',
sources: sources,
dependencies: glib_dep,
)
envs = test_env + [
'G_TEST_SRCDIR=' + meson.current_source_dir(),
'G_TEST_BUILDDIR=' + meson.current_build_dir(),
]
test_dir = meson.current_source_dir()
dl_dep = cc.find_library('dl', required: false)
m_dep = cc.find_library('m')
unit_tests = [
# [name, sources, c_args, dependencies, link_with]
['paths', 'paths.c', [], libdconf_common_dep, []],
['changeset', 'changeset.c', [], libdconf_common_dep, []],
['shm', ['shm.c', 'tmpdir.c'], [], [dl_dep, libdconf_common_dep, libdconf_shm_test_dep], []],
['gvdb', 'gvdb.c', '-DSRCDIR="@0@"'.format(test_dir), libgvdb_dep, []],
['gdbus-thread', 'dbus.c', '-DDBUS_BACKEND="/gdbus/thread"', libdconf_gdbus_thread_dep, []],
['gdbus-filter', 'dbus.c', '-DDBUS_BACKEND="/gdbus/filter"', libdconf_gdbus_filter_dep, []],
['engine', 'engine.c', '-DSRCDIR="@0@"'.format(test_dir), [dl_dep, libdconf_engine_test_dep, m_dep], libdconf_mock],
['client', 'client.c', '-DSRCDIR="@0@"'.format(test_dir), [libdconf_client_dep, libdconf_engine_dep], libdconf_mock],
['writer', 'writer.c', '-DSRCDIR="@0@"'.format(test_dir), [glib_dep, dl_dep, m_dep, libdconf_service_dep], [libdconf_mock]],
]
foreach unit_test: unit_tests
exe = executable(
unit_test[0],
unit_test[1],
c_args: unit_test[2],
dependencies: unit_test[3],
link_with: unit_test[4],
include_directories: [top_inc, include_directories('../service')],
)
test(unit_test[0], exe, is_parallel: false, env: envs)
endforeach
python3 = find_program('python3', required: false)
dbus_daemon = find_program('dbus-daemon', required: false)
if python3.found() and dbus_daemon.found()
test_dconf_py = find_program('test-dconf.py')
test(
'dconf',
test_dconf_py,
args: [dconf.full_path(), dconf_service.full_path()]
)
else
message('Skipping dconf test because python3 or dbus-daemon is not available')
endif
|