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 = [ |
Patrick Williams | a517197 | 2021-04-16 20:10:01 -0500 | [diff] [blame] | 27 | 'extensions_test', |
| 28 | 'remote_logging_test_address', |
| 29 | 'remote_logging_test_config', |
| 30 | 'remote_logging_test_port', |
| 31 | 'sdtest', |
| 32 | 'serialization_test_path', |
| 33 | 'serialization_test_properties', |
Patrick Williams | a517197 | 2021-04-16 20:10:01 -0500 | [diff] [blame] | 34 | ] |
| 35 | foreach t : tests |
| 36 | test( |
| 37 | 'test_' + t.underscorify(), |
| 38 | executable( |
| 39 | 'test-' + t.underscorify(), |
| 40 | t + '.cpp', |
William A. Kennington III | b6b2557 | 2021-05-19 17:09:41 -0700 | [diff] [blame] | 41 | 'common.cpp', |
Patrick Williams | a517197 | 2021-04-16 20:10:01 -0500 | [diff] [blame] | 42 | log_manager_sources, |
| 43 | '../phosphor-rsyslog-config/server-conf.cpp', |
Patrick Williams | a517197 | 2021-04-16 20:10:01 -0500 | [diff] [blame] | 44 | dependencies: [ |
Patrick Williams | a517197 | 2021-04-16 20:10:01 -0500 | [diff] [blame] | 45 | gmock_dep, |
| 46 | gtest_dep, |
Patrick Williams | d9f0d64 | 2021-04-21 15:43:21 -0500 | [diff] [blame] | 47 | log_manager_deps, |
William A. Kennington III | e053884 | 2021-06-11 02:01:58 -0700 | [diff] [blame] | 48 | phosphor_logging_dep, |
Patrick Williams | a517197 | 2021-04-16 20:10:01 -0500 | [diff] [blame] | 49 | ], |
| 50 | include_directories: include_directories('..', '../gen'), |
| 51 | ) |
| 52 | ) |
| 53 | endforeach |
Lei YU | 972dd4f | 2023-12-12 04:04:19 +0000 | [diff] [blame] | 54 | |
| 55 | tests_non_parallel = [ |
| 56 | 'elog_quiesce_test', |
| 57 | 'elog_update_ts_test', |
| 58 | 'elog_errorwrap_test', |
| 59 | ] |
| 60 | |
| 61 | foreach t : tests_non_parallel |
| 62 | test( |
| 63 | 'test_' + t.underscorify(), |
| 64 | executable( |
| 65 | 'test-' + t.underscorify(), |
| 66 | t + '.cpp', |
| 67 | 'common.cpp', |
| 68 | log_manager_sources, |
| 69 | '../phosphor-rsyslog-config/server-conf.cpp', |
| 70 | dependencies: [ |
| 71 | gmock_dep, |
| 72 | gtest_dep, |
| 73 | log_manager_deps, |
| 74 | phosphor_logging_dep, |
| 75 | ], |
| 76 | include_directories: include_directories('..', '../gen'), |
| 77 | ), |
| 78 | is_parallel: false, |
| 79 | ) |
| 80 | endforeach |