blob: 5282b07b3bc910652c815194ba86d4a4bec7ac3d [file] [log] [blame]
Naresh Solanki89092a92025-06-02 15:48:04 +05301test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS'] + [
2 '-DENABLE_FRU_UPDATE_PROPERTY=1',
3]
Alexander Hansenf440def2025-06-17 16:29:59 +02004gtest = dependency('gtest', main: true, disabler: true, required: false)
5gmock = dependency('gmock', disabler: true, required: false)
6
7if not (gtest.found() and gmock.found())
8 cmake = import('cmake')
9 gtest_subproject = cmake.subproject('gtest')
10 cm_gtest = gtest_subproject.dependency('gtest')
11 cm_gtest_main = gtest_subproject.dependency('gtest_main')
12 gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads])
13 gmock = gtest_subproject.dependency('gmock')
14
15endif
16
Alexander Hansen6f4c6b42025-06-27 16:42:35 +020017test_include_dir = include_directories('../src')
Alexander Hansenf440def2025-06-17 16:29:59 +020018
Alexander Hansen6f4c6b42025-06-27 16:42:35 +020019subdir('entity_manager')
Alexander Hansenf440def2025-06-17 16:29:59 +020020
21test(
22 'test_fru_utils',
23 executable(
24 'test_fru_utils',
25 'test_fru-utils.cpp',
Ed Tanous10c57652025-09-30 10:24:57 -070026 'test_gzip-utils.cpp',
Alexander Hansenf440def2025-06-17 16:29:59 +020027 '../src/fru_device/fru_utils.cpp',
28 '../src/fru_device/fru_reader.cpp',
Ed Tanous10c57652025-09-30 10:24:57 -070029 '../src/fru_device/gzip_utils.cpp',
Alexander Hansenf440def2025-06-17 16:29:59 +020030 cpp_args: test_boost_args,
Ed Tanous10c57652025-09-30 10:24:57 -070031 dependencies: [
32 boost,
33 gmock,
34 gtest,
35 libxml2_dep,
36 phosphor_logging_dep,
37 sdbusplus,
38 zlib_dep,
39 ],
Alexander Hansenf440def2025-06-17 16:29:59 +020040 include_directories: test_include_dir,
41 ),
42)
43
44test(
45 'test_topology',
46 executable(
47 'test_topology',
48 'test_topology.cpp',
49 '../src/entity_manager/topology.cpp',
50 cpp_args: test_boost_args,
51 dependencies: [gtest, gmock, nlohmann_json_dep, phosphor_logging_dep],
52 include_directories: test_include_dir,
53 ),
54)
55
56test(
57 'test_gpio_presence',
58 executable(
59 'test_gpio_presence',
60 'test_gpio_presence.cpp',
61 cpp_args: test_boost_args,
62 include_directories: test_include_dir,
63 dependencies: [boost, gtest, gmock, phosphor_logging_dep, libgpio_dep],
64 link_with: gpio_presence_lib,
65 ),
66)
George Liuce8d1d02025-08-25 08:58:25 +080067
68test(
69 'test_utils',
70 executable(
71 'test_utils',
72 'test_utils.cpp',
73 '../src/utils.cpp',
74 include_directories: test_include_dir,
Ed Tanousc5a2af92025-08-25 08:58:25 +080075 dependencies: [gtest, phosphor_logging_dep, sdbusplus],
George Liuce8d1d02025-08-25 08:58:25 +080076 ),
77)