blob: 1784e4c004be3fa2909209e26740e9a9b8d3deaa [file] [log] [blame]
William A. Kennington III5e893b92020-06-04 02:47:29 -07001gtest_dep = dependency('gtest', main: true, disabler: true, required: get_option('tests'))
2gmock_dep = dependency('gmock', disabler: true, required: get_option('tests'))
Patrick Williamsad145e02020-05-19 16:45:15 -05003
4tests = [
5 'bus/list_names',
6 'bus/match',
7 'exception/sdbus_error',
8 'message/append',
9 'message/read',
10 'message/native_types',
11 'message/types',
12 'timer',
13 'utility/tuple_to_array',
14 'utility/type_traits',
15]
16
17foreach t : tests
18 test(
19 'test_' + t.underscorify(),
20 executable(
21 'test-' + t.underscorify(),
22 t + '.cpp',
Patrick Williamsad145e02020-05-19 16:45:15 -050023 dependencies: [
24 gtest_dep,
25 gmock_dep,
Patrick Williamsd0285b92020-06-01 09:43:47 -050026 sdbusplus_dep,
Patrick Williamsad145e02020-05-19 16:45:15 -050027 ],
28 )
29 )
30endforeach
31
William A. Kennington III5e893b92020-06-04 02:47:29 -070032assert(
33 not get_option('tests').enabled() or boost_dep.found(),
34 'Boost is required when tests are enabled'
35)
36
Patrick Williamsad145e02020-05-19 16:45:15 -050037test(
Patrick Williams3a6d5842020-06-09 14:59:58 -050038 'test-bus_aio',
39 executable(
40 'test-bus_aio',
41 'bus/aio.cpp',
42 dependencies: [
43 boost_dep,
44 gmock_dep,
Patrick Williams3a6d5842020-06-09 14:59:58 -050045 gtest_dep,
46 sdbusplus_dep,
47 ],
48 )
49)
50
51test(
Patrick Williamsad145e02020-05-19 16:45:15 -050052 'test-vtable',
53 executable(
54 'test-vtable',
55 'vtable/vtable.cpp',
56 'vtable/vtable_c.c',
Patrick Williams617e7492020-06-18 09:28:38 -050057 dependencies: [
58 gtest_dep,
59 sdbusplus_dep,
60 ],
Patrick Williamsad145e02020-05-19 16:45:15 -050061 ),
62)
63
64server_buildroot = meson.current_build_dir()
65server_files = files(
66 run_command(
67 sdbusgen_prog,
68 '--tool', sdbusplusplus_prog,
69 '--output', server_buildroot,
70 'server',
71 check: true
72 ).stdout().strip().split('\n')
73)
74
75test(
76 'test-server',
77 executable(
78 'test-server',
79 'server/object.cpp',
80 server_files,
Patrick Williamsd0285b92020-06-01 09:43:47 -050081 include_directories: include_directories('server'),
Patrick Williamsad145e02020-05-19 16:45:15 -050082 dependencies: [
83 gmock_dep,
Patrick Williamsad145e02020-05-19 16:45:15 -050084 gtest_dep,
Patrick Williamsd0285b92020-06-01 09:43:47 -050085 sdbusplus_dep,
Patrick Williamsad145e02020-05-19 16:45:15 -050086 ],
87 ),
88)