Patrick Williams | a517197 | 2021-04-16 20:10:01 -0500 | [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 | |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 22 | if not get_option('openpower-pel-extension').disabled() |
| 23 | subdir('openpower-pels') |
| 24 | endif |
| 25 | |
Patrick Williams | a517197 | 2021-04-16 20:10:01 -0500 | [diff] [blame] | 26 | tests = [ |
| 27 | 'elog_quiesce_test', |
| 28 | 'elog_update_ts_test', |
| 29 | 'extensions_test', |
| 30 | 'remote_logging_test_address', |
| 31 | 'remote_logging_test_config', |
| 32 | 'remote_logging_test_port', |
| 33 | 'sdtest', |
| 34 | 'serialization_test_path', |
| 35 | 'serialization_test_properties', |
| 36 | 'elog_errorwrap_test', |
| 37 | ] |
| 38 | foreach t : tests |
| 39 | test( |
| 40 | 'test_' + t.underscorify(), |
| 41 | executable( |
| 42 | 'test-' + t.underscorify(), |
| 43 | t + '.cpp', |
William A. Kennington III | b6b2557 | 2021-05-19 17:09:41 -0700 | [diff] [blame] | 44 | 'common.cpp', |
Patrick Williams | a517197 | 2021-04-16 20:10:01 -0500 | [diff] [blame] | 45 | log_manager_sources, |
| 46 | '../phosphor-rsyslog-config/server-conf.cpp', |
Patrick Williams | a517197 | 2021-04-16 20:10:01 -0500 | [diff] [blame] | 47 | dependencies: [ |
Patrick Williams | a517197 | 2021-04-16 20:10:01 -0500 | [diff] [blame] | 48 | gmock_dep, |
| 49 | gtest_dep, |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 50 | log_manager_deps, |
William A. Kennington III | e053884 | 2021-06-11 02:01:58 -0700 | [diff] [blame] | 51 | phosphor_logging_dep, |
Patrick Williams | a517197 | 2021-04-16 20:10:01 -0500 | [diff] [blame] | 52 | ], |
| 53 | include_directories: include_directories('..', '../gen'), |
| 54 | ) |
| 55 | ) |
| 56 | endforeach |