Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [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: true) |
| 5 | gtest_dep = declare_dependency( |
| 6 | dependencies: [ |
| 7 | dependency('threads'), |
| 8 | gtest_proj.dependency('gtest'), |
| 9 | gtest_proj.dependency('gtest_main'), |
| 10 | ] |
| 11 | ) |
| 12 | gmock_dep = gtest_proj.dependency('gmock') |
| 13 | endif |
| 14 | |
| 15 | |
| 16 | tests = [ |
| 17 | 'libpldm_base_test', |
| 18 | 'libpldm_platform_test', |
| 19 | 'libpldm_bios_test', |
| 20 | 'libpldm_bios_table_test', |
| 21 | 'libpldm_fru_test', |
| 22 | 'libpldm_utils_test', |
| 23 | 'libpldm_pdr_test', |
| 24 | 'libpldm_firmware_update_test' |
| 25 | ] |
| 26 | |
| 27 | if get_option('oem-ibm').enabled() |
| 28 | tests += [ |
| 29 | 'oem/ibm/libpldm_fileio_test', |
| 30 | 'oem/ibm/libpldm_host_test', |
| 31 | ] |
| 32 | endif |
| 33 | |
| 34 | foreach t : tests |
| 35 | test(t, executable(t.underscorify(), t + '.cpp', |
| 36 | implicit_include_directories: false, |
| 37 | dependencies: [ |
| 38 | libpldm_dep, |
| 39 | gtest_dep, |
| 40 | gmock_dep]), |
| 41 | workdir: meson.current_source_dir()) |
| 42 | endforeach |
| 43 | |