Jagpal Singh Gill | 7e11ab0 | 2023-12-08 11:41:41 -0800 | [diff] [blame] | 1 | gtest_dep = dependency('gtest', main: true, disabler: true, required: false) |
| 2 | gmock_dep = dependency('gmock', disabler: true, required: false) |
| 3 | if 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 |
| 20 | endif |
| 21 | |
| 22 | test( |
| 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 | ) |
Jagpal Singh Gill | 23f091e | 2023-12-10 15:23:19 -0800 | [diff] [blame] | 39 | |
| 40 | test( |
| 41 | 'test_health_metric', |
| 42 | executable( |
| 43 | 'test_health_metric', |
| 44 | 'test_health_metric.cpp', |
| 45 | '../health_metric.cpp', |
| 46 | '../health_utils.cpp', |
Patrick Williams | 67b8ebe | 2024-02-23 20:40:52 -0600 | [diff] [blame] | 47 | '../health_metric_config.cpp', |
Jagpal Singh Gill | 23f091e | 2023-12-10 15:23:19 -0800 | [diff] [blame] | 48 | dependencies: [ |
| 49 | gtest_dep, |
| 50 | gmock_dep, |
| 51 | phosphor_logging_dep, |
| 52 | phosphor_dbus_interfaces_dep, |
| 53 | sdbusplus_dep |
| 54 | ], |
| 55 | include_directories: '../', |
| 56 | ) |
| 57 | ) |
Jagpal Singh Gill | 79434b5 | 2023-12-10 15:33:05 -0800 | [diff] [blame] | 58 | |
| 59 | test( |
| 60 | 'test_health_metric_collection', |
| 61 | executable( |
| 62 | 'test_health_metric_collection', |
| 63 | 'test_health_metric_collection.cpp', |
| 64 | '../health_metric_collection.cpp', |
| 65 | '../health_metric.cpp', |
| 66 | '../health_metric_config.cpp', |
| 67 | '../health_utils.cpp', |
| 68 | dependencies: [ |
| 69 | gtest_dep, |
| 70 | gmock_dep, |
| 71 | phosphor_logging_dep, |
| 72 | phosphor_dbus_interfaces_dep, |
| 73 | sdbusplus_dep |
| 74 | ], |
| 75 | include_directories: '../', |
| 76 | ) |
| 77 | ) |