Alexander Hansen | f440def | 2025-06-17 16:29:59 +0200 | [diff] [blame] | 1 | test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS'] |
| 2 | gtest = dependency('gtest', main: true, disabler: true, required: false) |
| 3 | gmock = dependency('gmock', disabler: true, required: false) |
| 4 | |
| 5 | if not (gtest.found() and gmock.found()) |
| 6 | cmake = import('cmake') |
| 7 | gtest_subproject = cmake.subproject('gtest') |
| 8 | cm_gtest = gtest_subproject.dependency('gtest') |
| 9 | cm_gtest_main = gtest_subproject.dependency('gtest_main') |
| 10 | gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads]) |
| 11 | gmock = gtest_subproject.dependency('gmock') |
| 12 | |
| 13 | endif |
| 14 | |
Alexander Hansen | 6f4c6b4 | 2025-06-27 16:42:35 +0200 | [diff] [blame] | 15 | test_include_dir = include_directories('../src') |
Alexander Hansen | f440def | 2025-06-17 16:29:59 +0200 | [diff] [blame] | 16 | |
Alexander Hansen | 6f4c6b4 | 2025-06-27 16:42:35 +0200 | [diff] [blame] | 17 | subdir('entity_manager') |
Alexander Hansen | f440def | 2025-06-17 16:29:59 +0200 | [diff] [blame] | 18 | |
| 19 | test( |
| 20 | 'test_fru_utils', |
| 21 | executable( |
| 22 | 'test_fru_utils', |
| 23 | 'test_fru-utils.cpp', |
| 24 | '../src/fru_device/fru_utils.cpp', |
| 25 | '../src/fru_device/fru_reader.cpp', |
| 26 | cpp_args: test_boost_args, |
| 27 | dependencies: [boost, gtest, gmock, phosphor_logging_dep, sdbusplus], |
| 28 | include_directories: test_include_dir, |
| 29 | ), |
| 30 | ) |
| 31 | |
| 32 | test( |
| 33 | 'test_topology', |
| 34 | executable( |
| 35 | 'test_topology', |
| 36 | 'test_topology.cpp', |
| 37 | '../src/entity_manager/topology.cpp', |
| 38 | cpp_args: test_boost_args, |
| 39 | dependencies: [gtest, gmock, nlohmann_json_dep, phosphor_logging_dep], |
| 40 | include_directories: test_include_dir, |
| 41 | ), |
| 42 | ) |
| 43 | |
| 44 | test( |
| 45 | 'test_gpio_presence', |
| 46 | executable( |
| 47 | 'test_gpio_presence', |
| 48 | 'test_gpio_presence.cpp', |
| 49 | cpp_args: test_boost_args, |
| 50 | include_directories: test_include_dir, |
| 51 | dependencies: [boost, gtest, gmock, phosphor_logging_dep, libgpio_dep], |
| 52 | link_with: gpio_presence_lib, |
| 53 | ), |
| 54 | ) |