xref: /openbmc/entity-manager/test/meson.build (revision cefe4bb6b95624a4d1691cfdba075fff4fdb39f8)
1test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS'] + [
2    '-DENABLE_FRU_UPDATE_PROPERTY=1',
3]
4gtest = 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
17test_include_dir = include_directories('../src')
18
19subdir('entity_manager')
20
21test(
22    'test_fru_utils',
23    executable(
24        'test_fru_utils',
25        'test_fru-utils.cpp',
26        'test_gzip-utils.cpp',
27        '../src/fru_device/fru_utils.cpp',
28        '../src/fru_device/fru_reader.cpp',
29        '../src/fru_device/gzip_utils.cpp',
30        cpp_args: test_boost_args,
31        dependencies: [
32            boost,
33            gmock,
34            gtest,
35            libxml2_dep,
36            phosphor_logging_dep,
37            sdbusplus,
38            zlib_dep,
39        ],
40        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)
67
68test(
69    'test_utils',
70    executable(
71        'test_utils',
72        'test_utils.cpp',
73        '../src/utils.cpp',
74        include_directories: test_include_dir,
75        dependencies: [gtest, phosphor_logging_dep, sdbusplus],
76    ),
77)
78
79test(
80    'test_gpio_presence_state',
81    executable(
82        'test_gpio_presence_state',
83        'test_gpio_presence_state.cpp',
84        cpp_args: test_boost_args,
85        include_directories: test_include_dir,
86        dependencies: [boost, gtest, gmock, phosphor_logging_dep, libgpio_dep],
87        link_with: gpio_presence_lib,
88    ),
89)
90