blob: 607c873415aa7465f43820491784ae8a2483f9ae [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,
George Liub4b40912024-07-17 16:14:17 +080060 override_options: ['b_lundef=true'],
Willy Tuc710b972021-08-11 16:33:43 -070061 implicit_include_directories: false,
Konstantin Aladysheve11895f2024-04-04 12:35:33 +030062 dependencies: [boost, phosphor_logging_dep, crypto, systemd, sdbusplus_dep, gtest, gmock]
Willy Tuc710b972021-08-11 16:33:43 -070063 ))
64
65# Build/add closesession_unittest to test suite
66test('session/closesession',
67 executable(
68 'session_closesession',
69 'session/closesession_unittest.cpp',
70 include_directories: root_inc,
71 build_by_default: false,
72 implicit_include_directories: false,
73 dependencies: [gtest, gmock]
74 ))
75
76# Build/add sensorcommands_unittest to test suite
77test('dbus-sdr/sensorcommands',
78 executable(
79 'dbus-sdr_sensorcommands',
80 'dbus-sdr/sensorcommands_unittest.cpp',
81 include_directories: root_inc,
82 build_by_default: false,
83 implicit_include_directories: false,
84 dependencies: [sensorutils_dep, gtest, gmock]
85 ))