xref: /openbmc/dbus-sensors/src/tests/meson.build (revision d7be555e)
1gtest_dep = dependency('gtest', main: true, disabler: true, required: false)
2gmock_dep = dependency('gmock', disabler: true, required: false)
3if not gtest_dep.found() or not gmock_dep.found()
4    gtest_proj = import('cmake').subproject('googletest', required: false)
5    if gtest_proj.found()
6        gtest_dep = declare_dependency(
7            dependencies: [
8                dependency('threads'),
9                gtest_proj.dependency('gtest'),
10                gtest_proj.dependency('gtest_main'),
11            ],
12        )
13        gmock_dep = gtest_proj.dependency('gmock')
14    else
15        assert(
16            not get_option('tests').allowed(),
17            'Googletest is required if tests are enabled',
18        )
19    endif
20endif
21
22ut_deps_list = [
23    gtest_dep,
24]
25
26ut_deps_list += default_deps
27src_inc = include_directories('..')
28
29test(
30    'test_utils',
31    executable(
32        'test_utils',
33        'test_Utils.cpp',
34        '../Utils.cpp',
35        dependencies: ut_deps_list,
36        implicit_include_directories: false,
37        include_directories: src_inc,
38    ),
39)
40
41test(
42    'test_ipmb',
43    executable(
44        'test_ipmb',
45        '../ipmb/IpmbSensor.cpp',
46        '../Utils.cpp',
47        '../ipmb/IpmbSDRSensor.cpp',
48        'test_IpmbSensor.cpp',
49        dependencies: ut_deps_list,
50        link_with: [
51            utils_a,
52            thresholds_a,
53            devicemgmt_a
54        ],
55        implicit_include_directories: false,
56        include_directories: src_inc,
57    ),
58)
59