1gtest_dep = dependency('gtest', main: true, disabler: true, required: false) 2gmock_dep = dependency('gmock', disabler: true, required: false) 3if 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 20endif 21 22if not get_option('openpower-pel-extension').disabled() 23 subdir('openpower-pels') 24endif 25 26tests = [ 27 'extensions_test', 28 'log_manager_dbus_tests', 29 'remote_logging_test_address', 30 'remote_logging_test_config', 31 'remote_logging_test_port', 32 'sdtest', 33 'serialization_test_path', 34 'serialization_test_properties', 35] 36foreach t : tests 37 test( 38 'test_' + t.underscorify(), 39 executable( 40 'test-' + t.underscorify(), 41 t + '.cpp', 42 'common.cpp', 43 log_manager_sources, 44 '../phosphor-rsyslog-config/server-conf.cpp', 45 dependencies: [ 46 gmock_dep, 47 gtest_dep, 48 log_manager_deps, 49 pdi_dep, 50 phosphor_logging_dep, 51 ], 52 include_directories: include_directories('..', '../gen'), 53 ) 54 ) 55endforeach 56 57tests_non_parallel = [ 58 'elog_quiesce_test', 59 'elog_update_ts_test', 60 'elog_errorwrap_test', 61] 62 63foreach t : tests_non_parallel 64 test( 65 'test_' + t.underscorify(), 66 executable( 67 'test-' + t.underscorify(), 68 t + '.cpp', 69 'common.cpp', 70 log_manager_sources, 71 '../phosphor-rsyslog-config/server-conf.cpp', 72 dependencies: [ 73 gmock_dep, 74 gtest_dep, 75 log_manager_deps, 76 phosphor_logging_dep, 77 ], 78 include_directories: include_directories('..', '../gen'), 79 ), 80 is_parallel: false, 81 ) 82endforeach 83