Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [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 | 'telemetry-ut', |
| 24 | executable( |
| 25 | 'telemetry-ut', |
| 26 | [ |
| 27 | '../src/persistent_json_storage.cpp', |
| 28 | 'src/test_persistent_json_storage.cpp', |
| 29 | ], |
| 30 | dependencies: [ |
| 31 | boost, |
| 32 | gmock_dep, |
| 33 | gtest_dep, |
| 34 | nlohmann_json, |
| 35 | phosphor_logging, |
| 36 | sdbusplus, |
| 37 | ], |
| 38 | include_directories: '../src', |
| 39 | ) |
| 40 | ) |