| gtest_dep = dependency('gtest', main: true, disabler: true, required: false) |
| gmock_dep = dependency('gmock', disabler: true, required: false) |
| if not gtest_dep.found() or not gmock_dep.found() |
| gtest_proj = import('cmake').subproject('googletest', required: false) |
| if gtest_proj.found() |
| gtest_dep = declare_dependency( |
| dependencies: [ |
| dependency('threads'), |
| gtest_proj.dependency('gtest'), |
| gtest_proj.dependency('gtest_main'), |
| ] |
| ) |
| gmock_dep = gtest_proj.dependency('gmock') |
| else |
| assert( |
| not get_option('tests').enabled(), |
| 'Googletest is required if tests are enabled' |
| ) |
| endif |
| endif |
| |
| tests = [ |
| 'elog_quiesce_test', |
| 'elog_update_ts_test', |
| 'extensions_test', |
| 'remote_logging_test_address', |
| 'remote_logging_test_config', |
| 'remote_logging_test_port', |
| 'sdtest', |
| 'serialization_test_path', |
| 'serialization_test_properties', |
| 'elog_errorwrap_test', |
| ] |
| foreach t : tests |
| test( |
| 'test_' + t.underscorify(), |
| executable( |
| 'test-' + t.underscorify(), |
| t + '.cpp', |
| log_manager_sources, |
| '../phosphor-rsyslog-config/server-conf.cpp', |
| link_with: libphosphor_logging, |
| cpp_args: [ |
| '-DTESTCASE=' + t.underscorify(), |
| '-DTESTCASE_' + t.underscorify(), |
| ], |
| dependencies: [ |
| cereal_dep, |
| gmock_dep, |
| gtest_dep, |
| pdi_dep, |
| sdbusplus_dep, |
| sdeventplus_dep, |
| ], |
| include_directories: include_directories('..', '../gen'), |
| ) |
| ) |
| endforeach |