blob: 3fb652bc389ca2ae3cb9530830cd3d1cac8f87e6 [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 Williamsc8fc7282022-06-16 11:58:53 -050030 dependencies: [entity_map_json_dep, gtest, gmock, nlohmann_json_dep]
Willy Tuc710b972021-08-11 16:33:43 -070031 ))
32
33# Build/add oemrouter_unittest to test suite
34# Issue #3325
35# test('oemrouter',
36# executable(
37# 'oemrouter',
38# 'oemrouter_unittest.cpp',
39# include_directories: root_inc,
40# build_by_default: false,
41# implicit_include_directories: false,
42# dependencies: [gtest, gmock]
43# ))
44
45# Build/add message packing/unpacking unit tests
46test('message',
47 executable(
48 'message',
49 'message/pack.cpp',
50 'message/payload.cpp',
51 'message/unpack.cpp',
52 include_directories: root_inc,
53 build_by_default: false,
54 implicit_include_directories: false,
55 dependencies: [phosphor_logging_dep, crypto, systemd, sdbusplus_dep, gtest, gmock]
56 ))
57
58# Build/add closesession_unittest to test suite
59test('session/closesession',
60 executable(
61 'session_closesession',
62 'session/closesession_unittest.cpp',
63 include_directories: root_inc,
64 build_by_default: false,
65 implicit_include_directories: false,
66 dependencies: [gtest, gmock]
67 ))
68
69# Build/add sensorcommands_unittest to test suite
70test('dbus-sdr/sensorcommands',
71 executable(
72 'dbus-sdr_sensorcommands',
73 'dbus-sdr/sensorcommands_unittest.cpp',
74 include_directories: root_inc,
75 build_by_default: false,
76 implicit_include_directories: false,
77 dependencies: [sensorutils_dep, gtest, gmock]
78 ))