blob: b2b992978fa5dc27a8711ad0b248ec0b2aa5823a [file] [log] [blame]
Willy Tuc710b972021-08-11 16:33:43 -07001gtest = dependency('gtest', main: true, disabler: true, required: false)
2gmock = dependency('gmock', disabler: true, required: false)
3if not gtest.found() or not gmock.found()
4 gtest_opts = import('cmake').subproject_options()
5 gtest_opts.add_cmake_defines({'CMAKE_CXX_FLAGS': '-Wno-pedantic'})
6 gtest_proj = import('cmake').subproject(
7 'googletest',
8 options: gtest_opts,
9 required: false)
10 if gtest_proj.found()
11 gtest = declare_dependency(
12 dependencies: [
13 dependency('threads'),
14 gtest_proj.dependency('gtest'),
15 gtest_proj.dependency('gtest_main'),
16 ])
17 gmock = gtest_proj.dependency('gmock')
18 else
19 assert(not get_option('tests').enabled(), 'Googletest is required')
20 endif
21endif
22
23test('entitymap_json',
24 executable(
25 'entitymap_json',
26 'entitymap_json_unittest.cpp',
27 include_directories: root_inc,
28 build_by_default: false,
29 implicit_include_directories: false,
Patrick Williamsbbc6ad42022-06-16 12:26:23 -050030 dependencies: [
31 entity_map_json_dep,
32 gmock,
33 gtest,
34 nlohmann_json_dep,
35 sdbusplus_dep,
36 ]
Willy Tuc710b972021-08-11 16:33:43 -070037 ))
38
39# Build/add oemrouter_unittest to test suite
40# Issue #3325
41# test('oemrouter',
42# executable(
43# 'oemrouter',
44# 'oemrouter_unittest.cpp',
45# include_directories: root_inc,
46# build_by_default: false,
47# implicit_include_directories: false,
48# dependencies: [gtest, gmock]
49# ))
50
51# Build/add message packing/unpacking unit tests
52test('message',
53 executable(
54 'message',
55 'message/pack.cpp',
56 'message/payload.cpp',
57 'message/unpack.cpp',
58 include_directories: root_inc,
59 build_by_default: false,
60 implicit_include_directories: false,
Konstantin Aladysheve11895f2024-04-04 12:35:33 +030061 dependencies: [boost, phosphor_logging_dep, crypto, systemd, sdbusplus_dep, gtest, gmock]
Willy Tuc710b972021-08-11 16:33:43 -070062 ))
63
64# Build/add closesession_unittest to test suite
65test('session/closesession',
66 executable(
67 'session_closesession',
68 'session/closesession_unittest.cpp',
69 include_directories: root_inc,
70 build_by_default: false,
71 implicit_include_directories: false,
72 dependencies: [gtest, gmock]
73 ))
74
75# Build/add sensorcommands_unittest to test suite
76test('dbus-sdr/sensorcommands',
77 executable(
78 'dbus-sdr_sensorcommands',
79 'dbus-sdr/sensorcommands_unittest.cpp',
80 include_directories: root_inc,
81 build_by_default: false,
82 implicit_include_directories: false,
83 dependencies: [sensorutils_dep, gtest, gmock]
84 ))