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 | |
| 15 | test_include_dir = '../src' |
| 16 | |
| 17 | test( |
| 18 | 'test_entity_manager', |
| 19 | executable( |
| 20 | 'test_entity_manager', |
| 21 | 'test_entity-manager.cpp', |
| 22 | '../src/entity_manager/expression.cpp', |
| 23 | '../src/utils.cpp', |
| 24 | '../src/entity_manager/utils.cpp', |
| 25 | cpp_args: test_boost_args, |
| 26 | dependencies: [ |
| 27 | boost, |
| 28 | gtest, |
| 29 | nlohmann_json_dep, |
| 30 | phosphor_logging_dep, |
| 31 | sdbusplus, |
| 32 | valijson, |
| 33 | ], |
| 34 | include_directories: test_include_dir, |
| 35 | ), |
| 36 | ) |
| 37 | |
| 38 | test( |
| 39 | 'test_fru_utils', |
| 40 | executable( |
| 41 | 'test_fru_utils', |
| 42 | 'test_fru-utils.cpp', |
| 43 | '../src/fru_device/fru_utils.cpp', |
| 44 | '../src/fru_device/fru_reader.cpp', |
| 45 | cpp_args: test_boost_args, |
| 46 | dependencies: [boost, gtest, gmock, phosphor_logging_dep, sdbusplus], |
| 47 | include_directories: test_include_dir, |
| 48 | ), |
| 49 | ) |
| 50 | |
| 51 | test( |
| 52 | 'test_topology', |
| 53 | executable( |
| 54 | 'test_topology', |
| 55 | 'test_topology.cpp', |
| 56 | '../src/entity_manager/topology.cpp', |
| 57 | cpp_args: test_boost_args, |
| 58 | dependencies: [gtest, gmock, nlohmann_json_dep, phosphor_logging_dep], |
| 59 | include_directories: test_include_dir, |
| 60 | ), |
| 61 | ) |
| 62 | |
| 63 | test( |
| 64 | 'test_gpio_presence', |
| 65 | executable( |
| 66 | 'test_gpio_presence', |
| 67 | 'test_gpio_presence.cpp', |
| 68 | cpp_args: test_boost_args, |
| 69 | include_directories: test_include_dir, |
| 70 | dependencies: [boost, gtest, gmock, phosphor_logging_dep, libgpio_dep], |
| 71 | link_with: gpio_presence_lib, |
| 72 | ), |
| 73 | ) |