blob: 4df0d46cc7e5b4be86fcd1d64e6c9ca43b46770e [file] [log] [blame]
Jagpal Singh Gill7e11ab02023-12-08 11:41:41 -08001gtest_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').enabled(),
17 'Googletest is required if tests are enabled'
18 )
19 endif
20endif
21
22test(
23 'test_health_metric_config',
24 executable(
25 'test_health_metric_config',
26 'test_health_metric_config.cpp',
27 '../health_metric_config.cpp',
28 dependencies: [
29 gtest_dep,
30 gmock_dep,
31 phosphor_logging_dep,
32 phosphor_dbus_interfaces_dep,
33 sdbusplus_dep,
34 nlohmann_json_dep
35 ],
36 include_directories: '../',
37 )
38)